Server-based resources | Shared resources |
Web servers, databases | Queues, CDNs, ... |
EC2, RDS, ElastiCache | S3, SQS, CloudFront |
Pay by the hour | Pay per use |
Optimize | Don't worry about it |
t2.small | $0.74/day |
t2.medium | $1.46/day |
t2.large | $2.88/day |
t2.xlarge | $5.86/day |
c4.4xlarge | $23.93/day |
SSD gp2, 10 GB | $1.20/month |
aws ec2 start-instances --instance-ids i-1234567890 // poll for started state: aws ec2 describe-instances --instance-id i-1234567890 // poll with ssh that you can connect // (optionally) poll for some smoke test to pass // update DNS with new public ipStopping an instance is easy, restarting it is more difficult. Actually I do this with Python, but I show it with the cli since it's universal.
aws ec2 stop-instances --instance-ids i-1234567890 // poll for stopped state: aws ec2 describe-instances --instance-ids i-1234567890You stop paying as soon as the status changes from `running` to `stopping`. More than stopping, the problem is knowing when to stop. Periodical build that checks whether instances are between X:55 and X:60 minutes from start, leveraging the full hour that has been paid and stopping before they go into the next Now changing that... it's billed minute by minute, so will probably shrink to anything more than 0:15? 0:30? So that if there are many builds in sequence they have the time to run.
Error: InsufficientInstanceCapacity