Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
build your docker-machine on AWS EC2 instance
machine=$(python -c "import uuid;print(uuid.uuid4())")
# NEEDED: AmazonEC2FullAccess, AmazonEC2SpotFleetRole
AWS_ACCESS_KEY_ID=$(aws configure get aws_access_key_id)
AWS_DEFAULT_REGION=$(aws configure get region)
AWS_SECRET_ACCESS_KEY=$(aws configure get aws_secret_access_key)
VPC=$(aws ec2 describe-vpcs | jq -r '.Vpcs[0].VpcId')
echo "https://$"
docker-machine create --driver amazonec2 \
--amazonec2-region ${AWS_DEFAULT_REGION} \
--amazonec2-vpc-id ${VPC:-""} \
--amazonec2-request-spot-instance \
--amazonec2-block-duration-minutes 60 \
--amazonec2-instance-type r4.large \
--amazonec2-access-key ${AWS_ACCESS_KEY_ID} \
--amazonec2-secret-key ${AWS_SECRET_ACCESS_KEY} \
Copy link

minhoryang commented Jul 28, 2017

eval $(docker-machine env $machine)
docker run -t -i -v /opt:$(pwd) buildpack-deps:xenial

Copy link

minhoryang commented Aug 10, 2017

aws ec2 describe-spot-price-history --start-time $(python -c "from datetime import *;print((") --product-description Linux/UNIX --instance-types r4.large c4.large i3.large r3.large m4.large

Copy link

minhoryang commented Aug 12, 2017

aws ec2 describe-instances | jq '.Reservations[].Instances[] | {PublicDnsName, State, LaunchTime}'

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