Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.