What is Amazon Elastic File System?
- Amazon Elastic File System (Amazon EFS) provides a simple, serverless, set-and-forget elastic file system for use with AWS Cloud services and on-premises resources.
- It is built to scale on-demand to petabytes without disrupting applications, growing and shrinking automatically as you add and remove files, eliminating the need to provision and manage capacity to accommodate growth.
- Amazon EFS has a simple web services interface that allows you to create and configure file systems quickly and easily.
- The service manages all the file storage infrastructure for you, meaning that you can avoid the complexity of deploying, patching, and maintaining complex file system configurations.
- Amazon EFS supports the Network File System version 4 (NFSv4.1 and NFSv4.0) protocol, so the applications and tools that you use today work seamlessly with Amazon EFS.
Creates an Elastic File System with 3 Mounts
Prerequisites
- VPC
- 3 Subnets
Create Details
- EFS Filesystem
- 3 Mount Targets
Steps to create resources in cloudformation
Search Cloudformation in aws console

Create a new Stack
A stack is a collection of AWS resources that you can manage as a single unit. All the resources in a stack are defined by the stack’s AWS CloudFormation template

Save the below code in .yaml format & then upload a file after that click next.
AWSTemplateFormatVersion: '2010-09-09'
Description: Create Elastic File System v20161029-1200
Parameters:
# Ownership
Owner:
Type: String
Default: FirstName LastName
Project:
Type: String
Default: EFS Mount
DeleteAfter:
Type: String
Default: 00/00/201x
# Network
VPC:
Type: AWS::EC2::VPC::Id
Subnet1:
Type: AWS::EC2::Subnet::Id
Subnet2:
Type: AWS::EC2::Subnet::Id
Subnet3:
Type: AWS::EC2::Subnet::Id
# EFS
PerformanceMode:
Type: String
Default: generalPurpose
AllowedValues:
- generalPurpose
- maxIO
Resources:
FileSystem:
Type: AWS::EFS::FileSystem
Properties:
FileSystemTags:
- Key: Name
Value: !Ref AWS::StackName
- Key: Owner
Value: !Ref Owner
- Key: Project
Value: !Ref Project
- Key: DeleteAfter
Value: !Ref DeleteAfter
PerformanceMode: !Ref PerformanceMode
MountTarget1:
Type: AWS::EFS::MountTarget
DependsOn:
- FileSystem
- EfsSecurityGroup
Properties:
FileSystemId: !Ref FileSystem
SubnetId: !Ref Subnet1
SecurityGroups:
- !Ref EfsSecurityGroup
MountTarget2:
Type: AWS::EFS::MountTarget
DependsOn:
- FileSystem
- EfsSecurityGroup
Properties:
FileSystemId: !Ref FileSystem
SubnetId: !Ref Subnet2
SecurityGroups:
- !Ref EfsSecurityGroup
MountTarget3:
Type: AWS::EFS::MountTarget
DependsOn:
- FileSystem
- EfsSecurityGroup
Properties:
FileSystemId: !Ref FileSystem
SubnetId: !Ref Subnet3
SecurityGroups:
- !Ref EfsSecurityGroup
EfsSecurityGroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Instance to EFS Mount Access
VpcId: !Ref VPC
Tags:
- Key: Name
Value: !Ref AWS::StackName
- Key: Owner
Value: !Ref Owner
- Key: Project
Value: !Ref Project
- Key: DeleteAfter
Value: !Ref DeleteAfter
SecurityGroupIngress:
Type: AWS::EC2::SecurityGroupIngress
DependsOn: EfsSecurityGroup
Properties:
GroupId: !Ref EfsSecurityGroup
IpProtocol: "-1"
SourceSecurityGroupId: !Ref EfsSecurityGroup
Outputs:
Owner:
Description: Team or Individual that Owns this Formation.
Value: !Ref Owner
Project:
Description: The project name
Value: !Ref Project
VPC:
Description: Created VPC
Value: !Ref VPC
Subnet1:
Description: Subnet 1
Value: !Ref Subnet1
Subnet2:
Description: Subnet 2
Value: !Ref Subnet2
Subnet3:
Description: Subnet 3
Value: !Ref Subnet3
FileSystem:
Description: FileSystem
Value: !Ref FileSystem
PerformanceMode:
Description: PerformanceMode
Value: !Ref PerformanceMode
MountTarget1:
Description: MountTarget 1
Value: !Ref MountTarget1
MountTarget2:
Description: MountTarget 2
Value: !Ref MountTarget1
MountTarget3:
Description: MountTarget 3
Value: !Ref MountTarget1
# MountTargetDns1:
# Description: MountTarget 1
# Value: !GetAtt MountTarget1.DNSName
# MountTargetDns2:
# Description: MountTarget 2
# Value: !GetAtt MountTarget1.DNSName
# MountTargetDns3:
# Description: MountTarget 3
# Value: !GetAtt MountTarget1.DNSName
Metadata:
AWS::CloudFormation::Interface:
ParameterGroups:
- Label:
default: Ownership
Parameters:
- Owner
- Project
- DeleteAfter
- Label:
default: Network Configuration
Parameters:
- VPC
- Subnet1
- Subnet2
- Subnet3
- Label:
default: EFS Configuration
Parameters:
- PerformanceMode
ParameterLabels:
Owner:
default: Team or Individual Owner
DeleteAfter:
default: Delete After Date
VPC:
default: VPC ID
Subnet1:
default: Subnet 1
Subnet2:
default: Subnet 2
Subnet3:
default: Subnet 3
PerformanceMode:
default: EFS Performance Mode

Give the Name of the stack and define the parameter.

Select Vpc and subnets & then click on next/

Configure the Stack option, provide tags in the key-value pair and then click next

Now Review your stack and then click Create Stack

Now creating a stack

Now your Stack is successfully created

Now you successfully created Aws Efs.
If you don’t know about cloudformation , and how to use that then please read this below article first.
https://techworldwithvijaypatel.medium.com/create-aws-security-hub-sagemaker-pipeline-resource-using-cloudformation-ff2a99fd6d00
So I hope this was very helpful and if you have any doubts or any questions you can write them down in the comment section below and I will try to answer you as soon as I can.
▬▬▬▬▬▬ Connect with me ▬▬▬▬▬▬
Youtube Subscription ► https://bit.ly/2LENtS1
Facebook Page: ► https://www.facebook.com/EasyAWSLearn/
Medium: ► https://techworldwithvijaypatel.mediu...
Dev: ► https://dev.to/easyawslearn
Telegram Channel: ► https://t.me/devtul
No comments:
Post a Comment