AWS Cloud Quest: EFS mount on EC2

đźš©issue: Web servers in different Availability Zones need to access the same file data.

Step 1. Create security groups for EFS

Create security groups for EFS → Allow web servers to access EFS

Security Group:Acts as a virtual fi…


This content originally appeared on DEV Community and was authored by JJ Chen

đźš©issue: Web servers in different Availability Zones need to access the same file data.

EFS mount on EC2

Step 1. Create security groups for EFS

Create security groups for EFS → Allow web servers to access EFS

  • Security Group:Acts as a virtual firewall, used to control inbound and outbound traffic for EC2 instances. Can be used within an existing VPC.
  1. In the lab, choose VPC of PetModelsWebServer.

  2. Set the NFS type in the Inbound Rule of the Security Group of EFS

  3. Choose the Security Group of PetModelsWebServer as source
    Only resources belonging to the Web server Security Group are allowed to access EFS

  • By selecting a security group as the incoming source, any EC2 instances linked to the security group you select will have NFS client access to the file system.

Step 2. Create an EFS

  1. Create File System on the EFS security group

  2. Set network access to allow mount Target
    - Az-1 to EFS security groups
    - Az-2 to EFS security groups
    - Az-3 to EFS security groups

  3. click Attach button to copy mount command

Step 3. EC2 mount NFS

Ok! Now, all environments are ready.
You will mount a /data folder on EC2.
The following are the command for mounting a NFS in Linux

sudo -i
# download aws efs utils
sudo yum install -y Amazon-efs-utils
# create folder
mkdir data
# paste from "Attach" button
sudo mount -t efs -o tls fs-id:/ data
cd data
# write text in file
sudo bash -c “cat >> efs-1-setup.log”
# cat -> output "efs-1-setup.log"

efs-1 mounted in site A

cat efs-1-setup.log

Step 4. Repeat Step 3. for each EC2

After setting, you can read and write files from other EC2s.
All changes will be synchronized with EFS.


This content originally appeared on DEV Community and was authored by JJ Chen


Print Share Comment Cite Upload Translate Updates
APA

JJ Chen | Sciencx (2024-07-24T16:44:04+00:00) AWS Cloud Quest: EFS mount on EC2. Retrieved from https://www.scien.cx/2024/07/24/aws-cloud-quest-efs-mount-on-ec2/

MLA
" » AWS Cloud Quest: EFS mount on EC2." JJ Chen | Sciencx - Wednesday July 24, 2024, https://www.scien.cx/2024/07/24/aws-cloud-quest-efs-mount-on-ec2/
HARVARD
JJ Chen | Sciencx Wednesday July 24, 2024 » AWS Cloud Quest: EFS mount on EC2., viewed ,<https://www.scien.cx/2024/07/24/aws-cloud-quest-efs-mount-on-ec2/>
VANCOUVER
JJ Chen | Sciencx - » AWS Cloud Quest: EFS mount on EC2. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/07/24/aws-cloud-quest-efs-mount-on-ec2/
CHICAGO
" » AWS Cloud Quest: EFS mount on EC2." JJ Chen | Sciencx - Accessed . https://www.scien.cx/2024/07/24/aws-cloud-quest-efs-mount-on-ec2/
IEEE
" » AWS Cloud Quest: EFS mount on EC2." JJ Chen | Sciencx [Online]. Available: https://www.scien.cx/2024/07/24/aws-cloud-quest-efs-mount-on-ec2/. [Accessed: ]
rf:citation
» AWS Cloud Quest: EFS mount on EC2 | JJ Chen | Sciencx | https://www.scien.cx/2024/07/24/aws-cloud-quest-efs-mount-on-ec2/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.