Skip to content

Instantly share code, notes, and snippets.

@ricardoribas
Last active June 15, 2020 18:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardoribas/1ba8fca01abd4bc5ae6d4be61bc7d668 to your computer and use it in GitHub Desktop.
Save ricardoribas/1ba8fca01abd4bc5ae6d4be61bc7d668 to your computer and use it in GitHub Desktop.
ECS task definition to mount an EFS driver
taskDefinition:
DependsOn:
- ...otherDependencies
- efsVolume
Properties:
ContainerDefinitions:
- Image: jenkins/jenkins:lts
Memory: "2048"
Name: jenkins
MountPoints:
- SourceVolume: jenkinsVolume
ContainerPath: /var/jenkins_home
PortMappings:
- ContainerPort: 8080
HostPort: 0
Protocol: tcp
Volumes:
- Name: jenkinsVolume
DockerVolumeConfiguration:
Autoprovision: true
Scope: shared
Driver: local
DriverOpts:
type: nfs
device: !Sub "${efsVolume}.efs.${AWS::Region}.amazonaws.com:/"
o: !Sub "addr=${efsVolume}.efs.${AWS::Region}.amazonaws.com,nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2"
TaskRoleArn:
Ref: taskDefinitionRole
Type: AWS::ECS::TaskDefinition
efsVolume:
DependsOn:
- vpc
Properties:
FileSystemTags:
- Key: "Name"
Value: "jenkins-file-system"
Type: AWS::EFS::FileSystem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment