Skip to content

Utility for making Spot Instance root disk persistence behave like On Demand instances.

Notifications You must be signed in to change notification settings

SantoshSrinivas79/ec2-spotter

 
 

Repository files navigation

AWS Persistant Spot Intance

Forked from https://github.com/atramos/ec2-spotter

EC2 spot instances behave much like regular instances, but are cheaper. Normally, they can only be inited from an AMI image, not EBS volume, resetting any changes made along the way. This script enables you to continue with your Spot instance where you left off.

Refer to this medium post for information on how to set this up: https://medium.com/slavv/learning-machine-learning-on-the-cheap-persistent-aws-spot-instances-668e7294b6d8

Usage

$ ./ec2spotter-launch testing.conf
Launching instance type: m5.large
Spot request id: sir-defghijk

or

$ ./ec2spotter-launch testing.conf p3.2xlarge
Launching instance type: p3.2xlarge
Spot request id: sir-defghijk
# save ip address to xeon
aws ec2 describe-instances --instance-ids $instance_id --filter Name=instance-state-name,Values=running --query "Reservations[*].Instances[*].PublicIpAddress" --output=text | xargs -I{} echo {} | tr -d '\n' | xargs -d' ' -I _ echo '{"value": "_"}' | http PATCH https://xeon.santoshsrinivas.com/api/kvs/PJ4JS2xitWZ9DnsMo

ec2=$(http "https://xeon.santoshsrinivas.com/api/kvs/PJ4JS2xitWZ9DnsMo" | jq '.data.value')
ec2=$(echo $ec2 | tr -d '"')

echo $ec2

# Remember to [How to disable strict host key checking in ssh? - Ask Ubuntu](https://askubuntu.com/questions/87449/how-to-disable-strict-host-key-checking-in-ssh)

ssh -i ~/.ssh/aws-key-fast-ai.pem ubuntu@$ec2

About

Utility for making Spot Instance root disk persistence behave like On Demand instances.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 100.0%