Step 2: Create your EC2 resources and launch your EC2 instance - Amazon Elastic File System

Step 2: Create your EC2 resources and launch your EC2 instance

Note

You can't use Amazon EFS with Microsoft Windows–based Amazon EC2 instances.

In this step you will create a new Amazon EC2 instance running Amazon Linux 2, and configure it to automatically mount the EFS file system you just created in Step 1.

Before you can launch and connect to an Amazon EC2 instance, you need to create a key pair, unless you already have one. You can create a key pair using the Amazon EC2 console, and then you can launch your EC2 instance.

To create a key pair
  • Follow the steps in Setting up with Amazon EC2 in the Amazon EC2 User Guide for Linux Instances to create a key pair. If you already have a key pair, you don't need to create a new one. You can use your existing key pair for this exercise.

To launch the EC2 instance and mount an EFS file system
  1. Open the Amazon EC2 console at https://console.aws.amazon.com/ec2/.

  2. Choose Launch Instance.

  3. In Step 1: Choose an Amazon Machine Image (AMI), find an Amazon Linux 2 AMI at the top of the list and choose Select.

  4. In Step 2: Choose an Instance Type, choose Next: Configure Instance Details.

  5. In Step 3: Configure Instance Details, provide the following information:

    • Leave Number of instances at one.

    • Leave Purchasing option at the default setting.

    • For Network, choose the entry for the same VPC that you noted when you created your EFS file system in Step 1: Create your Amazon EFS file system.

    • For Subnet, choose a default subnet in any Availability Zone.

    • For File systems, make sure that the EFS file system that you created in Step 1: Create your Amazon EFS file system is selected. The path shown next to the file system ID is the mount point that the EC2 instance will use, which you can change.

    • The User data automatically includes the commands for mounting your Amazon EFS file system.

  6. Choose Next: Add Storage.

  7. Choose Next: Add Tags.

  8. Name your instance and choose Next: Configure Security Group.

  9. In Step 6: Configure Security Group, set Assign a security group to Select an existing security group. Choose the default security group to make sure that it can access your EFS file system.

  10. Choose Review and Launch.

  11. Choose Launch.

  12. Select the check box for the key pair that you created, and then choose Launch Instances.

    Once the EC2 instance is created and becomes available, it will be mounted to your EFS file system. At this point, you will be able to transfer files to your EFS file system.