Skip to content

Instantly share code, notes, and snippets.

@dvejmz
Created March 3, 2019 00:48
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 dvejmz/e314d479ee345774596a925e9165e2fa to your computer and use it in GitHub Desktop.
Save dvejmz/e314d479ee345774596a925e9165e2fa to your computer and use it in GitHub Desktop.
ECS instance with EIP auto-association and EBS volume mounting
#!/bin/bash
echo ECS_CLUSTER=openvpn >> /etc/ecs/ecs.config;echo ECS_BACKEND_HOST= >> /etc/ecs/ecs.config;
mkdir -p /ecs-data/openvpn-data
echo "/dev/sdf /ecs-data/openvpn-data ext4 defaults 0 2" >> /etc/fstab
mount -a
yum install -y python36
curl -O https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
export PATH=/usr/local/bin:$PATH
pip install awscli
instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
aws --region=eu-west-1 ec2 associate-address --instance-id $instance_id --allocation-id eipalloc-<id>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment