A tricky topic when trying to connect to EFS is that you need to create an EC2 instance. There is not an easy way to mount as a network drive in your local laptop. But what if your organization is somehow bureaucratic and you need a thousand approvals just to run your new EC2 locally for the first time?
A quick win is to use CloudShell and an EC2 instance directly from the AWS Console. Just follow these steps:
- Create an EC2 instance with any Linux.
- Create a Key.
- Launch it.
- Create a Bucket in S3.
- Upload the Key.
- Open AWS CloudShell.
- Download the Key: aws s3 cp s3://MY_BUCKET/MY_KEY.pem .
- Give the right permissions to the Key: chmod 400 "MY_KEY.pem"
- Get your configuration from the Connect section in your EC2 instance.
- Connect to your EC2 instance via SSH: ssh -i "MY_KEY.pem" ec2-user@ec2MY_CONFIGURATOIN.MY_REGION.compute.amazonaws.com
- Install the Amazon EFS Client: sudo yum install -y amazon-efs-utils
- Create a folder called efs — sudo mkdir efs .
- Mount your EFS via its IP (you can get from the Attach button): sudo mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport MY_IP:/ efs
And that's all, now, you can mount your EFS without needing any special permissions in your local laptop.
Notes:
- If you're wondering why you can't directly connect EFS to your CloudShell, it's because they're in different VPCs. If you try to create a CloudShell with your own VPC connected, it also fails, in my experience. Perhaps this will be fixed in the future.
- If your EC2 is only available via private IPs, you will need to create a CloudShell using your private VPC.
Comments
Post a Comment