Cheap and reproducible testing environments on AWS

Giorgio Sironi

If you are looking at these slides on your pc, there are speaker notes in the HTML

Giorgio Sironi (@giorgiosironi)

I work for eLife Sciences
Italy European Union
  • Software Engineer in Test (automates stuff for a living)
  • What do I do
    • Distributed systems
    • Automated complex tests, integrating many different projects
    • Continuous Delivery
    • Pasta and risotto

An unreadable diagram

Production environment

12x

End2end environment

12x

Ci environment

Breaking the bank

Objections

I have an objection

Objections

  • Containers
  • "Serverless"
  • Travis CI (and similar)
To the cloud!
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
A phoenix dies and rises from its ashes

Persistence

EC2 lifecycle

Lifecycle of an EC2 instance, showing start and stop commands and their transitions

Costs EC2 vs EBS

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

Starting

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 ip

Stopping

aws ec2 stop-instances --instance-ids i-1234567890
// poll for stopped state:
aws ec2 describe-instances --instance-ids i-1234567890
Lock system: Jenkins and Lockable resources plugin
Error:
InsufficientInstanceCapacity

There's more!

Conclusions

  • Know the pain points of your cloud architecture
  • Work to solve these problems leveraging its strengths
  • Optimize in the right place

Thanks!

I work for eLife Sciences

@giorgiosironi @eLife

g.sironi@elifesciences.org

We are hiring!

Image credits

https://peurdunoir.deviantart.com/art/Harry-Potter-and-the-Order-of-the-Phoenix-384799893 https://commons.wikimedia.org/wiki/File:Clock_face_one_hand.png