SlideShare ist ein Scribd-Unternehmen logo
1 von 59
Moving to Containers:
Building Using Docker and Amazon ECS
U t t a r a S r i d h a r , S o f t w a r e D e v e l o p m e n t E n g i n e e r , A W S
T h i l i n a G u n a s i n g h e , S e n i o r D i r e c t o r , M c D o n a l d ’ s C o r p o r a t i o n
M a n j e e v a S i l v a , T e c h n i c a l A r c h i t e c t , M c D o n a l d ’ s C o r p o r a t i o n
C O N 3 1 0
What to Expect from the Session
• Review software development lifecycle
• Why move to containers
• Setup image repository with Amazon ECR
• Deploy to Amazon ECS
• Log, monitor and scale containers
• Automate using CI/CD
• Deep Dive McDonald’s home delivery platform
Software Development Lifecycle
Code
repository
Build
environment
Test
environment
Deployment
environment
Source code
Artifact
repository
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
* Portable
* Flexible
* Fast
* Efficient
Why Move to Containers?
Server
Guest OS
Bins/Libs Bins/Libs
App2App1
Containerize Code
Code
repository
Build
environment
Test
environment
Deployment
environment
Source code
Artifact
repository
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
FROM ubuntu:12.04
# Install dependencies: apache
RUN apt-get update -y
RUN apt-get install -y apache2
# write hello world message
RUN echo "Hello World!" > /var/www/index.html
# Configure apache
RUN a2enmod rewrite
RUN chown -R www-data:www-data /var/www
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
EXPOSE 80
CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"]
Dockerfile
Dockerfile Best Practices
• Reduce build image sizes and number of layers
• Only bring what you need at runtime
• Always tag each build with any of these schemes:
• Semantic version (i.e. “1.3.2-9”)
• Git SHA (i.e. “aebcbca”)
• Build Number (i.e., “127”)
• Build Id (i.e. “511d5e51-b415-4cb2-b229-b3c8a46b7a2f”)
• For multi-region, push to all regions, pull from same region
Docker Build
Code
repository
Build
environment
Test
environment
Deployment
environment
Source code
Artifact
repository
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Packaged
Application Code
Reproducible Immutable Portable
Docker Images
Docker Build (Using Jenkins)
Amazon ECR: Container Image Registry
Code
repository
Build
environment
Test
environment
Deployment
environment
Source code
Artifact
repository
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Amazon Elastic Container Registry
Fully Managed
* Tight Integration with Amazon ECS
* Integration with Docker Toolset
* Management Console and AWS CLI
Highly Available
* Amazon S3 backed
* Regional endpoints
Secure
* IAM Resource-based Policies
* AWS CloudTrail Audit Logs
* Images encrypted at transit
and at rest
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
# Create a repository called hello-world
> aws ecr create-repository --repository-name hello-world
# Build or tag an image
> docker build -t hello-world .
> docker tag hello-world aws_account_id.dkr.ecr.us-east-1.amazonaws.com/hello-world
# Authenticate Docker to your Amazon ECR registry
> aws ecr get-login
> docker login -u AWS -p <password> -e none aws_account_id.dkr.ecr.us-east-
1.amazonaws.com
# You can skip the `docker login` step if you have amazon-ecr-credential-helper setup.
# Push an image to your repository
> docker push aws_account_id.dkr.ecr.us-east-1.amazonaws.com/hello-world
Amazon ECR Setup
Test
Code
repository
Build
environment
Test
environment
Deployment
environment
Source code
Artifact
repository
Running Test
• Inside the container:
Usual Docker commands available within your test environment
Run the container with the commands necessary to execute your tests, e.g.:
docker run web bundle exec rake test
• Against the container:
Start a container running in detached mode with an exposed port serving
your app
Run browser tests or other black box tests against the container, e.g.
headless browser tests
Deploy to Amazon ECS
Code
repository
Build
environment
Test
environment
Deployment
environment
Source code
Artifact
repository
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Easily manage
clusters of any
size
Flexible
Container
Placement
Integrated with
AWS services
Extensible
Amazon Elastic Container Service
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
• Cluster
• Container Instances
• Task Definition
• Task
• Service
Amazon ECS Core Concepts
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"family":"hello-world",
"containerDefinitions":[
{
"name":"hello-world",
"image":"aws_account_id.dkr.ecr.us-east-
1.amazonaws.com/hello-world",
"cpu":10,
"memory":500,
"portMappings":[
{
"containerPort":80,
"hostPort":80
}
],
"entryPoint":[
"/usr/sbin/apache2",
"-D",
"FOREGROUND"
],
"essential":true
}
],
"volumes": []
}
Amazon ECS Task Definition
Container Definitions
Volume Definitions
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"serviceName": "ecs-hello-world-elb",
"taskDefinition": "hello-world",
"loadBalancers": [
{
"loadBalancerName": "EC2Contai-
EcsElast-A0B1C2D3E4”,
"containerName": "hello-world",
"containerPort": 80
}
],
"desiredCount": 10,
"role": "ecsServiceRole"
}
Amazon ECS Service
* Good for long-running
applications
* Load Balance traffic across
containers
* Automatically recover unhealthy
containers
* Discover services
Amazon ECS Service
• Deployment
• Logging
• Monitoring
• Scaling
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"serviceName": "ecs-hello-world-elb",
"taskDefinition": "hello-world",
"deploymentConfiguration": {
"maximumPercent": 100,
"minimumHealthyPercent": 50
},
"loadBalancers": [
{
"loadBalancerName": "EC2Contai-EcsElast-A0B1C2D3E4”,
"containerName": "hello-world",
"containerPort": 80
}
],
"desiredCount": 10,
"role": "ecsServiceRole"
}
Rolling Deployments
Rolling Deployments
minimumHealthyPercent = 50%, maximumPercent =100%
Rolling Deployments
minimumHealthyPercent = 100%, maximumPercent = 200%
Amazon ECS Service
• Deployment
• Logging
• Monitoring
• Scaling
Logging with Amazon CloudWatch Logs
• Supported Docker Logging Drivers
• json-file, syslog, journald, gelf, fluentd, awslogs
• stdout/stderr outputs are automatically sent by the driver
• awslogs sends logs to Amazon CloudWatch Logs
• Log group for a specific service
• Log stream for each container
• Amazon CloudWatch Logs => Other services
• Search, Filter, Export to Amazon S3, Send to Amazon Kinesis, AWS
Lambda, Amazon Elasticsearch Service
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
{
"family":"hello-world",
"containerDefinitions":[
{
"logConfiguration":{
"logDriver":"awslogs",
"options":{
"awslogs-group":"awslogs-test",
"awslogs-region":"us-east-1",
"awslogs-stream-prefix":”hello-world"
}
},
"name":"hello-world",
"image":"aws_account_id.dkr.ecr.us-east-1.amazonaws.com/hello-world",
"cpu":10,
"memory":500,
...
Configuring Logging in Task Definition
Amazon ECS Service
• Deployment
• Logging
• Monitoring
• Scaling
Monitoring with Amazon CloudWatch
• Metric data sent to CloudWatch in 1-minute periods and recorded for a
period of two weeks
• Available metrics:
• CPUReservation
• MemoryReservation
• CPUUtilization
• MemoryUtilization
Monitoring with Amazon CloudWatch
Amazon ECS Service
• Deployment
• Logging
• Monitoring
• Scaling
Auto Scaling Your Amazon ECS Resources
Auto Scaling Your Amazon ECS Services
© 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Create Amazon CloudWatch
alarm on a metric, e.g.
MemoryReservation
Configure scaling policies to
increase and decrease the
size of your cluster
Auto Scaling Your Amazon ECS Cluster
Automate Using CI/CD
Code
repository
Build
environment
Test
environment
Deployment
environment
Source code
Artifact
repository
Continuous Delivery to Amazon ECS with Jenkins
4. Push image
to Amazon ECR
2. Build image
from sources
3. Run test on image
1. Code push
triggers build
5. Update service
6. Pull image
Summary
Code
repository
Build
environment
Test
environment
Deployment
environment
Source code
Artifact
repository
Dockerfiles -AWS CodeCommit
-Github
-AWS CodeBuild
-Jenkins
-Amazon ECR
-Dockerhub
-Amazon ECS
-Jenkins
-Amazon ECS
-Jenkins
-Shippable
-Codeship
-wercker
-Solano Labs
CI/CD Partners
AWS re:INVENT
McDonald’s – Moving to Containers
T h i l i n a G u n a s i n g h e a n d M a n j e e v a S i l v a
C O N 3 1 0
Contents
• About McDonald’s and Digital Acceleration
• McDonald's Home Delivery Platform: Business Problem
and Architecture
• Under the Covers: How we used ECS for Scale, Speed,
Security, DevOps and Monitoring
• Final Thoughts and Takeaways
About McDonald’s and Digital
Acceleration
WORLD’S LARGEST
RESTAURANT COMPANY
1.9M
PEOPLE
Working for
McDonald’s
& Franchisees
64M+
CUSTOMERS
Served Every Day
37K
RESTAURANTS
120
COUNTRIES
digital experience of
the future
delivery
VELOCITY ACCELERATORS
McDonald’s uses scale as a competitive advantage to surpass the rising expectations of
our customers across three growth initiatives.
Seamless, personalized engagement
with our customers when they are at
home, on-the-go, or in a restaurants.
Bringing McDonald’s directly to
customers.
Elevating the McDonald’s
restaurant experience.
McDonald’s Home Delivery Platform:
Business Problem and Architecture
Introducing Home Delivery
digital & delivery
Bringing McDonald’s to you
Critical Business Requirements
• Speed to market, quick turn around for features and functionality
from concept to production
• Scalability and reliability targets of, 250K-500K orders per hour
• Multi country support and integration with multiple 3rd party
food delivery partners
• Cost sensitivity, cost model based on low average check amounts
Home Delivery Architecture
Key Architecture Principles
• Microservices, with clean APIs, service models, isolation,
independent data models and deployability.
• Containers and orchestration, for handling massive scale,
reliability and speed to market requirements
• PaaS, based architecture model by leveraging AWS platform
components such as ECS, SQS, RDS and Elasticache
• Synchronous and event based, programming models based on
requirements
Under the Covers: Using Amazon ECS
for Scale, Speed, Security, DevOps
and Monitoring
Why Amazon ECS?
Speed to market
Scalability and reliability
Security
DevOps – CI / CD
Monitoring
Speed to Market
• 4 months from concept to production with 2 week dev iterations
• Polyglot tech stack ported to containers
• Existing .net code was refactored and complied with .net core
• Java was used where .net core is not supported
• Simplified Amazon ECS deployment model with easy integration to
AWS services
• Less time was spend on application tuning/testing to achieve the scale
and reliability requirements
• DevOps – Faster feedback loops on release iterations
• Scale Targets: Achieved the scale targets of 250k-500k orders per hour with
below ~100ms response times
• Autoscaling: Used Amazon ECS “out-of-box” resource based autoscaling
• Task Placement: Task placement strategies and constrains were used to fine-tune
and achieve container isolation with country / 3rd party scaling requirements
• Scalability and Reliability Requirements (By Service):
1. {Service 1} Contains synchronous APIs with intense scalability and reliability
requirements based on traffic burst patterns
2. {Service 2} Requires more batch mode processing. Work load optimization is
a critical requirement
3. Some instances of {Service 3} will need isolation from others
Scalability and Reliability
Task
Task
Task
Scalability and Reliability
{Service 1} Task Definition
"placementStrategy": [
{
"field": "attribute:ecs.availability-zone",
"type": "spread"
}
{Service 2} Task Definition
"placementStrategy": [
{
"field": "memory",
"type": "binpack"
}
]
{Service 3} Task Definition
"placementConstraints": [
{
"expression": "task:group == US",
"type": "memberOf"
}
]
ECS instances (EC2)
EC2 Auto
scaling policy
ECS Service
scaling policy
Tasks
Security
• Container security
• Container isolation through IAM policies and security groups
• Reduced container-to-container to communication (Reduce attack
footprint).
• ECS instance security
• Automated AMI factory  start with ECS optimized AMIs McD hardened
gold AMIs Project specific AMIs
• AMI factory pipeline listens to a SNS topic for obtaining updated AMIs
DevOps/CI&CD
Monitoring
• NewRelic agents configured to monitor the ECS instances, Containers and
AWS PaaS components
• ELK stack configured for service logging and analytics
Task
instance
ECS Instance
Log driver = syslog
Task
instanceTask
Instance
Major Technical Challenges
o “Out of memory error” due to containers not having access to
cgroup file systems to get memory limits
o Solution: Incorporated a new filesystem(lxcfs) to
virtualized cgroup and virtualized views of /proc files
o Docker containers are not honoring the ECS instance routing
rules
o Solution: Custom implementation of a Docker bridge
Final Thoughts
Final Thoughts and Key Takeaways
• A thought out microservice architecture is key for scalability, reliability, and
containerization.
• Massive scale achievable (north of 20k TPS under 100ms) in a controlled
manner using auto-scale policies and task placement strategies.
• Moving to containers simplified our development and deployment models
and in turn provided quicker dev/test iterations.
• ECS out of the box integration and deployment models further simplified our
DevOps pipeline.
THANK YOU!

Weitere ähnliche Inhalte

Was ist angesagt?

Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017Amazon Web Services
 
DEV323_Introduction to the AWS CLI
DEV323_Introduction to the AWS CLIDEV323_Introduction to the AWS CLI
DEV323_Introduction to the AWS CLIAmazon Web Services
 
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeCTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeAmazon Web Services
 
CON307_Building Effective Container Images
CON307_Building Effective Container ImagesCON307_Building Effective Container Images
CON307_Building Effective Container ImagesAmazon Web Services
 
State of the Union: Containers on AWS
State of the Union: Containers on AWSState of the Union: Containers on AWS
State of the Union: Containers on AWSAmazon Web Services
 
Elastic Kubernetes Services (EKS)
Elastic Kubernetes Services (EKS)Elastic Kubernetes Services (EKS)
Elastic Kubernetes Services (EKS)sriram_rajan
 
DAT340_Hands-On Journey for Migrating Oracle Databases to the Amazon Aurora P...
DAT340_Hands-On Journey for Migrating Oracle Databases to the Amazon Aurora P...DAT340_Hands-On Journey for Migrating Oracle Databases to the Amazon Aurora P...
DAT340_Hands-On Journey for Migrating Oracle Databases to the Amazon Aurora P...Amazon Web Services
 
NEW LAUNCH! Introducing AWS Fargate - CON214 - re:Invent 2017
NEW LAUNCH! Introducing AWS Fargate - CON214 - re:Invent 2017NEW LAUNCH! Introducing AWS Fargate - CON214 - re:Invent 2017
NEW LAUNCH! Introducing AWS Fargate - CON214 - re:Invent 2017Amazon Web Services
 
Building Global Serverless Backends
Building Global Serverless BackendsBuilding Global Serverless Backends
Building Global Serverless BackendsAmazon Web Services
 
AWS CLI: 2017 and Beyond - DEV307 - re:Invent 2017
AWS CLI: 2017 and Beyond - DEV307 - re:Invent 2017AWS CLI: 2017 and Beyond - DEV307 - re:Invent 2017
AWS CLI: 2017 and Beyond - DEV307 - re:Invent 2017Amazon Web Services
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural PatternsAmazon Web Services
 
Accelerating the Transition to Broadcast and OTT Infrastructure in the Cloud
Accelerating the Transition to Broadcast and OTT Infrastructure in the CloudAccelerating the Transition to Broadcast and OTT Infrastructure in the Cloud
Accelerating the Transition to Broadcast and OTT Infrastructure in the CloudAmazon Web Services
 
Advanced Container Management and Scheduling
Advanced Container Management and SchedulingAdvanced Container Management and Scheduling
Advanced Container Management and SchedulingAmazon Web Services
 
Architecting Container Infrastructure for Security and Compliance - CON406 - ...
Architecting Container Infrastructure for Security and Compliance - CON406 - ...Architecting Container Infrastructure for Security and Compliance - CON406 - ...
Architecting Container Infrastructure for Security and Compliance - CON406 - ...Amazon Web Services
 
Containers on AWS: What You Missed at re:Invent 2017 - AWS Online Tech Talks
Containers on AWS: What You Missed at re:Invent 2017 - AWS Online Tech TalksContainers on AWS: What You Missed at re:Invent 2017 - AWS Online Tech Talks
Containers on AWS: What You Missed at re:Invent 2017 - AWS Online Tech TalksAmazon Web Services
 

Was ist angesagt? (20)

Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
Container Networking Deep Dive with Amazon ECS - CON401 - re:Invent 2017
 
DEV323_Introduction to the AWS CLI
DEV323_Introduction to the AWS CLIDEV323_Introduction to the AWS CLI
DEV323_Introduction to the AWS CLI
 
Deep dive into AWS fargate
Deep dive into AWS fargateDeep dive into AWS fargate
Deep dive into AWS fargate
 
Deep Dive into AWS Fargate
Deep Dive into AWS FargateDeep Dive into AWS Fargate
Deep Dive into AWS Fargate
 
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@EdgeCTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
CTD201_Introduction to Amazon CloudFront and AWS Lambda@Edge
 
CON307_Building Effective Container Images
CON307_Building Effective Container ImagesCON307_Building Effective Container Images
CON307_Building Effective Container Images
 
State of the Union: Containers on AWS
State of the Union: Containers on AWSState of the Union: Containers on AWS
State of the Union: Containers on AWS
 
Elastic Kubernetes Services (EKS)
Elastic Kubernetes Services (EKS)Elastic Kubernetes Services (EKS)
Elastic Kubernetes Services (EKS)
 
DAT340_Hands-On Journey for Migrating Oracle Databases to the Amazon Aurora P...
DAT340_Hands-On Journey for Migrating Oracle Databases to the Amazon Aurora P...DAT340_Hands-On Journey for Migrating Oracle Databases to the Amazon Aurora P...
DAT340_Hands-On Journey for Migrating Oracle Databases to the Amazon Aurora P...
 
NEW LAUNCH! Introducing AWS Fargate - CON214 - re:Invent 2017
NEW LAUNCH! Introducing AWS Fargate - CON214 - re:Invent 2017NEW LAUNCH! Introducing AWS Fargate - CON214 - re:Invent 2017
NEW LAUNCH! Introducing AWS Fargate - CON214 - re:Invent 2017
 
Building Global Serverless Backends
Building Global Serverless BackendsBuilding Global Serverless Backends
Building Global Serverless Backends
 
Containers State of the Union
Containers State of the UnionContainers State of the Union
Containers State of the Union
 
AWS CLI: 2017 and Beyond - DEV307 - re:Invent 2017
AWS CLI: 2017 and Beyond - DEV307 - re:Invent 2017AWS CLI: 2017 and Beyond - DEV307 - re:Invent 2017
AWS CLI: 2017 and Beyond - DEV307 - re:Invent 2017
 
Amazon ECS Deep Dive
Amazon ECS Deep DiveAmazon ECS Deep Dive
Amazon ECS Deep Dive
 
Serverless Developer Experience
Serverless Developer ExperienceServerless Developer Experience
Serverless Developer Experience
 
Serverless Architectural Patterns
Serverless Architectural PatternsServerless Architectural Patterns
Serverless Architectural Patterns
 
Accelerating the Transition to Broadcast and OTT Infrastructure in the Cloud
Accelerating the Transition to Broadcast and OTT Infrastructure in the CloudAccelerating the Transition to Broadcast and OTT Infrastructure in the Cloud
Accelerating the Transition to Broadcast and OTT Infrastructure in the Cloud
 
Advanced Container Management and Scheduling
Advanced Container Management and SchedulingAdvanced Container Management and Scheduling
Advanced Container Management and Scheduling
 
Architecting Container Infrastructure for Security and Compliance - CON406 - ...
Architecting Container Infrastructure for Security and Compliance - CON406 - ...Architecting Container Infrastructure for Security and Compliance - CON406 - ...
Architecting Container Infrastructure for Security and Compliance - CON406 - ...
 
Containers on AWS: What You Missed at re:Invent 2017 - AWS Online Tech Talks
Containers on AWS: What You Missed at re:Invent 2017 - AWS Online Tech TalksContainers on AWS: What You Missed at re:Invent 2017 - AWS Online Tech Talks
Containers on AWS: What You Missed at re:Invent 2017 - AWS Online Tech Talks
 

Ähnlich wie Moving to Containers: Building with Docker and Amazon ECS - CON310 - re:Invent 2017

(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with ContainersAmazon Web Services
 
Accelerating Innovation with DevOps on AWS
Accelerating Innovation with DevOps on AWSAccelerating Innovation with DevOps on AWS
Accelerating Innovation with DevOps on AWSAmazon Web Services
 
A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)Julien SIMON
 
Transforming Software Development
Transforming Software DevelopmentTransforming Software Development
Transforming Software DevelopmentAmazon Web Services
 
Transforming Software Development
Transforming Software Development Transforming Software Development
Transforming Software Development Amazon Web Services
 
Continuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceContinuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceAmazon Web Services
 
AWS Elastic Beanstalk - Running Microservices and Docker
AWS Elastic Beanstalk - Running Microservices and DockerAWS Elastic Beanstalk - Running Microservices and Docker
AWS Elastic Beanstalk - Running Microservices and DockerAmazon Web Services
 
Making Sense Out of Amazon EC2 Container Service
Making Sense Out of Amazon EC2 Container ServiceMaking Sense Out of Amazon EC2 Container Service
Making Sense Out of Amazon EC2 Container ServiceSwapnil Dahiphale
 
Continuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECSContinuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECSAmazon Web Services
 
Continuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar SeriesContinuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar SeriesAmazon Web Services
 
Building Open Source Platforms on AWS (April 2017)
Building Open Source Platforms on AWS (April 2017)Building Open Source Platforms on AWS (April 2017)
Building Open Source Platforms on AWS (April 2017)Julien SIMON
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) serverDmitry Lyfar
 
From Docker Straight to AWS
From Docker Straight to AWSFrom Docker Straight to AWS
From Docker Straight to AWSDevOps.com
 
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...Swapnil Dahiphale
 
CI&CD on AWS - Meetup Roma Oct 2016
CI&CD on AWS - Meetup Roma Oct 2016CI&CD on AWS - Meetup Roma Oct 2016
CI&CD on AWS - Meetup Roma Oct 2016Paolo latella
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSContinuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSAmazon Web Services
 
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...Amazon Web Services
 
Increase Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web ServicesIncrease Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web ServicesAmazon Web Services
 
Increase Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web ServicesIncrease Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web ServicesAmazon Web Services
 

Ähnlich wie Moving to Containers: Building with Docker and Amazon ECS - CON310 - re:Invent 2017 (20)

(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
(DVO305) Turbocharge YContinuous Deployment Pipeline with Containers
 
Accelerating Innovation with DevOps on AWS
Accelerating Innovation with DevOps on AWSAccelerating Innovation with DevOps on AWS
Accelerating Innovation with DevOps on AWS
 
A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)
 
Transforming Software Development
Transforming Software DevelopmentTransforming Software Development
Transforming Software Development
 
Transforming Software Development
Transforming Software Development Transforming Software Development
Transforming Software Development
 
Continuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container ServiceContinuous Delivery to Amazon EC2 Container Service
Continuous Delivery to Amazon EC2 Container Service
 
AWS Elastic Beanstalk - Running Microservices and Docker
AWS Elastic Beanstalk - Running Microservices and DockerAWS Elastic Beanstalk - Running Microservices and Docker
AWS Elastic Beanstalk - Running Microservices and Docker
 
Making Sense Out of Amazon EC2 Container Service
Making Sense Out of Amazon EC2 Container ServiceMaking Sense Out of Amazon EC2 Container Service
Making Sense Out of Amazon EC2 Container Service
 
Continuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECSContinuous Delivery with Docker and Amazon ECS
Continuous Delivery with Docker and Amazon ECS
 
Continuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar SeriesContinuous Delivery to Amazon ECS - AWS August Webinar Series
Continuous Delivery to Amazon ECS - AWS August Webinar Series
 
Building Open Source Platforms on AWS (April 2017)
Building Open Source Platforms on AWS (April 2017)Building Open Source Platforms on AWS (April 2017)
Building Open Source Platforms on AWS (April 2017)
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) server
 
From Docker Straight to AWS
From Docker Straight to AWSFrom Docker Straight to AWS
From Docker Straight to AWS
 
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
Introduction to Amazon EC2 Container Service and setting up build pipeline wi...
 
CI&CD on AWS - Meetup Roma Oct 2016
CI&CD on AWS - Meetup Roma Oct 2016CI&CD on AWS - Meetup Roma Oct 2016
CI&CD on AWS - Meetup Roma Oct 2016
 
Making Sense out of Amazon ECS
Making Sense out of Amazon ECSMaking Sense out of Amazon ECS
Making Sense out of Amazon ECS
 
Continuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECSContinuous Delivery to Amazon ECS
Continuous Delivery to Amazon ECS
 
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...
Day 3 - DevOps Culture - Continuous Integration & Continuous Deployment on th...
 
Increase Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web ServicesIncrease Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web Services
 
Increase Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web ServicesIncrease Speed and Agility with Amazon Web Services
Increase Speed and Agility with Amazon Web Services
 

Mehr von Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

Mehr von Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Moving to Containers: Building with Docker and Amazon ECS - CON310 - re:Invent 2017

  • 1. Moving to Containers: Building Using Docker and Amazon ECS U t t a r a S r i d h a r , S o f t w a r e D e v e l o p m e n t E n g i n e e r , A W S T h i l i n a G u n a s i n g h e , S e n i o r D i r e c t o r , M c D o n a l d ’ s C o r p o r a t i o n M a n j e e v a S i l v a , T e c h n i c a l A r c h i t e c t , M c D o n a l d ’ s C o r p o r a t i o n C O N 3 1 0
  • 2. What to Expect from the Session • Review software development lifecycle • Why move to containers • Setup image repository with Amazon ECR • Deploy to Amazon ECS • Log, monitor and scale containers • Automate using CI/CD • Deep Dive McDonald’s home delivery platform
  • 4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. * Portable * Flexible * Fast * Efficient Why Move to Containers? Server Guest OS Bins/Libs Bins/Libs App2App1
  • 6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. FROM ubuntu:12.04 # Install dependencies: apache RUN apt-get update -y RUN apt-get install -y apache2 # write hello world message RUN echo "Hello World!" > /var/www/index.html # Configure apache RUN a2enmod rewrite RUN chown -R www-data:www-data /var/www ENV APACHE_RUN_USER www-data ENV APACHE_RUN_GROUP www-data ENV APACHE_LOG_DIR /var/log/apache2 EXPOSE 80 CMD ["/usr/sbin/apache2", "-D", "FOREGROUND"] Dockerfile
  • 7. Dockerfile Best Practices • Reduce build image sizes and number of layers • Only bring what you need at runtime • Always tag each build with any of these schemes: • Semantic version (i.e. “1.3.2-9”) • Git SHA (i.e. “aebcbca”) • Build Number (i.e., “127”) • Build Id (i.e. “511d5e51-b415-4cb2-b229-b3c8a46b7a2f”) • For multi-region, push to all regions, pull from same region
  • 9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Packaged Application Code Reproducible Immutable Portable Docker Images
  • 11. Amazon ECR: Container Image Registry Code repository Build environment Test environment Deployment environment Source code Artifact repository
  • 12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Amazon Elastic Container Registry Fully Managed * Tight Integration with Amazon ECS * Integration with Docker Toolset * Management Console and AWS CLI Highly Available * Amazon S3 backed * Regional endpoints Secure * IAM Resource-based Policies * AWS CloudTrail Audit Logs * Images encrypted at transit and at rest
  • 13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. # Create a repository called hello-world > aws ecr create-repository --repository-name hello-world # Build or tag an image > docker build -t hello-world . > docker tag hello-world aws_account_id.dkr.ecr.us-east-1.amazonaws.com/hello-world # Authenticate Docker to your Amazon ECR registry > aws ecr get-login > docker login -u AWS -p <password> -e none aws_account_id.dkr.ecr.us-east- 1.amazonaws.com # You can skip the `docker login` step if you have amazon-ecr-credential-helper setup. # Push an image to your repository > docker push aws_account_id.dkr.ecr.us-east-1.amazonaws.com/hello-world Amazon ECR Setup
  • 15. Running Test • Inside the container: Usual Docker commands available within your test environment Run the container with the commands necessary to execute your tests, e.g.: docker run web bundle exec rake test • Against the container: Start a container running in detached mode with an exposed port serving your app Run browser tests or other black box tests against the container, e.g. headless browser tests
  • 16. Deploy to Amazon ECS Code repository Build environment Test environment Deployment environment Source code Artifact repository
  • 17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Easily manage clusters of any size Flexible Container Placement Integrated with AWS services Extensible Amazon Elastic Container Service
  • 18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. • Cluster • Container Instances • Task Definition • Task • Service Amazon ECS Core Concepts
  • 19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "family":"hello-world", "containerDefinitions":[ { "name":"hello-world", "image":"aws_account_id.dkr.ecr.us-east- 1.amazonaws.com/hello-world", "cpu":10, "memory":500, "portMappings":[ { "containerPort":80, "hostPort":80 } ], "entryPoint":[ "/usr/sbin/apache2", "-D", "FOREGROUND" ], "essential":true } ], "volumes": [] } Amazon ECS Task Definition Container Definitions Volume Definitions
  • 20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "serviceName": "ecs-hello-world-elb", "taskDefinition": "hello-world", "loadBalancers": [ { "loadBalancerName": "EC2Contai- EcsElast-A0B1C2D3E4”, "containerName": "hello-world", "containerPort": 80 } ], "desiredCount": 10, "role": "ecsServiceRole" } Amazon ECS Service * Good for long-running applications * Load Balance traffic across containers * Automatically recover unhealthy containers * Discover services
  • 21. Amazon ECS Service • Deployment • Logging • Monitoring • Scaling
  • 22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "serviceName": "ecs-hello-world-elb", "taskDefinition": "hello-world", "deploymentConfiguration": { "maximumPercent": 100, "minimumHealthyPercent": 50 }, "loadBalancers": [ { "loadBalancerName": "EC2Contai-EcsElast-A0B1C2D3E4”, "containerName": "hello-world", "containerPort": 80 } ], "desiredCount": 10, "role": "ecsServiceRole" } Rolling Deployments
  • 23. Rolling Deployments minimumHealthyPercent = 50%, maximumPercent =100%
  • 24. Rolling Deployments minimumHealthyPercent = 100%, maximumPercent = 200%
  • 25. Amazon ECS Service • Deployment • Logging • Monitoring • Scaling
  • 26. Logging with Amazon CloudWatch Logs • Supported Docker Logging Drivers • json-file, syslog, journald, gelf, fluentd, awslogs • stdout/stderr outputs are automatically sent by the driver • awslogs sends logs to Amazon CloudWatch Logs • Log group for a specific service • Log stream for each container • Amazon CloudWatch Logs => Other services • Search, Filter, Export to Amazon S3, Send to Amazon Kinesis, AWS Lambda, Amazon Elasticsearch Service
  • 27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. { "family":"hello-world", "containerDefinitions":[ { "logConfiguration":{ "logDriver":"awslogs", "options":{ "awslogs-group":"awslogs-test", "awslogs-region":"us-east-1", "awslogs-stream-prefix":”hello-world" } }, "name":"hello-world", "image":"aws_account_id.dkr.ecr.us-east-1.amazonaws.com/hello-world", "cpu":10, "memory":500, ... Configuring Logging in Task Definition
  • 28. Amazon ECS Service • Deployment • Logging • Monitoring • Scaling
  • 29. Monitoring with Amazon CloudWatch • Metric data sent to CloudWatch in 1-minute periods and recorded for a period of two weeks • Available metrics: • CPUReservation • MemoryReservation • CPUUtilization • MemoryUtilization
  • 31. Amazon ECS Service • Deployment • Logging • Monitoring • Scaling
  • 32. Auto Scaling Your Amazon ECS Resources
  • 33. Auto Scaling Your Amazon ECS Services
  • 34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Create Amazon CloudWatch alarm on a metric, e.g. MemoryReservation Configure scaling policies to increase and decrease the size of your cluster Auto Scaling Your Amazon ECS Cluster
  • 36. Continuous Delivery to Amazon ECS with Jenkins 4. Push image to Amazon ECR 2. Build image from sources 3. Run test on image 1. Code push triggers build 5. Update service 6. Pull image
  • 37. Summary Code repository Build environment Test environment Deployment environment Source code Artifact repository Dockerfiles -AWS CodeCommit -Github -AWS CodeBuild -Jenkins -Amazon ECR -Dockerhub -Amazon ECS -Jenkins -Amazon ECS -Jenkins -Shippable -Codeship -wercker -Solano Labs CI/CD Partners
  • 38. AWS re:INVENT McDonald’s – Moving to Containers T h i l i n a G u n a s i n g h e a n d M a n j e e v a S i l v a C O N 3 1 0
  • 39. Contents • About McDonald’s and Digital Acceleration • McDonald's Home Delivery Platform: Business Problem and Architecture • Under the Covers: How we used ECS for Scale, Speed, Security, DevOps and Monitoring • Final Thoughts and Takeaways
  • 40. About McDonald’s and Digital Acceleration
  • 41. WORLD’S LARGEST RESTAURANT COMPANY 1.9M PEOPLE Working for McDonald’s & Franchisees 64M+ CUSTOMERS Served Every Day 37K RESTAURANTS 120 COUNTRIES
  • 42. digital experience of the future delivery VELOCITY ACCELERATORS McDonald’s uses scale as a competitive advantage to surpass the rising expectations of our customers across three growth initiatives. Seamless, personalized engagement with our customers when they are at home, on-the-go, or in a restaurants. Bringing McDonald’s directly to customers. Elevating the McDonald’s restaurant experience.
  • 43. McDonald’s Home Delivery Platform: Business Problem and Architecture
  • 44. Introducing Home Delivery digital & delivery Bringing McDonald’s to you
  • 45. Critical Business Requirements • Speed to market, quick turn around for features and functionality from concept to production • Scalability and reliability targets of, 250K-500K orders per hour • Multi country support and integration with multiple 3rd party food delivery partners • Cost sensitivity, cost model based on low average check amounts
  • 47. Key Architecture Principles • Microservices, with clean APIs, service models, isolation, independent data models and deployability. • Containers and orchestration, for handling massive scale, reliability and speed to market requirements • PaaS, based architecture model by leveraging AWS platform components such as ECS, SQS, RDS and Elasticache • Synchronous and event based, programming models based on requirements
  • 48. Under the Covers: Using Amazon ECS for Scale, Speed, Security, DevOps and Monitoring
  • 49. Why Amazon ECS? Speed to market Scalability and reliability Security DevOps – CI / CD Monitoring
  • 50. Speed to Market • 4 months from concept to production with 2 week dev iterations • Polyglot tech stack ported to containers • Existing .net code was refactored and complied with .net core • Java was used where .net core is not supported • Simplified Amazon ECS deployment model with easy integration to AWS services • Less time was spend on application tuning/testing to achieve the scale and reliability requirements • DevOps – Faster feedback loops on release iterations
  • 51. • Scale Targets: Achieved the scale targets of 250k-500k orders per hour with below ~100ms response times • Autoscaling: Used Amazon ECS “out-of-box” resource based autoscaling • Task Placement: Task placement strategies and constrains were used to fine-tune and achieve container isolation with country / 3rd party scaling requirements • Scalability and Reliability Requirements (By Service): 1. {Service 1} Contains synchronous APIs with intense scalability and reliability requirements based on traffic burst patterns 2. {Service 2} Requires more batch mode processing. Work load optimization is a critical requirement 3. Some instances of {Service 3} will need isolation from others Scalability and Reliability
  • 52. Task Task Task Scalability and Reliability {Service 1} Task Definition "placementStrategy": [ { "field": "attribute:ecs.availability-zone", "type": "spread" } {Service 2} Task Definition "placementStrategy": [ { "field": "memory", "type": "binpack" } ] {Service 3} Task Definition "placementConstraints": [ { "expression": "task:group == US", "type": "memberOf" } ] ECS instances (EC2) EC2 Auto scaling policy ECS Service scaling policy Tasks
  • 53. Security • Container security • Container isolation through IAM policies and security groups • Reduced container-to-container to communication (Reduce attack footprint). • ECS instance security • Automated AMI factory  start with ECS optimized AMIs McD hardened gold AMIs Project specific AMIs • AMI factory pipeline listens to a SNS topic for obtaining updated AMIs
  • 55. Monitoring • NewRelic agents configured to monitor the ECS instances, Containers and AWS PaaS components • ELK stack configured for service logging and analytics Task instance ECS Instance Log driver = syslog Task instanceTask Instance
  • 56. Major Technical Challenges o “Out of memory error” due to containers not having access to cgroup file systems to get memory limits o Solution: Incorporated a new filesystem(lxcfs) to virtualized cgroup and virtualized views of /proc files o Docker containers are not honoring the ECS instance routing rules o Solution: Custom implementation of a Docker bridge
  • 58. Final Thoughts and Key Takeaways • A thought out microservice architecture is key for scalability, reliability, and containerization. • Massive scale achievable (north of 20k TPS under 100ms) in a controlled manner using auto-scale policies and task placement strategies. • Moving to containers simplified our development and deployment models and in turn provided quicker dev/test iterations. • ECS out of the box integration and deployment models further simplified our DevOps pipeline.