customer sharing: icook - continuous deployment with aws
TRANSCRIPT
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Richard Lee, iCook 愛料理
2016/5/20
Continuous Deployment with AWS
From one server to clusters
iCook 愛料理
• Leading recipe sharing platform in Taiwan
• People share & view recipes from web / native apps
• 5M+ monthly visitors
• 3M+ app downloads
Business Challenges
Every business needs monetization
Our core businesses:
• VIP premium service
• User insights for brand customers
• E-commerce of selected items
Several Small Apps
Beyond our main site, we have several related sites,
prototypes and internal tools.
• iCook Market
• iCook TV
• iCook Blog
• Internal dashboards & BI tools
Why is this a trouble?
We had limited ops, and most of us are developers.
But we want to make it easy and fast to deploy as well.
Common Use Case
To deploy a new app to instances, we need:
1. Set up Linux environment
2. Install required runtime (Ruby / Node.js)
3. Deploy apps via Git
4. Set up monitoring & permissions and many others
Why AWS?
AWS Beyond EC2
EC2 + AMI Elastic Beanstalk OpsWorks ECS
Building AMI using Packer
There’re several ways to build AMI. We use Packer
1. Dev, test & production using same tool
2. Integration for different provisioning tools (e.g. Chef)
3. Simple CLI to make it run on your CI system
Sample Packer config for EC2
{
"variables": { "aws_access_key": "", "aws_secret_key": "” },
"builders": [{
"type": "amazon-ebs",
"access_key": "{{user `aws_access_key`}}",
"secret_key": "{{user `aws_secret_key`}}",
"region": "us-east-1",
"source_ami": "ami-fce3c696",
"instance_type": "t2.micro",
"ssh_username": "ubuntu",
"ami_name": "packer-example {{timestamp}}”
}],
"provisioners": [{
"type": "shell",
"inline": [ "sleep 30", "sudo apt-get update", "sudo apt-get install -y redis-server" ]
}]
}
Pros
• Simple and straight forward
• Tons of resources online
Pros & Cons of AMI
Cons
• Slow
• Not quite suitable for app
deployment
Elastic Beanstalk
AWS’s PaaS solution with several common app stacks.
1. Deployment from Git
2. Easy UIs for tweaking everything
3. However, do use ECS for Docker
Pros
• Prebuilt stacks
• Integrated deployment system
Pros & Cons of Elastic Beanstalk
Cons
• Hard to customize
• e.g. Want to use latest runtime
or OS version
• Limited options
OpsWorks
Hosted Chef integration for AWS
1. Infrastructure as code
2. Different scaling workflow
3. Hard to start but really powerful
Pros
• Good community
• e.g. Many official recipes
• Scaling is easier than ASG
• Customizable but with some
prebuilt stacks
Pros & Cons of OpsWorks
Cons
• Provisioning is slow
• OpsWorks server failures
• Invest time to learn & build
own cookbooks
ECS
AWS’s answer to container revolution.
1. Based on Docker
2. ECS as a container scheduler & sets of APIs
Pros
• Prebuilt Docker host AMIs
• Easily add instances to cluster
• Rolling updates
Pros & Cons of ECS
Cons
• Invest time to learn & build
Docker images
• No automatically task scaling
• Random bugs in ecs-agent
How to choose?
1. Use Elastic Beanstalk if you just want to set it up fast
2. Use custom AMI otherwise
3. If you know or want to learn Chef, use OpsWorks
4. If you use Docker, use ECS
You can use combo, our stack: AMI + OpsWorks + ECS
Learning resources beyond docs & guides
1. AWS official blogs (I love Ruby / Compute blogs)
2. Jeff Barr or other AWS staffs’ Twitter or posts
3. GitHub’s repos (aws / awslabs)
4. AWS account managers & official partners