October 30, 2017
How to Back Up VMs to Amazon S3 via Storage Gateway
In our first post in the series on how to back up VMs to Amazon Web Services (AWS), we examined in detail How to Back Up VMs to Amazon EBS in EC2. In this blog post, we are going to describe another method of using Amazon storage services to create an offsite VM backup repository and copy onsite VM backups to Amazon S3 via Storage Gateway using NAKIVO Backup & Replication.
To create a repository in Amazon Simple Storage Service (S3), you need to perform the following steps:
- Deploy AWS Storage Gateway in your local infrastructure;
- Connect it to an Amazon S3 bucket in the AWS Console;
- Connect NAKIVO Backup & Replication to Storage Gateway via NFS;
- Create the S3 repository.
Find the full walkthrough in our video tutorial:
AWS Storage Gateway and How to Deploy It
AWS Storage Gateway is a service that connects on-premises software with Amazon cloud storage to provide seamless integration between your on-premises storage infrastructure and the AWS storage infrastructure. The service supports three storage interfaces: file, volume, and tape, the first of which is just what we need.
File Gateway is a type of AWS Storage Gateway, which combines a service and virtual software appliance and allows storing and retrieving objects in Amazon S3 using file protocols, such as Network File System (NFS). The virtual software appliance (gateway) is deployed in your onsite environment as a virtual machine (VM), enables you to store your data in Amazon S3 via NFS file share, and provides you access to objects in the S3 storage as files. In our case, this virtual appliance will run on VMware ESXi (for this platform, File Gateway is distributed as an OVA image).
Let’s find out how to deploy File Gateway in your onsite environment.
First, you need to download the OVA image.
- Sign in to your AWS account using your credentials (if you don’t have an AWS account, create a new one at https://aws.amazon.com).
- In the AWS services section of the AWS Console, click Storage Gateway.
- Click Get started.
- Select File gateway from among the available gateway types and click Next.
- Select VMware ESXi from among the available host platforms and click Download image.
- Exit the wizard (you will return to it later).
Next, you need to deploy File Gateway as a VM from the downloaded OVA image.
- Log in to the VMware ESXi web interface. Right-click Virtual Machines and then click Create/Register VM to open the New Virtual Machine wizard.
- At the Select creation type step of the wizard, choose Deploy a virtual machine from an OVF or OVA file. Click Next.
- At the Select OVF and VMDK files step of the wizard, enter the name for your File Gateway VM and then click the Click to select files or drag/drop field.
- Go to the folder, which contains the AWS-Storage-Gateway-File.zip file downloaded at Step 1, unzip this file, and select the .ova file. Click Open.
- Click Next.
- At the Select storage step of the wizard, select the destination datastore where you want to deploy File Gateway.NOTE: The available storage space must be 250+ GB (you need 80 GB for File Gateway VM + 150 GB for future File Gateway cache).Click Next.
- At the Deployment options step of the wizard, choose Network mappings and Disk provisioning (select Thick). Click Next.
- At the final – Ready to complete – step of the wizard, check all settings. Click Finish and wait until the deployment process is complete.
Next, you need to add additional storage, where the future Storage Gateway cache will be stored.
- When the deployment process is complete, find your AWS-Storage-Gateway VM in the Virtual Machine inventory of the VMware ESXi web interface.
- Right-click the name of your VM (in our case, AWS-Storage-Gateway), and then find and click Edit settings
- In the Virtual Hardware tab, click Add hard disk, and then click New hard disk.
- Set the capacity of the New Hard disk to 150 GB. Click Save.
How to Create an Amazon S3 Bucket
To keep your backup data in Amazon S3, you need to have an Amazon S3 bucket in place. You can create an Amazon S3 bucket by undertaking the following steps (if you already have one, skip this procedure).
- Sign in to the AWS Console using your credentials. In AWS services, find and click S3 (Scalable Storage in the Cloud).
- Click Create bucket.
- In the Create bucket wizard, enter the unique name of the bucket in the Bucket name field. In our case, it is “nakivo-reposotory”. Click Create.
- Verify that your new S3 bucket is listed among Amazon S3 buckets.
How to Set an NFS Share Inside the Storage Gateway
Now you will learn how to connect your previously deployed File Gateway VM with the respective AWS Storage Gateway service and set the NFS share.
- Go to the AWS Console. Once again, find and click Storage Gateway in the AWS services section.
- On the AWS Storage Gateway page, click Get started.
- Select File gateway in the Select gateway type step of the wizard. Click Next.
- Select VMware ESXi in the Select host platform step of the wizard. Click Next.
- Now you need to connect the File Gateway VM deployed at Step 1 with the AWS Storage Gateway service. To do that, copy the IP address of your File Gateway VM and paste it into the IP address field.NOTE: You can find this IP address in the VMware ESXi web interface.Click Connect to gateway.
- If the connection was successful, you can enter the name of the gateway into the Gateway name field and click Activate gateway.
- After the successful activation, you need to configure local disks for the local file gateway cache. Choose the 150 GB hard disk you previously created and select Cache in the Allocated to column.Click Save and continue.
- Your gateway is successfully created, and you can find it in your Storage Gateway list. Now you need to create a file share. To do that, click Create file share.
- At the File share settings step of the Create file share wizard, you need to configure file share, in particular:
- Gateway: Choose the Storage Gateway your created (in our case, it is “S3 Storage Gateway”);
- Amazon S3 bucket name: Enter the name of the S3 bucket you want to use as the backup repository (in our case, it is “nakivo-repository”);
- Storage class for new objects: Select the S3 storage class you need (in our case, it is “S3 standard”);NOTE: Before selecting the S3 storage class, see the actual pricing for each storage class on the Amazon S3 pricing page.
- Access to your S3 bucket: Select the IAM role (in our case, it is “Create a new IAM role”).
- At the Review step of the wizard, set the following parameters:
- Allowed clients: Specify the IP address/addresses that will have access to this share. For example, the zero-address 0.0.0.0/0 allows access from any IP. For security reasons, think twice before choosing this IP address.
- Squash level: By default, this parameter is set to Root squash. If you leave it as is, you will probably have no access to the NFS share from NAKIVO Backup & Replication. So, choose the All squashes option.
Click Create file share.
How to Create a New VM Backup Repository in S3 with NAKIVO Backup & Replication
You can store VM backups in Amazon S3 using NAKIVO Backup & Replication. To accomplish this, perform the following:
- Log in to the web interface of NAKIVO Backup & Relication and then go to theConfigurationdashboard. In the Repositories tab, click Add Backup Repository.
- Click Create new backup Repository.
- To create a new backup repository in Amazon S3, you need to fill out several fields and configure the following parameters:
- Name: Enter the name for the S3 repository you prefer;
- Type: Select Remote NFS share;
- Path to the share: Enter the path in the format: :/name_of_the_share_in_S3 (in our case, it is “nakivo-repository”).
- f the S3 repository creation was successful, you will be able to see and verify its parameters.
You now have local VM backups for fast recovery and a copy of these VM backups in the cloud for disaster recovery. This approach is more cost-effective and reliable than direct backup to cloud. Moreover, it allows you to reduce WAN bandwidth consumption and needs less I/O operations in your Amazon S3 buckets.
NOTE: The cost of all Amazon AWS Services described in this blog post can be found on the AWS Cloud Services Pricing page.
As shown in this and related blog posts, NAKIVO Backup & Replication offers you several methods to copy your VM backup data to the AWS cloud. This can cut your costs and save you time building and maintaining an offsite backup infrastructure. With NAKIVO Backup & Replication and AWS cloud services, you can be ready to recover quickly from most disasters.
In the next blog post of this series, we will compare two methods: VM backup to Amazon EBS EC2 and VM backup to Amazon S3 via Storage Gateway with NAKIVO Backup & Replication. So, stay tuned for our Blog updates!