Skip to content

Instantly share code, notes, and snippets.

@rolandihms
Created May 27, 2020 10:28
Show Gist options
  • Select an option

  • Save rolandihms/bf14bd65254bbf6cddb66150922675b5 to your computer and use it in GitHub Desktop.

Select an option

Save rolandihms/bf14bd65254bbf6cddb66150922675b5 to your computer and use it in GitHub Desktop.
AWS ECS MOunt EFS startup script
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