Created
May 27, 2020 10:28
-
-
Save rolandihms/bf14bd65254bbf6cddb66150922675b5 to your computer and use it in GitHub Desktop.
AWS ECS MOunt EFS startup script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Content-Type: multipart/mixed; boundary="==BOUNDARY==" | |
| MIME-Version: 1.0 | |
| --==BOUNDARY== | |
| Content-Type: text/cloud-boothook; charset="us-ascii" | |
| # Mount /mnt/efs | |
| cloud-init-per instance add_efs_to_fstab echo -e 'fs-XXXXXXXX:/ /mnt/efs efs defaults,_netdev 0 0' >> /etc/fstab | |
| # Mkdir /etc/ecs | |
| cloud-init-per instance mkdir_ecs mkdir /etc/ecs | |
| # write ecs.config | |
| cloud-init-per instance write_ecs_config echo -e "ECS_CLUSTER=Test-Cluster" >> /etc/ecs/ecs.config | |
| --==BOUNDARY== | |
| Content-Type: text/x-shellscript; charset="us-ascii" | |
| #!/bin/bash | |
| yum update -y | |
| yum install -y amazon-efs-utils git | |
| amazon-linux-extras install -y ecs | |
| mkdir -p /mnt/efs | |
| if [[ ! $(mount | grep fs-XXXXXXXX) ]]; then | |
| mount -a | |
| fi | |
| # Start ecs service | |
| systemctl enable --now ecs & | |
| --==BOUNDARY==-- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment