SlideShare a Scribd company logo
1 of 23
Paolo Latella
@LatellaPaolo
 Docker on Amazon Web Services
From Development to Production with ECS
Genesis - the right tools
http://www.simpsoncrazy.com/
http://www.simpsoncrazy.com/
Genesis - the right tools
Development - Docker
Docker Engine Docker Compose Docker Hub
Development - Docker compose
Using Compose is basically a three-step process:
1. Define your app’s environment with a Dockerfile so it can
be reproduced anywhere.
2. Define the services that make up your app in docker-
compose.yml so they can be run together in an isolated
environment.
3. Run docker-compose up and Compose will start and run
your entire app.
Development - Docker compose example
version: '2'
services:
web:
image: platella/python-yarw-1:blue
build: .
ports:
- "8080"
volumes:
- python-microservice-one/application:/code
cpu_shares: 128
mem_limit: 134217728
links:
- redis
redis:
image: "redis:alpine"
cpu_shares: 128
mem_limit: 134217728
ports:
- "6379"
Production - Docker on AWS
• Docker on Amazon Elastic Beanstalk
• Docker on Amazon EC2 Container Service (ECS)
• Elastic Container Registry
• Task & Services
• Docker Swarm on Elastic Compute Cloud (EC2)
AWS
CloudFormation
Production - Docker on Amazon EB
• Single Container Docker Environments
• Run one container per instance.
• Use a Dockerfile or Dockerrun.aws.json file
• Multi Container Docker Environments
• Use Elastic Container Services inside a Elastic Beanstalk
Environment
• Set of containers defined in a Dockerrun.aws.json file
Docker on Amazon EB - Single Container
We can deploy from a Docker to Elastic Beanstalk by doing
(OR)
• Create a Dockerfile to customize an image and to deploy a
Docker container to Elastic Beanstalk.
• Create a Dockerrun.aws.json file to deploy a Docker
container from an existing Docker image to Elastic Beanstalk.
• Create a .zip file containing your application files, any
application file dependencies, the Dockerfile, and the
Dockerrun.aws.json file.
Docker on Amazon EB - Single Container -
DockerfileFROM ubuntu:14.04
# Ubuntu and nodeJS for ElasticBeanstalk
# VERSION 0.0.1
FROM ubuntu:14.04
MAINTAINER Paolo Latella <paolo.latella@xpeppers.com>
#Port mapping
EXPOSE 8080
#Update and install nodejs
RUN apt-get update && apt-get install -y nodejs
#Copy files for nodejs application
RUN mkdir /var/www/
ADD myws.js /var/www/
#Start application
CMD /usr/bin/nodejs /var/www/myws.js
Docker on Amazon EB - Single Container -
Dockerrun{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "janedoe/image",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "1234"
}
],
"Volumes": [
{
"HostDirectory": "/var/app/mydb",
"ContainerDirectory": "/etc/mysql"
}
],
"Logging": "/var/log/nginx"
}.
Production - Amazon EC2 Container Service
Amazon ECR
Amazon Elastic Container Service - ecs-cli
ECS CLI Command Line
ecs-cli configure --region eu-west-1 --cluster Demo-ECSCluster
ecs-cli up --keypair key --capability-iam --size 4 --instance-type c4.large
ecs-cli compose -f python-microservice1/docker-compose.yml service create
ecs-cli compose -f python-microservice1/docker-compose.yml service start
ecs-cli compose -f python-microservice1/docker-compose.yml service scale 2
http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI_reference.html
ECS CLI supports Docker compose file syntax versions 1 and 2
Amazon Elastic Container Service - aws ecs
AWS ECS Command Line
aws ecs create-cluster --region eu-west-1 --cluster-name “Demo-ECSCluster"
aws ecs register-task-definition --cli-input-json file://./python-yarw-1.json
aws ecs create-service --service-name python-yarw-1 --task-definition python-
yarw-1 --desired-count 2
aws ecs update-service --service python-yarw-1 --cluster Demo-ECSCluster --task-
definition python-yarw-1 --desired-count 4 --deployment-configuration
"maximumPercent=200,minimumHealthyPercent=100"
http://docs.aws.amazon.com/cli/latest/reference/ecs/index.html#cli-aws-ecs
Amazon Elastic Container Service - Task definition
(1/2){
"containerDefinitions": [
{
"memory": 128,
"portMappings": [
{
"hostPort": 0,
"containerPort": 6379,
"protocol": "tcp"
}
],
"name": "redis",
"image": "redis:alpine",
"cpu": 128,
},
Amazon Elastic Container Service - Task definition
(2/2){
"memory": 128,
"portMappings": [
{
"hostPort": 0,
"containerPort": 8080,
"protocol": "tcp"
}
],
"name": "web",
"links": [
"redis"
],
"cpu": 128,
}
],
"family": "ecscompose-python-microservice-one"
}
Amazon Elastic Container Service - Placement
aws ecs create-service --service-name python-yarw-1 --task-definition python-
yarw-1 --desired-count 2 --placement-strategy
type="spread",field="attribute:ecs.availability-zone"
type="binpack",field="memory"
Amazon Elastic Container Service - Load
Balanceraws ecs create-service --service-name python-yarw-1 --task-definition python-
yarw-1 --desired-count 2 --load-balancers
"targetGroupArn=arn:aws:elasticloadbalancing:eu-west-
1:831650818513:targetgroup/Microservices-
one/cca50273455ba775,containerName=web,containerPort=8080" --desired-count 2 --
deployment-configuration "maximumPercent=200,minimumHealthyPercent=50" --role
ECS-TestRole
Amazon Elastic Container Service - Blue/Green
Deploy
DNS Swap
1. Create new task definition
2. Create new service
3. Create new ALB
4. Attach new service to ALB
5. Update Route53
6. CleanUP Blue
Environment
Service Swap
1. Create new task definition
2. - Create new service
3. - Attach new service to
ALB
4. - Scale Up Green Service
5. - Scale Down Blue Service
Service Update
1. Create new task definition
2. Update the service
Amazon
CloudWatch
Production - CI/CD with ECS and CodePipeline
Code Build TestProvision Deploy Monitor
AWS
CodePipeline
AWS
CodeCommit
AWS
CodeBuild
AWS
Lambda
Amazon ECR
Amazon ECSAWS
CloudFormation
Amazon ECS
Demo - Steps
1. Create ECS Cluster and related resources
2. Creates an ECS task definition from your compose file
3. Create Service from task definition and attach to ALB
4. Scale task associated to services
5. Scale Cluster instances
6. Simulate Blue/Green deployment
Links
• https://martinfowler.com/bliki/MonolithFirst.html
• https://docs.docker.com/docker-for-aws/
• http://docs.aws.amazon.com/AmazonECS/latest/develo
perguide/ECS_CLI_reference.html
• http://docs.aws.amazon.com/cli/latest/reference/ecs/ind
ex.html#cli-aws-ecs
• https://github.com/ExpediaDotCom/c3vis
www.xpeppers.com
/xpepperssrl@xpeppers
@LatellaPaolo

More Related Content

What's hot

Aws tutorial for beginners- tibacademy.in
Aws tutorial for beginners- tibacademy.inAws tutorial for beginners- tibacademy.in
Aws tutorial for beginners- tibacademy.inTIB Academy
 
"How to optimize the architecture of your platform" by Julien Simon
"How to optimize the architecture of your platform" by Julien Simon"How to optimize the architecture of your platform" by Julien Simon
"How to optimize the architecture of your platform" by Julien SimonTheFamily
 
Agile Deployment using Git and AWS Elastic Beanstalk
Agile Deployment using Git and AWS Elastic BeanstalkAgile Deployment using Git and AWS Elastic Beanstalk
Agile Deployment using Git and AWS Elastic BeanstalkAmazon Web Services
 
2017 AWSome day Taichung sharing
2017 AWSome day Taichung sharing2017 AWSome day Taichung sharing
2017 AWSome day Taichung sharingYu-Lin Huang
 
Building High-availability Websites on AWS
Building High-availability Websites on AWSBuilding High-availability Websites on AWS
Building High-availability Websites on AWSAmazon Web Services
 
AWS CloudFormation (February 2016)
AWS CloudFormation (February 2016)AWS CloudFormation (February 2016)
AWS CloudFormation (February 2016)Julien SIMON
 
Amazon EC2 - Masterclass - Pop-up Loft Tel Aviv
Amazon EC2 - Masterclass - Pop-up Loft Tel AvivAmazon EC2 - Masterclass - Pop-up Loft Tel Aviv
Amazon EC2 - Masterclass - Pop-up Loft Tel AvivAmazon Web Services
 
Introduction to Amazon EC2 Spot Instances
Introduction to Amazon EC2 Spot InstancesIntroduction to Amazon EC2 Spot Instances
Introduction to Amazon EC2 Spot InstancesAmazon 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
 
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...Amazon Web Services
 
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWSAWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWSAmazon Web Services
 
AWS July Webinar Series: Introducing AWS OpsWorks for Windows Server
AWS July Webinar Series: Introducing AWS OpsWorks for Windows ServerAWS July Webinar Series: Introducing AWS OpsWorks for Windows Server
AWS July Webinar Series: Introducing AWS OpsWorks for Windows ServerAmazon Web Services
 
Deep Dive: Amazon Relational Database Service (March 2017)
Deep Dive: Amazon Relational Database Service (March 2017)Deep Dive: Amazon Relational Database Service (March 2017)
Deep Dive: Amazon Relational Database Service (March 2017)Julien SIMON
 
AWS re:Invent 2016: Workshop: Deploy a Deep Learning Framework on Amazon ECS ...
AWS re:Invent 2016: Workshop: Deploy a Deep Learning Framework on Amazon ECS ...AWS re:Invent 2016: Workshop: Deploy a Deep Learning Framework on Amazon ECS ...
AWS re:Invent 2016: Workshop: Deploy a Deep Learning Framework on Amazon ECS ...Amazon Web Services
 

What's hot (20)

Aws tutorial for beginners- tibacademy.in
Aws tutorial for beginners- tibacademy.inAws tutorial for beginners- tibacademy.in
Aws tutorial for beginners- tibacademy.in
 
"How to optimize the architecture of your platform" by Julien Simon
"How to optimize the architecture of your platform" by Julien Simon"How to optimize the architecture of your platform" by Julien Simon
"How to optimize the architecture of your platform" by Julien Simon
 
Aws cli
Aws cliAws cli
Aws cli
 
Agile Deployment using Git and AWS Elastic Beanstalk
Agile Deployment using Git and AWS Elastic BeanstalkAgile Deployment using Git and AWS Elastic Beanstalk
Agile Deployment using Git and AWS Elastic Beanstalk
 
My First Big Data Application
My First Big Data ApplicationMy First Big Data Application
My First Big Data Application
 
2017 AWSome day Taichung sharing
2017 AWSome day Taichung sharing2017 AWSome day Taichung sharing
2017 AWSome day Taichung sharing
 
Building High-availability Websites on AWS
Building High-availability Websites on AWSBuilding High-availability Websites on AWS
Building High-availability Websites on AWS
 
AWS CloudFormation (February 2016)
AWS CloudFormation (February 2016)AWS CloudFormation (February 2016)
AWS CloudFormation (February 2016)
 
Introduction to Amazon EC2
Introduction to Amazon EC2Introduction to Amazon EC2
Introduction to Amazon EC2
 
Amazon EC2 - Masterclass - Pop-up Loft Tel Aviv
Amazon EC2 - Masterclass - Pop-up Loft Tel AvivAmazon EC2 - Masterclass - Pop-up Loft Tel Aviv
Amazon EC2 - Masterclass - Pop-up Loft Tel Aviv
 
Introduction to Amazon EC2 Spot Instances
Introduction to Amazon EC2 Spot InstancesIntroduction to Amazon EC2 Spot Instances
Introduction to Amazon EC2 Spot Instances
 
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)
 
Amazon EC2 Masterclass
Amazon EC2 MasterclassAmazon EC2 Masterclass
Amazon EC2 Masterclass
 
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
Module 2: AWS Infrastructure – Compute, Storage and Networking - AWSome Day O...
 
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWSAWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
AWS January 2016 Webinar Series - Introduction to Deploying Applications on AWS
 
AWS July Webinar Series: Introducing AWS OpsWorks for Windows Server
AWS July Webinar Series: Introducing AWS OpsWorks for Windows ServerAWS July Webinar Series: Introducing AWS OpsWorks for Windows Server
AWS July Webinar Series: Introducing AWS OpsWorks for Windows Server
 
Deep Dive: Amazon Relational Database Service (March 2017)
Deep Dive: Amazon Relational Database Service (March 2017)Deep Dive: Amazon Relational Database Service (March 2017)
Deep Dive: Amazon Relational Database Service (March 2017)
 
The History of AWS EC2
The History of AWS EC2The History of AWS EC2
The History of AWS EC2
 
Understanding The Benefits Of Amazon EC2
Understanding The Benefits Of Amazon EC2Understanding The Benefits Of Amazon EC2
Understanding The Benefits Of Amazon EC2
 
AWS re:Invent 2016: Workshop: Deploy a Deep Learning Framework on Amazon ECS ...
AWS re:Invent 2016: Workshop: Deploy a Deep Learning Framework on Amazon ECS ...AWS re:Invent 2016: Workshop: Deploy a Deep Learning Framework on Amazon ECS ...
AWS re:Invent 2016: Workshop: Deploy a Deep Learning Framework on Amazon ECS ...
 

Similar to Amazon Web Services and Docker: from developing to production

Docker in Production - IPC 2016
Docker in Production - IPC 2016Docker in Production - IPC 2016
Docker in Production - IPC 2016Robert Lemke
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안양재동 코드랩
 
Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Patrick Chanezon
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windowsDocker, Inc.
 
Docker for Ruby Developers
Docker for Ruby DevelopersDocker for Ruby Developers
Docker for Ruby DevelopersAptible
 
Dockerization of Azure Platform
Dockerization of Azure PlatformDockerization of Azure Platform
Dockerization of Azure Platformnirajrules
 
Using the Azure Container Service in your company
Using the Azure Container Service in your companyUsing the Azure Container Service in your company
Using the Azure Container Service in your companyJan de Vries
 
Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016Patrick Chanezon
 
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon Web Services
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endEzequiel Maraschio
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) serverDmitry Lyfar
 
What Is AWS Elastic Kubernetes Service
 What Is AWS Elastic Kubernetes Service What Is AWS Elastic Kubernetes Service
What Is AWS Elastic Kubernetes ServiceAMELIAOLIVIA2
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...Jérôme Petazzoni
 
Docker module 1
Docker module 1Docker module 1
Docker module 1Liang Bo
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Anthony Dahanne
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor VolkovKuberton
 

Similar to Amazon Web Services and Docker: from developing to production (20)

Docker in Production - IPC 2016
Docker in Production - IPC 2016Docker in Production - IPC 2016
Docker in Production - IPC 2016
 
Docker
DockerDocker
Docker
 
[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안[Codelab 2017] Docker 기초 및 활용 방안
[Codelab 2017] Docker 기초 및 활용 방안
 
0507 057 01 98 * Adana Klima Tamir Servisi
0507 057 01 98 * Adana Klima Tamir Servisi0507 057 01 98 * Adana Klima Tamir Servisi
0507 057 01 98 * Adana Klima Tamir Servisi
 
Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016Docker Container As A Service - JAX 2016
Docker Container As A Service - JAX 2016
 
Docker for developers on mac and windows
Docker for developers on mac and windowsDocker for developers on mac and windows
Docker for developers on mac and windows
 
Docker for Ruby Developers
Docker for Ruby DevelopersDocker for Ruby Developers
Docker for Ruby Developers
 
Dockerization of Azure Platform
Dockerization of Azure PlatformDockerization of Azure Platform
Dockerization of Azure Platform
 
Using the Azure Container Service in your company
Using the Azure Container Service in your companyUsing the Azure Container Service in your company
Using the Azure Container Service in your company
 
Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016Docker Container As A Service - Mix-IT 2016
Docker Container As A Service - Mix-IT 2016
 
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
Amazon EC2 Container Service: Manage Docker-Enabled Apps in EC2
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-end
 
Omaha (Google Update) server
Omaha (Google Update) serverOmaha (Google Update) server
Omaha (Google Update) server
 
What Is AWS Elastic Kubernetes Service
 What Is AWS Elastic Kubernetes Service What Is AWS Elastic Kubernetes Service
What Is AWS Elastic Kubernetes Service
 
Amazon EC2 Container Service
Amazon EC2 Container ServiceAmazon EC2 Container Service
Amazon EC2 Container Service
 
From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...From development environments to production deployments with Docker, Compose,...
From development environments to production deployments with Docker, Compose,...
 
EC2 Container Service
EC2 Container ServiceEC2 Container Service
EC2 Container Service
 
Docker module 1
Docker module 1Docker module 1
Docker module 1
 
Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !Get you Java application ready for Kubernetes !
Get you Java application ready for Kubernetes !
 
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 Cloud-native applications with Java and Kubernetes - Yehor Volkov Cloud-native applications with Java and Kubernetes - Yehor Volkov
Cloud-native applications with Java and Kubernetes - Yehor Volkov
 

More from Paolo latella

Data Analysis on AWS
Data Analysis on AWSData Analysis on AWS
Data Analysis on AWSPaolo latella
 
Amazon Web Services and Docker
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and DockerPaolo latella
 
Hybrid Cloud With AWS and Eucalyptus
Hybrid Cloud With AWS and EucalyptusHybrid Cloud With AWS and Eucalyptus
Hybrid Cloud With AWS and EucalyptusPaolo latella
 
Mobile app and disaster recovery with aws
Mobile app and disaster recovery with awsMobile app and disaster recovery with aws
Mobile app and disaster recovery with awsPaolo latella
 
Cloud Transcoding with Amazon Web Services
Cloud Transcoding with Amazon Web ServicesCloud Transcoding with Amazon Web Services
Cloud Transcoding with Amazon Web ServicesPaolo latella
 
Amazon Web Services and Interact - Workshop Giugno 2013
Amazon Web Services and Interact - Workshop Giugno 2013Amazon Web Services and Interact - Workshop Giugno 2013
Amazon Web Services and Interact - Workshop Giugno 2013Paolo latella
 

More from Paolo latella (8)

XPeppers e AWS
XPeppers e AWSXPeppers e AWS
XPeppers e AWS
 
AWSUGIT-Promo
AWSUGIT-PromoAWSUGIT-Promo
AWSUGIT-Promo
 
Data Analysis on AWS
Data Analysis on AWSData Analysis on AWS
Data Analysis on AWS
 
Amazon Web Services and Docker
Amazon Web Services and DockerAmazon Web Services and Docker
Amazon Web Services and Docker
 
Hybrid Cloud With AWS and Eucalyptus
Hybrid Cloud With AWS and EucalyptusHybrid Cloud With AWS and Eucalyptus
Hybrid Cloud With AWS and Eucalyptus
 
Mobile app and disaster recovery with aws
Mobile app and disaster recovery with awsMobile app and disaster recovery with aws
Mobile app and disaster recovery with aws
 
Cloud Transcoding with Amazon Web Services
Cloud Transcoding with Amazon Web ServicesCloud Transcoding with Amazon Web Services
Cloud Transcoding with Amazon Web Services
 
Amazon Web Services and Interact - Workshop Giugno 2013
Amazon Web Services and Interact - Workshop Giugno 2013Amazon Web Services and Interact - Workshop Giugno 2013
Amazon Web Services and Interact - Workshop Giugno 2013
 

Recently uploaded

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Neo4j
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 

Recently uploaded (20)

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024Build your next Gen AI Breakthrough - April 2024
Build your next Gen AI Breakthrough - April 2024
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 

Amazon Web Services and Docker: from developing to production

  • 1. Paolo Latella @LatellaPaolo Docker on Amazon Web Services From Development to Production with ECS
  • 2. Genesis - the right tools http://www.simpsoncrazy.com/
  • 4. Development - Docker Docker Engine Docker Compose Docker Hub
  • 5. Development - Docker compose Using Compose is basically a three-step process: 1. Define your app’s environment with a Dockerfile so it can be reproduced anywhere. 2. Define the services that make up your app in docker- compose.yml so they can be run together in an isolated environment. 3. Run docker-compose up and Compose will start and run your entire app.
  • 6. Development - Docker compose example version: '2' services: web: image: platella/python-yarw-1:blue build: . ports: - "8080" volumes: - python-microservice-one/application:/code cpu_shares: 128 mem_limit: 134217728 links: - redis redis: image: "redis:alpine" cpu_shares: 128 mem_limit: 134217728 ports: - "6379"
  • 7. Production - Docker on AWS • Docker on Amazon Elastic Beanstalk • Docker on Amazon EC2 Container Service (ECS) • Elastic Container Registry • Task & Services • Docker Swarm on Elastic Compute Cloud (EC2) AWS CloudFormation
  • 8. Production - Docker on Amazon EB • Single Container Docker Environments • Run one container per instance. • Use a Dockerfile or Dockerrun.aws.json file • Multi Container Docker Environments • Use Elastic Container Services inside a Elastic Beanstalk Environment • Set of containers defined in a Dockerrun.aws.json file
  • 9. Docker on Amazon EB - Single Container We can deploy from a Docker to Elastic Beanstalk by doing (OR) • Create a Dockerfile to customize an image and to deploy a Docker container to Elastic Beanstalk. • Create a Dockerrun.aws.json file to deploy a Docker container from an existing Docker image to Elastic Beanstalk. • Create a .zip file containing your application files, any application file dependencies, the Dockerfile, and the Dockerrun.aws.json file.
  • 10. Docker on Amazon EB - Single Container - DockerfileFROM ubuntu:14.04 # Ubuntu and nodeJS for ElasticBeanstalk # VERSION 0.0.1 FROM ubuntu:14.04 MAINTAINER Paolo Latella <paolo.latella@xpeppers.com> #Port mapping EXPOSE 8080 #Update and install nodejs RUN apt-get update && apt-get install -y nodejs #Copy files for nodejs application RUN mkdir /var/www/ ADD myws.js /var/www/ #Start application CMD /usr/bin/nodejs /var/www/myws.js
  • 11. Docker on Amazon EB - Single Container - Dockerrun{ "AWSEBDockerrunVersion": "1", "Image": { "Name": "janedoe/image", "Update": "true" }, "Ports": [ { "ContainerPort": "1234" } ], "Volumes": [ { "HostDirectory": "/var/app/mydb", "ContainerDirectory": "/etc/mysql" } ], "Logging": "/var/log/nginx" }.
  • 12. Production - Amazon EC2 Container Service Amazon ECR
  • 13. Amazon Elastic Container Service - ecs-cli ECS CLI Command Line ecs-cli configure --region eu-west-1 --cluster Demo-ECSCluster ecs-cli up --keypair key --capability-iam --size 4 --instance-type c4.large ecs-cli compose -f python-microservice1/docker-compose.yml service create ecs-cli compose -f python-microservice1/docker-compose.yml service start ecs-cli compose -f python-microservice1/docker-compose.yml service scale 2 http://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_CLI_reference.html ECS CLI supports Docker compose file syntax versions 1 and 2
  • 14. Amazon Elastic Container Service - aws ecs AWS ECS Command Line aws ecs create-cluster --region eu-west-1 --cluster-name “Demo-ECSCluster" aws ecs register-task-definition --cli-input-json file://./python-yarw-1.json aws ecs create-service --service-name python-yarw-1 --task-definition python- yarw-1 --desired-count 2 aws ecs update-service --service python-yarw-1 --cluster Demo-ECSCluster --task- definition python-yarw-1 --desired-count 4 --deployment-configuration "maximumPercent=200,minimumHealthyPercent=100" http://docs.aws.amazon.com/cli/latest/reference/ecs/index.html#cli-aws-ecs
  • 15. Amazon Elastic Container Service - Task definition (1/2){ "containerDefinitions": [ { "memory": 128, "portMappings": [ { "hostPort": 0, "containerPort": 6379, "protocol": "tcp" } ], "name": "redis", "image": "redis:alpine", "cpu": 128, },
  • 16. Amazon Elastic Container Service - Task definition (2/2){ "memory": 128, "portMappings": [ { "hostPort": 0, "containerPort": 8080, "protocol": "tcp" } ], "name": "web", "links": [ "redis" ], "cpu": 128, } ], "family": "ecscompose-python-microservice-one" }
  • 17. Amazon Elastic Container Service - Placement aws ecs create-service --service-name python-yarw-1 --task-definition python- yarw-1 --desired-count 2 --placement-strategy type="spread",field="attribute:ecs.availability-zone" type="binpack",field="memory"
  • 18. Amazon Elastic Container Service - Load Balanceraws ecs create-service --service-name python-yarw-1 --task-definition python- yarw-1 --desired-count 2 --load-balancers "targetGroupArn=arn:aws:elasticloadbalancing:eu-west- 1:831650818513:targetgroup/Microservices- one/cca50273455ba775,containerName=web,containerPort=8080" --desired-count 2 -- deployment-configuration "maximumPercent=200,minimumHealthyPercent=50" --role ECS-TestRole
  • 19. Amazon Elastic Container Service - Blue/Green Deploy DNS Swap 1. Create new task definition 2. Create new service 3. Create new ALB 4. Attach new service to ALB 5. Update Route53 6. CleanUP Blue Environment Service Swap 1. Create new task definition 2. - Create new service 3. - Attach new service to ALB 4. - Scale Up Green Service 5. - Scale Down Blue Service Service Update 1. Create new task definition 2. Update the service
  • 20. Amazon CloudWatch Production - CI/CD with ECS and CodePipeline Code Build TestProvision Deploy Monitor AWS CodePipeline AWS CodeCommit AWS CodeBuild AWS Lambda Amazon ECR Amazon ECSAWS CloudFormation Amazon ECS
  • 21. Demo - Steps 1. Create ECS Cluster and related resources 2. Creates an ECS task definition from your compose file 3. Create Service from task definition and attach to ALB 4. Scale task associated to services 5. Scale Cluster instances 6. Simulate Blue/Green deployment
  • 22. Links • https://martinfowler.com/bliki/MonolithFirst.html • https://docs.docker.com/docker-for-aws/ • http://docs.aws.amazon.com/AmazonECS/latest/develo perguide/ECS_CLI_reference.html • http://docs.aws.amazon.com/cli/latest/reference/ecs/ind ex.html#cli-aws-ecs • https://github.com/ExpediaDotCom/c3vis

Editor's Notes

  1. Using Compose is basically a three-step process. Define your app’s environment with a Dockerfile so it can be reproduced anywhere. Define the services that make up your app in docker-compose.yml so they can be run together in an isolated environment. Lastly, run docker-compose up and Compose will start and run your entire app.
  2. https://aws.amazon.com/blogs/developer/credentials-best-practices/