Created
March 3, 2019 00:48
-
-
Save dvejmz/e314d479ee345774596a925e9165e2fa to your computer and use it in GitHub Desktop.
ECS instance with EIP auto-association and EBS volume mounting
This file contains 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
#!/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