Learn how to create a file gateway and configure NFS shares within multiple availability zones.
- [Instructor] Now we'll create a file gateway using AWS Storage Gateway. Before we get started, there are two things that we need to take care of. First, click into S3. We need to create the bucket that will be the backend for this gateway. Click Create bucket. We'll give it a name like file-gateway-backend and then I'll pin my initials, so the name is globally unique. Click Create. Now that we have the bucket, click back to the AWS main console, and go to the EC2 section.
We need to create a security group. Down here in the left-hand side, under Network & Security, choose Security Groups and click Create Security Group. We need to allow HTTP traffic from the world, because when we activate the gateway, AWS will attempt to connect to it on port 80 and set things up. So we'll allow port 80 from anywhere. Now click Add Rule and choose the predefined HTTP option here. You can see that prefills port 80 in all zeros, meaning anywhere in the world, and we'll click Create.
With those two things out of the way, click back to the AWS main console, and we'll go to Storage Gateway. Here in Storage Gateway, we've not created anything yet, so we see the welcome page, and the blue Get started button. Click it to continue. You can see now we have the option to select any of the gateway types that I mentioned in the previous video. File, volume, and tape. For this demo, we're creating a File Gateway. Click Next. Now we're choosing the platform for the storage gateway instance itself. If we were running VMware or Microsoft Hyper-V for our virtualization platform in an on-premises data center, we would choose that option, because remember, one of the primary use cases of storage gateway is to create a bridge from a local data center to the cloud.
For the purposes of this demo, I don't have a local data center, so I'm going to choose Amazon EC2. When I select this option, you can see that I get a new button, Launch Instance, and the icon next to it with the arrow hints at what it's going to do, which is open a new tab outside of this creation wizard. Before we click it, let's expand this Set up instructions and see what Amazon has to say about this instance that we're about to create. First of all, they recommend that we go with an m4.xlarge instance type at a minimum. We need a Public IP on this instance, and we need to add a Volume to serve as the local cache for this storage gateway.
Remember the gateway keeps a local cache of hot content, so it doesn't always have to go back to S3 when you request a file. Of course, we need to allow in NFS traffic on TCP 2049. We've already got a security group from a previous lesson. Remember, when we did EFS, we created a group to allow 2049 traffic from within a VPC. We'll be reusing that rule in this lesson. Collapse the instructions and click Launch Instance to open a new tab. Here we are in the EC2 instance creation wizard, but we start on step two.
Remember that step one is the selection of the AMI that forms the basis of this instance. Storage gateway has prefilled the AMI to one that already has the gateway software on it. Here, we're choosing instance type. Scroll down and we'll select m4.xlarge. This is a more expensive instance type than the ones that we've created before in this video series, so make sure to watch the tear-down video to ensure that you have note on expected charges. Click Next: Configure Instance Details. We can leave everything as is on this page.
Notice that the Public IP option is using the subnet setting, which is defaulted to Enable. Next, Add Storage. Here we have the Root Volume, but we want to add a new volume to serve as the cache. AWS recommends that we have at least 150 gigabytes as the basis for this caching disc. They also devote an entire section of the storage gateway documentation to the subject of caching. If you search for Managing Local Discs For Your AWS Storage Gateway, you can find a lot of information on how to tailor disc cache size to your particular use case.
Click Next: Add Tags. We'll add one tag and that's the capital N Name tag. Remember that throughout AWS, if you add a tag with the key Name, with a capital letter for the N, it will show up in lots of helpful places, like the EC2 instance list. We'll call this one FileGatewayDemo. Next, Configure Security Group. We want to attach two security groups to this instance. First, HTTPFromWorld, which we just created, and second, the NFSFromVPC.
Click Review and Launch. We see a warning here. We've not attached any security groups that allow port 22 or SSH traffic into the instance. This means that we won't be able to log into this instance ourselves, but that's okay, because AWS is going to fully manage this storage gateway instance. It just needs to be activated over the web port, and we don't have to do anything. Click Continue. Review the options. Make sure everything looks good. Then click Launch to choose your SSH key. Now as I said, we don't actually need to SSH to this instance, so we can do something we've not done before, which is proceed without a key pair.
Amazon wants us to acknowledge that we're not going to be able to connect to this instance, and that's okay. Click Launch Instances. We see the success screen here, and the instance is coming up. If you click on the instance ID, we'll be conveyed to the EC2 instance list to see the status. This file gateway is already in the running state, but we shouldn't try to connect to it until it's passed its initial status checks. We'll wait for this initializing message to go away. Remember that you can always click the refresh icon up in the top to see the latest changes.
Okay, now that the status checks have passed, let's copy the Public IP address from down in the description tab, and head back to the first tab. Remember, don't go back to storage gateway through the AWS console. We're in the middle of a workflow to create a gateway on tab one here. Click Next. Then we'll fill in the IP address of this instance, and select Connect to gateway. Now that AWS has connected to the gateway, we can set a few options. We're going to select time zone, Pacific Time and the gateway name, we'll call this again FileGatewayDemo and activate the gateway.
Now that the gateway is active, we need to make sure that the storage gateway service knows that it should use that 150 gigabyte disc for cache. We have the option here that defaults to cache, so we'll say Save and Continue. We've now successfully created the storage gateway, however we can't connect to it until we create an NFS file share.
Join AWS architect Brandon Rich and learn how to configure object storage solutions and lifecycle management in Simple Storage Service (S3), a web service offered by AWS, and migrate, back up, and replicate relational data in RDS. Find out how to leverage flexible network storage with Elastic File System (EFS), and use the new AWS Glue service to move and transform data. Plus, learn how Snowball can help you transfer truckloads of data in and out of the cloud.
- What is data management?
- AWS S3 basics
- S3 bucket creation
- S3 upload and logging
- S3 event notifications
- S3 data lifecycle configuration
- Working with Amazon Elastic Block Store volumes
- Creating and mounting an EFS
- Creating an AWS RDS instance
- RDS backup and recovery
- Moving data with AWS Database Migration Service
- Moving data with Data Pipeline and Glue