Skip to content

Instantly share code, notes, and snippets.

@frimik
Last active April 9, 2020 16:12
Show Gist options
  • Save frimik/24aac829476b2b7cb72c3cc4436697aa to your computer and use it in GitHub Desktop.
Save frimik/24aac829476b2b7cb72c3cc4436697aa to your computer and use it in GitHub Desktop.
Install CloudStor plugin on Amazon ECS Optimized AMI Instance
#!/bin/bash
set -ex
if [ $# -ne 2 ]; then
echo "Usage: $0 EFS_ID_REGULAR EFS_ID_MAXIO"
exit 1
fi
EFS_ID_REGULAR=$1
EFS_ID_MAXIO=$2
AWS_REGION="$(cat /etc/yum/vars/awsregion)"
DOCKER_VERSION=$(docker version | awk '/^Server/{f=1} $1 ~ /Version:/ {if(f) {print $2}}')
CLOUDSTOR_REPO="docker4x/cloudstor"
CLOUDSTOR_TAG="${DOCKER_VERSION}-aws1"
docker plugin install \
--alias cloudstor:aws \
--grant-all-permissions\
${CLOUDSTOR_REPO}:${CLOUDSTOR_TAG} \
CLOUD_PLATFORM=AWS EFS_ID_REGULAR=${EFS_ID_REGULAR} EFS_ID_MAXIO=${EFS_ID_MAXIO} AWS_REGION=${AWS_REGION} EFS_SUPPORTED=1 DEBUG=1
@frimik
Copy link
Author

frimik commented Dec 17, 2019

service docker restart might be needed afterwards... not entirely sure though.

@frimik
Copy link
Author

frimik commented Dec 17, 2019

Useful tools for EFS, but not necessary for this purpose is in the package amazon-efs-utils. It contains a watchdog agent though that may be useful.

@frimik
Copy link
Author

frimik commented Apr 9, 2020

https://spot.io/blog/ecs-persistent-storage-docker-plugins/

Key Value
size The size of the volume.
backing Use “shared” for EFS volumes, “relocatable” for EBS volumes.
ebstype If you use EBS volumes, you can specify gp2, io1, st1, sc1
iops Required if ebstype specified is io1, which enables provisioned IOPS. Needs to be in the appropriate range as required by EBS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment