docs/content/v2024.2/yugabyte-platform/back-up-restore-universes/configure-backup-storage.md
Before you can back up universes, you need to configure a storage location for your backups.
Depending on your environment, you can save your YugabyteDB universe data to a variety of storage solutions.
You can configure AWS S3 and S3-compatible storage as your backup target.
S3-compatible storage requires S3 path style access.
By default, the option to use S3 path style access is not available. To ensure that you can use this feature, navigate to https://<my-yugabytedb-anywhere-ip>/features and enable the enablePathStyleAccess option.
To validate connections to your S3 storage using custom self-signed or CA certificates, add the certificates to the YugabyteDB Anywhere Trust Store. Refer to Add certificates to your trust store.
To configure S3 storage, do the following:
Navigate to Integrations > Backup > Amazon S3.
Click Create S3 Backup.
Use the Configuration Name field to provide a meaningful name for your storage configuration.
Enable IAM Role to use the YugabyteDB Anywhere instance's Identity Access Management (IAM) role for the S3 backup. See Required S3 IAM permissions.
If IAM Role is disabled, enter values for the Access Key and Access Secret fields.
For information on AWS access keys, see Manage access keys for IAM users.
In the S3 Bucket field, enter the bucket name in the format s3://bucket_name, or https://storage_vendor/s3-bucket-name for S3-compatible storage.
In the S3 Bucket Host Base field, enter the HTTP host header (endpoint URL) of the AWS S3 or S3-compatible storage, in the form s3.amazonaws.com or my.storage.com.
If you are using S3-compatible storage, set the S3 Path Style Access option to true. (The option is only available if the enablePathStyleAccess feature is enabled.)
Click Save.
You can configure access control for the S3 bucket as follows:
Provide the required access control list (ACL), and then define List, Write permissions to access Objects, as well as Read, Write permissions for the bucket, as shown in the following illustration:
Create Bucket policy to enable access to the objects stored in the bucket.
The following S3 IAM permissions are required:
"s3:DeleteObject",
"s3:PutObject",
"s3:GetObject",
"s3:ListBucket",
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
By default, Proxy Configuration for S3 storage is not available in the UI. To make it available, navigate to https://<my-yugabytedb-anywhere-ip>/features and enable the enableS3BackupProxy option.
Configure a proxy for your S3 backup configuration by setting the following options under Proxy Configuration:
You can configure Google Cloud Storage (GCS) as your backup target.
To grant access to your bucket, create a GCP service account with IAM roles for cloud storage with the following permissions:
roles/storage.admin
The credentials for this account (in JSON format) are used when creating the backup storage configuration. For information on how to obtain GCS credentials, see Cloud Storage authentication.
You can configure access control for the GCS bucket as follows:
To create a GCP backup configuration, do the following:
Navigate to Integrations > Backup > Google Cloud Storage.
Click Create GCS Backup.
Use the Configuration Name field to provide a meaningful name for your storage configuration.
Enter the URI of your GCS bucket in the GCS Bucket field. For example, gs://gcp-bucket/test_backups.
Select Use GCP IAM to use the YugabyteDB Anywhere instance's Identity Access Management (IAM) role for the GCS backup.
If Use GCP IAM is disabled, enter the credentials for your account in JSON format in the GCS Credentials field.
Click Save.
You can configure Network File System (NFS) as your backup target, as follows:
Navigate to Integrations > Backup > Network File System.
Click Create NFS Backup to access the configuration form shown in the following illustration:
Use the Configuration Name field to provide a meaningful name for your storage configuration.
Complete the NFS Storage Path field by entering /backup or another directory that provides read, write, and access permissions to the SSH user of the YugabyteDB Anywhere instance.
Click Save.
{{< warning title="Prevent back up failure due to NFS unmount on cloud VM restart" >}}
To avoid potential backup and restore errors, add the NFS mount to /etc/fstab on the nodes of universes using the backup configuration. When a cloud VM is restarted, the NFS mount may get unmounted if its entry is not in /etc/fstab. This can lead to backup failures, and errors during backup or restore.
{{< /warning >}}
You can configure Azure as your backup target.
Create a storage account in Azure, as follows:
Navigate to Portal > Storage Account and click Add (+).
Complete the mandatory fields, such as Resource group, Storage account name, and Location, as per the following illustration:
Create a blob container, as follows:
Open the storage account (for example, storagetestazure, as shown in the following illustration).
Navigate to Blob service > Containers > + Container and then click Create.
Generate an SAS Token, as follows:
Navigate to Storage account > Shared access signature, as shown in the following illustration. (Note that you must generate the SAS Token on the Storage Account, not the Container. Generating the SAS Token on the container will prevent the configuration from being applied.)
Under Allowed resource types, select Container and Object.
Under Allowed permissions, select all options as shown.
Click Generate SAS and connection string and copy the SAS token.
In YugabyteDB Anywhere:
Navigate to Integrations > Backup > Azure Storage.
Click Create AZ Backup.
Use the Configuration Name field to provide a meaningful name for your storage configuration.
Enter the Container URL of the container you created. You can obtain the container URL in Azure by navigating to Container > Properties, as shown in the following illustration:
Provide the SAS Token you generated. You can copy the SAS Token directly from Shared access signature page in Azure.
Click Save.
{{<tags/feature/ea idea="986">}}YugabyteDB Anywhere supports Azure Managed Identity (IAM) authentication for backup storage configurations, providing an alternative to SAS tokens. (Available in v2024.2.8.0 and later.)
Note that this feature is currently supported only for VM-based universes and via API.
When Azure IAM is enabled (via the parameter USE_AZURE_IAM set using the API):
Before configuring Azure IAM authentication, ensure the following:
YugabyteDB Anywhere VM. Ensure the YugabyteDB Anywhere VM has one of the following:
Managed Identity enabled:
For detailed steps, see Configure managed identities on Azure virtual machines in the Azure documentation.
App registration (Service Principal) configured:
In Azure Portal, navigate to Azure Active Directory > App registrations.
Create a new app registration or use an existing one.
Note the Application (client) ID, Directory (tenant) ID, and create a Client secret.
Set the following environment variables on the YugabyteDB Anywhere VM:
AZURE_TENANT_ID=<tenant-id>
AZURE_CLIENT_ID=<client-id>
AZURE_CLIENT_SECRET=<client-secret>
For detailed steps, see Register a Microsoft Entra app and create a service principal in the Azure documentation.
Database nodes. Ensure your database nodes are hosted on Azure VMs with one of the following:
Managed Identity enabled.
For each database node VM, follow the same steps as for the YugabyteDB Anywhere VM to enable system-assigned managed identity.
This is the recommended approach as it requires no additional credentials.
App registration with Azure credentials configured in the environment.
Use the same Service Principal as created for the YugabyteDB Anywhere VM.
Set the following environment variables on each database node VM:
AZURE_TENANT_ID=<tenant-id>
AZURE_CLIENT_ID=<client-id>
AZURE_CLIENT_SECRET=<client-secret>
Azure IAM role and permissions. Assign the Storage Blob Data Contributor role (or a stricter role) on the target storage account/container to the Managed Identity or Service Principal:
For detailed steps, see Assign Azure roles using the Azure portal in the Azure documentation.
Currently, you can only configure Azure storage with IAM using the YugabyteDB Anywhere API.
To create a storage configuration for a single Azure container with IAM:
curl -X POST \
'https://<yba-ip>/api/v1/customers/<customer-uuid>/configs' \
-H 'Content-Type: application/json' \
-H 'X-AUTH-YW-API-TOKEN: <api-token>' \
-d '{
"configName": "azure-iam-backup",
"type": "STORAGE",
"name": "AZ",
"data": {
"BACKUP_LOCATION": "https://storageaccount.blob.core.windows.net/container",
"USE_AZURE_IAM": true
}
}'
To create a storage configuration for multiple Azure regions with IAM:
curl -X POST \
'https://<yba-ip>/api/v1/customers/<customer-uuid>/configs' \
-H 'Content-Type: application/json' \
-H 'X-AUTH-YW-API-TOKEN: <api-token>' \
-d '{
"configName": "azure-multi-region-iam",
"type": "STORAGE",
"name": "AZ",
"data": {
"BACKUP_LOCATION": "https://account1.blob.core.windows.net/container1",
"USE_AZURE_IAM": true,
"REGION_LOCATIONS": [
{
"REGION": "us-west1",
"LOCATION": "https://account1.blob.core.windows.net/container1"
},
{
"REGION": "us-east1",
"LOCATION": "https://account2.blob.core.windows.net/container2"
}
]
}
}'
Use the following configuration parameters:
| Parameter | Description |
|---|---|
configName | A meaningful name for your storage configuration. |
type | Must be "STORAGE". |
name | Must be "AZ" for Azure. |
data.BACKUP_LOCATION | The container URL in the format https://storageaccount.blob.core.windows.net/container. |
data.USE_AZURE_IAM | Set to true to enable IAM authentication. When this is true, do not include SAS token credentials. |
data.REGION_LOCATIONS | Optional. Array of region-specific locations for multi-region configurations. Each entry contains: |
{{< note title="Mutually exclusive authentication" >}}
You cannot use both SAS token and Azure IAM authentication in the same configuration. When USE_AZURE_IAM is true, do not include SAS token credentials in the request.
{{< /note >}}
If your YugabyteDB universe has one node, you can create a local directory on a YB-TServer to which to back up, as follows:
Navigate to Universes, select your universe, and then select Nodes.
Click Connect.
Take note of the services and endpoints information displayed in the Connect dialog, as shown in the following illustration:
While connected using ssh, create a directory /backup and then change the owner to yugabyte, as follows:
sudo mkdir /backup; sudo chown yugabyte /backup
If there is more than one node, you should consider using a network file system mounted on each server.