Many of our customers have adopted DevOps for faster and reliable software delivery. Applying software engineering best practices such as revision control and continuous delivery to your infrastructure is essential for adopting DevOps.
In this session, find out how AWS CloudFormation and the associated AWS tools enable DevOps by allowing you to treat infrastructure as code and applying those software engineering best practices to your infrastructure.
Speakers:
Steven Bryen, AWS Solutions Architect
Bruce Jackson, Chief Technology Officer, Myriad Group
Rajpal Singh Wilkhu,Principal Engineer, Just Eat
2. You are on-board …
needs to experiment, innovate, reduce
risk
Business
of services and applications
Continuous
Delivery
culture, automation, measurement,
sharing
DevOps
infrastructure-as-code
Cloud
3. AWS CloudFormation
• Create templates of the infrastructure and
applications you want to run on AWS
• Have the CloudFormation service
automatically provision the required AWS
resources and their relationships from the
templates
• Easily version control, replicate or update
the infrastructure and applications using
the templates
• Integrates with other development, CI/CD,
and management tools.
4. Create template –
Example web application
security group
Auto Scaling group
EC2
instance
Elastic Load
Balancing
DB Service
Inventory Service
Recommendations
Service
ElastiCache
memcached cluster
Software pkgs,
config, & dataCloudWatch
alarms
6. Create template – Parameters
Auto Scaling group
EC2
instance
Recommendation
s Service
Inventory
Service
Customer DB
Service
Info to Customize
Stack at
Creation.
Examples:
Instance Type,
App Pkg Version
"Parameters"
:
{
"CustomerDBServiceEndPoint"
:
{
"Description"
:
"URL
of
the
Customer
DB
Service",
"Type"
:
"String"
},
"CustomerDBServiceKey"
:
{
"Description"
:
"API
key
for
the
Customer
DB
Service",
"Type"
:
"String",
"NoEcho"
:
"true"
},
"InstanceType"
:
{
"Description"
:
"WebServer
EC2
instance
type",
"Type"
:
"String",
"Default"
:
"m3.medium",
"AllowedValues"
:
["m3.medium","m3.large","m3.xlarge"],
"ConstraintDescription"
:
"Must
be
a
valid
instance
type"
CloudFormation
Template
7. Create template – Outputs
Elastic Load
Balancing
"Resources"
:
{
"LoadBalancer"
:
{},
...
},
"Outputs"
:
{
"WebsiteDNSName"
:
{
"Description"
:
"The
DNS
name
of
the
website",
"Value"
:
{
"Fn::GetAtt"
:
[
"LoadBalancer",
"DNSName"
]
}
}
}
CloudFormation
Template
15. Extend with Custom Resources
security group
Auto Scaling group
EC2
instance
Elastic Load
Balancing
ElastiCache
memcached cluster
Software pkgs,
config, & dataCloudWatch
alarms
Web Analytics
Service
AWS
CloudFormation
Provision
AWS Resources
"Resources"
:
{
"WebAnalyticsTrackingID"
:
{
"Type"
:
"Custom::WebAnalyticsService::TrackingID",
"Properties"
:
{
"ServiceToken"
:
"arn:aws:sns:...",
"Target"
:
{"Fn::GetAtt"
:
["LoadBalancer",
"DNSName"]},
"Plan"
:
"Gold"
}
},
...
“Success” + Metadata
“Create, Update, Rollback, or Delete”
+ Metadata
16. Lambda-powered custom resources
security group
Auto Scaling group
EC2
instance
Elastic Load
Balancing
ElastiCache
memcached cluster
Software pkgs,
config, & dataCloudWatch
alarms
// Implement Custom Logic Here
Lookup an AMI ID
Lookup VPC ID and Subnet ID
Reverse an IP Address
29. CloudFormation in a CI/CD Pipeline
AWS
CloudFormation
Issue
Tracker
App
Developers
DevOps
Engineers,
Infrastructure
Developers,
Systems
Engineers
Dev
Env
Code
Repo
App
Pkgs,
CloudFormation
Templates,
Etc.
CI
Server
Test
Staging
Prod
Code
Review
"Infra-‐as-‐Code"
App
Code
&
Templates
32. JUST EAT Platform
• High volume e-commerce platform
• 45-60 minutes cycle
• Real time message delivery and confirmation network
• Hardware in 22,500 restaurants in the UK, 40,800 worldwide
• Peak traffic is 10,000% of normal daytime traffic
• 3 cities
• Over 130 releases a month
• Primarily Windows
33. Building reliable and high quality software
• Test-Driven Development, Continuous Deployment and
Immutable Infrastructure
• Every part of the infrastructure replaced several times a day
• Incentive to continuously speed up deployment process
34. Deploying components
• Platform decomposed into components
• Each component defined by single AWS Cloudformation
template
• Single Build Artifact
• Instances boot and bootstrap themselves from
• pre-baked AMI
• Content in S3 based on Cloudformation::Init metadata
35. Pre-baked AMI vs Dynamic config
• System dependencies (eg OS
features, .NET, ruby, gems, etc)
• Static configurations
• Continuous Deployment (latest code)
• Environment specific configuration
• Automation to deploy feature
Increasing Boot time
• Unzip package
• Install and configure dependencies
• Execute deployment script(s)
• Warm up feature
• Tagged by deployment scripts
• Baked via CI pipeline
• Tested and tagged
Pre-baked AMI CloudFormation::Init
36. Cloudformation template generation
• Single json from multiple yaml and erb files
• Similar to HTML templating engines
• Organized by component
• Convention over configuration
"<%= @feature_name %>_pre_deploy": {
"commands": {
<%
cmd_prefix = 250
services_to_disable = %w(aelookupsvc bits scdeviceenum trustedinstaller wuauserv)
services_to_disable.each do |service_name|
%>
"<%= cmd_prefix %>_<%= @feature_name %>_stop_<%= service_name
%>_service_because_unnecessary": {
"waitAfterCompletion": "0",
"command": "powershell -noninteractive -noprofile -command "& { stop-service -
Name <%= service_name %> -verbose }"",
---
:feature_config:
:ami_id: ami-c99544ef
:elb: true
:use_logging_client: true
:elb_dns: true
:parameters:
:ElbTarget: "HTTP:80/status"
:AsgDesiredSizeDuringPeakTime: 10
:InstanceType: c4.xlarge
Example yaml: Example json.erb template:
{
Master
37. Immutable infrastructure - Cloudformation
Engineers
configs in yaml,
template extensions in
json.erb + master
Tests in QA environment
Engineers
Component code
Continuous Integration Server
(TeamCity Agent Cloud)
Build & Test
Pipeline
Artifact
JustDeploy
Production/QA
EC2 Web/worker roles
Route 53
Rooms
Artifact
Git Git
38. Immutable infrastructure - Baking AMIs
Engineers
AMI Bakery
Continuous Integration Server
(TeamCity Agenet Cloud)
EC2 base image
configurations and
resources
Shared AMI
Latest Amazon
OS image
Git
Automated
Tests
config.yaml
updated
39. Future
• Automatically select last tested AMI image
• Use lambda to trigger AMI builds based on AMI release
notifications via SNS
• Failover to secondary region
• Publish more tools as OSS
– https://github.com/justeat
42. From IMPS to msngr
database
app server
web server web server web server
...
x16
• Move from a
mid-2000 carrier
platform to web scale
• …with 38M users on
16 stacks
• …in 6 months
• …with a team of 4
43. Basic foundations of our approach
Rules
• OSGi used for all
application stacks
• Make use of as much
managed infrastructure as
possible
• Avoid any environment
configuration
• Make deployment as
familiar as coding
Rationale
• Rapid creation of services
against interfaces
• We don’t have any devops
so outsource management
where possible
• No files/scripts that only one
person understands
• The team is made up of
developers
44. What did we do?
• Created utility libraries
that use code
annotations and AWS
tags for configuration
• Use Eclipse features
to define bundles to
deploy on systems
45. What did we do (2) ?
• Created Eclipse
tooling to manage
deployment & code/
feature checkout