DEV Community

Cover image for How to connect to EFS via CloudShell
Federico Navarrete
Federico Navarrete

Posted on • Edited on • Originally published at supernovaic.blogspot.com

1 1 1

How to connect to EFS via CloudShell

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:

  1. Create an EC2 instance with any Linux.
  2. Create a Key.
  3. Launch it.
  4. Create a Bucket in S3.
  5. Upload the Key.
  6. Open AWS CloudShell.
  7. Download the Key: aws s3 cp s3://MY_BUCKET/MY_KEY.pem .
  8. Give the right permissions to the Key: chmod 400 "MY_KEY.pem"
  9. Get your configuration from the Connect section in your EC2 instance.
  10. Connect to your EC2 instance via SSH: ssh -i "MY_KEY.pem" ec2-user@ec2MY_CONFIGURATOIN.MY_REGION.compute.amazonaws.com
  11. Install the Amazon EFS Client: sudo yum install -y amazon-efs-utils
  12. Create a folder called efssudo mkdir efs.
  13. 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.

Follow me on:

Personal LinkedIn YouTube Instagram Cyber Prophets Sharing Your Stories
Personal LinkedIn YouTube Instagram RedCircle Podcast RedCircle Podcast

sponsor me

AWS Q Developer image

Build your favorite retro game with Amazon Q Developer CLI in the Challenge & win a T-shirt!

Feeling nostalgic? Build Games Challenge is your chance to recreate your favorite retro arcade style game using Amazon Q Developer’s agentic coding experience in the command line interface, Q Developer CLI.

Participate Now

Top comments (0)

Warp.dev image

Warp is the #1 coding agent.

Warp outperforms every other coding agent on the market, and gives you full control over which model you use. Get started now for free, or upgrade and unlock 2.5x AI credits on Warp's paid plans.

Download Warp

👋 Kindness is contagious

Delve into this thought-provoking piece, celebrated by the DEV Community. Coders from every walk are invited to share their insights and strengthen our collective intelligence.

A heartfelt “thank you” can transform someone’s day—leave yours in the comments!

On DEV, knowledge sharing paves our journey and forges strong connections. Found this helpful? A simple thanks to the author means so much.

Get Started