SlideShare una empresa de Scribd logo
1 de 38
© 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS Elastic Beanstalk (EB)
Running Single and Multi-Container Docker
applications
Daniele Stroppa, Technical Account Manager
October 10th, 2017
Agenda
• Overview
• Elastic Beanstalk vs DIY
• How to use Elastic Beanstalk
• Single and Multi-Container Docker with AWS Elastic Beanstalk
• Best Practices
Developer challenges
• Complexity of deploying code, provisioning
and managing infrastructure
• Expertise and time needed to manage and
configure servers, databases, load
balancers, firewalls, and networks
• How to automate application scaling
• Lack of consistency across teams
What is Elastic Beanstalk?
AWS Elastic Beanstalk is an easy-to-use service for
deploying, scaling, and managing web applications and
services.
AWS Elastic Beanstalk vs. Do It Yourself
Your code
HTTP Server
Application Server
Language Interpreter
Operating System
Host
Elastic Beanstalk configures each
EC2 instance in your
environment with the components
necessary to run applications for
the selected platform.
Focus on building your
application
Provided by you
Provided and managed by AWS Elastic Beanstalk (EB)
On-instance configuration
AWS Elastic Beanstalk vs. Do It Yourself
• Preconfigured Infrastructure
• Single Instance (Dev, Low Cost)
• Load Balanced, Auto Scaling (Production)
• Web & Worker tiers
• Elastic Beanstalk provisions necessary
infrastructure resources such as the load
balancer, Auto Scaling group, security
groups, database (optional), etc.
• Provides a unique domain name for your
application
(e.g.: youapp.regionx.elasticbeanstalk.com)
Infrastructure stack
Elastic Beanstalk benefits
Fast & simple
to begin
Developer
productivity/agility
Impossible
to outgrow
Complete
resource control
No additional charge to use Elastic Beanstalk.
You pay only for underlying AWS resources (i.e., EC2 instances, S3, etc.)
Common use cases
Websites
API
backends
Mobile
backends
Asynchronous
Workers
Getting started with Elastic Beanstalk:
Information required to deploy application
01
02
03
04
Region
Stack (container) type
Single Instance
Load Balanced
with Auto ScalingOR
Database (RDS)
Your code
Optional
Supported Platforms
Custom Platforms
Create and use your own custom
platform
Building blocks
Application
Application Versions ( V1, V2, …,Vx)
Environm
ent 1
Environm
ent 2
Environm
ent .. n
How to deploy applications
1. Via AWS Management Console
2. Via AWS Toolkit for Eclipse and Visual
Studio IDE
3. Via AWS SDKs and CLI
4. Via EB command line interface
$ eb deploy
Deploy sample application (EB CLI)
Initial application deployment workflow
$ git clone
https://github.com/awslabs/eb-
node-express-sample.git
Download sample application2
$ eb init
Create your Elastic Beanstalk app3
Follow the prompts to configure the
environment
4
5 Create the resources and launch the
application
$ eb create
$ pip install --upgrade awsebcli
Install the AWS Elastic Beanstalk
command line interface (EB CLI)
1
Demo
Update sample application (EB CLI)
Update application workflow
Update your code1
$ git add .
$ git commit –m “v2.0”
$ eb deploy
Add & commit code to repository2
Open application once deployment
completes
3
$ eb open
Docker with AWS Elastic Beanstalk
Docker Platform Configurations
• Single Container Docker
• Multi-Container Docker
Multi Container: Architecture
• Each environment has its own ECS Cluster
• Supports a single ECS Task definition per environment
• The ECS Task is defined in the Dockerrun.aws.json file
• Uses a flood scheduling mechanism
• Provides out of the box auto scaling for ECS Tasks
Elastic Beanstalk Environment
Auto Scaling Group / ECS Cluster
Instance 1 Instance 2
app1.elasticbeanstalk.com
Elastic Load
Balancing
Container	2Container	1
Container	3
Container	2Container	1
Container	3
Multi Container: Dockerrun.aws.json
{
"AWSEBDockerrunVersion": 2,
"volumes": [
{
"name": "node-app",
"host": {
"sourcePath": "/var/app/current/node-app"
}
},
{
"name": "tomcat-app",
"host": {
"sourcePath": "/var/app/current/tomcat-app"
}
}
],
"containerDefinitions": [
{
"name": "node-app",
"image": "node:0.12",
"essential": true,
"memory": 128,
"portMappings": [
{
"hostPort": 80,
"containerPort": 8000
}
],
"command": [
"/bin/bash",
"/usr/src/app/run.sh"
],
"mountPoints": [
{
"sourceVolume": "node-app",
"containerPath": "/usr/src/app"
}
]
},
{
"name": "tomcat-app",
"image": "tomcat:8.0",
"essential": true,
"memory": 256,
"portMappings": [
{
"hostPort": 8080,
"containerPort": 8080
}
],
"mountPoints": [
{
"sourceVolume": "awseb-logs-tomcat-app",
"containerPath": "/usr/local/tomcat/logs"
},
{
"sourceVolume": "tomcat-app",
"containerPath": "/usr/local/tomcat/webapps/ROOT",
"readOnly": true
}
]
}
]
}
Multi Container requires version 2
Multi Container with Elastic Beanstalk
Nginx Proxy Example
Code at: https://github.com/awslabs/eb-docker-nginx-proxy
Demo
Multi Container with Elastic Beanstalk
Multiple Ports Example
Code at: https://github.com/awslabs/eb-docker-multiple-ports
Elastic Beanstalk Environment
Auto Scaling Group / ECS Cluster
Instance 1 Instance 2
Node.js Node.js
Tomcat
80
8080 Tomcat
app1.elasticbeanstalk.com:80
app1.elasticbeanstalk.com:8080
Elastic Load
Balancing
Multi Container with Elastic Beanstalk
Virtual Hosts Example
Code at: https://github.com/awslabs/eb-docker-virtual-hosting
Elastic Beanstalk Environment
Auto Scaling Group / ECS Cluster
Instance 1 Instance 2
80
Container	1
Container	2
Nginx
Container	1
Container	2
Nginx
container1.app1.elasticbeanstalk.com
container2.app1.elasticbeanstalk.com
Elastic Load
Balancing
Benefits of using Multi-Container Docker with
Elastic Beanstalk
• Automation of capacity provisioning, load balancing,
scaling, and application health monitoring
• One stop management of your application in an
environment that supports range of services that are
integrated with Elastic Beanstalk, including but not
limited to VPC, RDS, and IAM.
Best Practices
Deployment options
* Default method ^ ”All at Once” Method used
Environment	Type Deployment	category Method
All	at	Once*
Immutable	(New)
Disabled*^
Immutable	(New)
All	at	Once
Rolling*
Rolling	with	additional	batch
Immutable
Disabled^
Rolling	based	on	Health*
Rolling	based	on	Time
Immutable
Single	Instance
Load	Balanced/Auto-Scaled
Application
Platform/Configuration
Application	
Platform/Configuration
Application deployment options
Method Impact of failed deployment
Deploy
Time
Zero
Downtime
No DNS
Change
Rollback
process
Code
Deployed
To
All at Once¬ Downtime ¹ X ü Re-deploy Existing
instances
Rolling Single batch out of service. Any
successful batches prior to
failure running new application
version
¹¹♦ ü ü Re-deploy Existing
instances
Rolling with
additional batch
Minimum if first batch fails,
otherwise similar to Rolling
¹¹¹♦ ü ü Re-deploy New &
existing
instances
Immutable¬ Minimal ¹¹¹¹ ü ü Re-deploy New
instances
Blue/Green Minimal ¹¹¹¹¹ ü X Swap URL New
instances
¬ Options available for both Single Instance and Load Balanced/Auto-Scaled Environments ♦ Varies depending on instance batch size
Managed Platform Update
Configure your environment to automatically upgrade to the latest
version of a platform during a scheduled maintenance window.
• Permissions
• Maintenance Window
• Minor and Patch Updates
Key benefits:
• Automated Upgrades
• No/Minimal downtime
• No/Minimal impact on capacity
• Flexibility of manual updates
• Instance replacement
Auto Scaling
Min/Max
instances
Availability
Zones
Scaling
cooldown
Triggers based
scaling
Trigger measurement
(CPU utilization, network traffic, disk
activity, instance health)
Trigger statistic
Measurement period
Breach duration
Thresholds
Breach scale increment
Time-based
scaling
Name
Min/Max instance
Occurrence (One-time, Recurrent)
Recurrence (CRON expression- 30 8 * * 3)
Logs, Metrics, & Alarms
• Enable log rotation to automatically publish logs to S3.
• Set up alarms to automatically monitor critical metrics and send
notifications when metrics are outside normal operating range.
• Enable Amazon Route 53 health checks and alarms
• CloudWatch Log streaming to stream logs in real time from Elastic
Beanstalk managed EC2 instance to CloudWatch
Other tips
Tag your environments
• Resource discoverability, cost monitoring, access control
• Elastic Beanstalk automatically tags environments
Application version lifecycle management:
• Automate application version cleanup
• Does not apply to deployed versions
Custom Platform
• Create and manage your own custom Elastic Beanstalk
platforms
• Get greater control over the AMI, metadata, and
configuration
• Enforce and manage standardization/best practices across
environments (without the need for .ebextensions)
Custom Platform
Examples:
• Create your own platforms on Ubuntu or Red Hat Enterprise
• Customize your instances with languages/frameworks currently not
supported by Elastic Beanstalk e.g. Rust, Sinatra etc.
• Create your own platform that uses encrypted AMIs or custom disk
layouts e.g. multiple volumes, EFS mounts etc.
Custom Platform
Creating a Custom Platform:
• Uses Packer: an open-source tool for creating machine images
• EB CLI, API, SDK
• Platform Definition archive
• Packer template (Platform name, base AMI)
• Platform definition file: platform.yml (metadata: OS, language/framework)
• Builder (runtime scripts, hooks, configuration)
• EB CLI
• eb platform init
• eb platform create
Custom Platform
Using a Custom Platform in an environment:
• AWS Management console, EB CLI, API, SDK
• EB CLI:
• eb init
• select option “Custom Platform” for the question “select a platform”
• eb create
• Console:
Custom Platform
Feature control
option_settings:
# default environment variable
- namespace: aws:elasticbeanstalk:application:environment
option_name: MYENVPARAM
value: "MyApplicationControl"
# default autoscaling group attribute
- namespace: aws:autoscaling:asg
option_name: MinSize
value: 2
- namespace: aws:autoscaling:asg
option_name: MaxSize
value: 8
# default autoscaling launch configuration attribute
- namespace: aws:autoscaling:launchconfiguration
option_name: InstanceType
value: m3.large
# default log streaming setting
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: StreamLogs
value: true
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: DeleteOnTerminate
value: false
- namespace: aws:elasticbeanstalk:cloudwatch:logs
option_name: RetentionInDays
# default deployment preference
- namespace: aws:elasticbeanstalk:command
option_name: DeploymentPolicy
value: Rolling
- namespace: aws:elasticbeanstalk:command
option_name: BatchSize
value: 30
- namespace: aws:elasticbeanstalk:command
option_name: BatchSizeType
value: Percentage
# default scaling setting
- namespace: aws:autoscaling:trigger
option_name: MeasureName
value: CPUUtilization
- namespace: aws:autoscaling:trigger
option_name: Period
value: 1
- namespace: aws:autoscaling:trigger
option_name: Unit
value: Percent
- namespace: aws:autoscaling:trigger
option_name: UpperThreshold
value: 90
- namespace: aws:autoscaling:trigger
option_name: LowerThreshold
value: 35
Questions?
How to get in touch with the EB team?
Forum:
https://forums.aws.amazon.com/forum.jspa?forumID=86
Twitter
@aws_eb
Thank You!

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

AWS 상의 컨테이너 서비스 소개 ECS, EKS - 이종립 / Principle Enterprise Evangelist @베스핀글로벌
AWS 상의 컨테이너 서비스 소개 ECS, EKS - 이종립 / Principle Enterprise Evangelist @베스핀글로벌AWS 상의 컨테이너 서비스 소개 ECS, EKS - 이종립 / Principle Enterprise Evangelist @베스핀글로벌
AWS 상의 컨테이너 서비스 소개 ECS, EKS - 이종립 / Principle Enterprise Evangelist @베스핀글로벌
 
AWS Elastic Beanstalk Tutorial | AWS Certification | AWS Tutorial | Edureka
AWS Elastic Beanstalk Tutorial | AWS Certification | AWS Tutorial | EdurekaAWS Elastic Beanstalk Tutorial | AWS Certification | AWS Tutorial | Edureka
AWS Elastic Beanstalk Tutorial | AWS Certification | AWS Tutorial | Edureka
 
Introduction to Docker Compose
Introduction to Docker ComposeIntroduction to Docker Compose
Introduction to Docker Compose
 
Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부Fargate 를 이용한 ECS with VPC 1부
Fargate 를 이용한 ECS with VPC 1부
 
(CMP201) All You Need To Know About Auto Scaling
(CMP201) All You Need To Know About Auto Scaling(CMP201) All You Need To Know About Auto Scaling
(CMP201) All You Need To Know About Auto Scaling
 
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
(DVO201) Scaling Your Web Applications with AWS Elastic Beanstalk
 
AWS CodeDeploy
AWS CodeDeployAWS CodeDeploy
AWS CodeDeploy
 
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
AWS Lambda와 API Gateway를 통한 Serverless Architecture 특집 (윤석찬)
 
Deploy, Scale and Manage your Application with AWS Elastic Beanstalk
Deploy, Scale and Manage your Application with AWS Elastic BeanstalkDeploy, Scale and Manage your Application with AWS Elastic Beanstalk
Deploy, Scale and Manage your Application with AWS Elastic Beanstalk
 
Kubernetes #1 intro
Kubernetes #1   introKubernetes #1   intro
Kubernetes #1 intro
 
k8s practice 2023.pptx
k8s practice 2023.pptxk8s practice 2023.pptx
k8s practice 2023.pptx
 
Intro to Amazon ECS
Intro to Amazon ECSIntro to Amazon ECS
Intro to Amazon ECS
 
DEV323_Introduction to the AWS CLI
DEV323_Introduction to the AWS CLIDEV323_Introduction to the AWS CLI
DEV323_Introduction to the AWS CLI
 
Deploy, Scale and Manage your Application with AWS Elastic Beanstalk
Deploy, Scale and Manage your Application with AWS Elastic BeanstalkDeploy, Scale and Manage your Application with AWS Elastic Beanstalk
Deploy, Scale and Manage your Application with AWS Elastic Beanstalk
 
AWS 6월 웨비나 | Amazon VPC Deep Dive (김상필 솔루션즈아키텍트)
AWS 6월 웨비나 | Amazon VPC Deep Dive (김상필 솔루션즈아키텍트)AWS 6월 웨비나 | Amazon VPC Deep Dive (김상필 솔루션즈아키텍트)
AWS 6월 웨비나 | Amazon VPC Deep Dive (김상필 솔루션즈아키텍트)
 
PUBG: Battlegrounds 라이브 서비스 EKS 전환 사례 공유 [크래프톤 - 레벨 300] - 발표자: 김정헌, PUBG Dev...
PUBG: Battlegrounds 라이브 서비스 EKS 전환 사례 공유 [크래프톤 - 레벨 300] - 발표자: 김정헌, PUBG Dev...PUBG: Battlegrounds 라이브 서비스 EKS 전환 사례 공유 [크래프톤 - 레벨 300] - 발표자: 김정헌, PUBG Dev...
PUBG: Battlegrounds 라이브 서비스 EKS 전환 사례 공유 [크래프톤 - 레벨 300] - 발표자: 김정헌, PUBG Dev...
 
AWS IAM과 친해지기 – 조이정, AWS 솔루션즈 아키텍트:: AWS Builders Online Series
AWS IAM과 친해지기 – 조이정, AWS 솔루션즈 아키텍트:: AWS Builders Online Series AWS IAM과 친해지기 – 조이정, AWS 솔루션즈 아키텍트:: AWS Builders Online Series
AWS IAM과 친해지기 – 조이정, AWS 솔루션즈 아키텍트:: AWS Builders Online Series
 
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
Cloud Migration 과 Modernization 을 위한 30가지 아이디어-박기흥, AWS Migrations Specialist...
 
CodeBuild CodePipeline CodeDeploy CodeCommit in AWS | Edureka
CodeBuild CodePipeline CodeDeploy CodeCommit in AWS | EdurekaCodeBuild CodePipeline CodeDeploy CodeCommit in AWS | Edureka
CodeBuild CodePipeline CodeDeploy CodeCommit in AWS | Edureka
 
Amazon Personalize Event Tracker 실시간 고객 반응을 고려한 추천::김태수, 솔루션즈 아키텍트, AWS::AWS ...
Amazon Personalize Event Tracker 실시간 고객 반응을 고려한 추천::김태수, 솔루션즈 아키텍트, AWS::AWS ...Amazon Personalize Event Tracker 실시간 고객 반응을 고려한 추천::김태수, 솔루션즈 아키텍트, AWS::AWS ...
Amazon Personalize Event Tracker 실시간 고객 반응을 고려한 추천::김태수, 솔루션즈 아키텍트, AWS::AWS ...
 

Similar a AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay Los Angeles 2017

基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻
Mason Mei
 

Similar a AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay Los Angeles 2017 (20)

Distribua, gerencie e escale suas aplicações com o aws elastic beanstalk
Distribua, gerencie e escale suas aplicações com o aws elastic beanstalkDistribua, gerencie e escale suas aplicações com o aws elastic beanstalk
Distribua, gerencie e escale suas aplicações com o aws elastic beanstalk
 
DevOps with Elastic Beanstalk - TCCC-2014
DevOps with Elastic Beanstalk - TCCC-2014DevOps with Elastic Beanstalk - TCCC-2014
DevOps with Elastic Beanstalk - TCCC-2014
 
AWS July Webinar Series-Deploying and Scaling Web Application with AWS Elasti...
AWS July Webinar Series-Deploying and Scaling Web Application with AWS Elasti...AWS July Webinar Series-Deploying and Scaling Web Application with AWS Elasti...
AWS July Webinar Series-Deploying and Scaling Web Application with AWS Elasti...
 
Aws elastic beanstalk
Aws elastic beanstalkAws elastic beanstalk
Aws elastic beanstalk
 
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
 
eCAP Developer Walkthru
eCAP Developer WalkthrueCAP Developer Walkthru
eCAP Developer Walkthru
 
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
 
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
(DEV302) Hosting ASP.Net 5 Apps in AWS with Docker & AWS CodeDeploy
 
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
AWS re:Invent 2016: Development Workflow with Docker and Amazon ECS (CON302)
 
Elastic beanstalk
Elastic beanstalkElastic beanstalk
Elastic beanstalk
 
基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻基于Aws的持续集成、交付和部署 代闻
基于Aws的持续集成、交付和部署 代闻
 
(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
 
AWS Elastic Beanstalk運作微服務與Docker
AWS Elastic Beanstalk運作微服務與Docker AWS Elastic Beanstalk運作微服務與Docker
AWS Elastic Beanstalk運作微服務與Docker
 
Running Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic BeanstalkRunning Microservices on AWS Elastic Beanstalk
Running Microservices on AWS Elastic Beanstalk
 
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
 
Continuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWSContinuous Integration and Deployment Best Practices on AWS
Continuous Integration and Deployment Best Practices on AWS
 
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
 
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
 
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
 
Scaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic BeanstalkScaling Django Apps using AWS Elastic Beanstalk
Scaling Django Apps using AWS Elastic Beanstalk
 

Más de Amazon 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 AWS
Amazon 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 Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon 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
 

Más de 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
 

AWS Elastic Beanstalk: Running Multi-Container Docker Applications - DevDay Los Angeles 2017

  • 1. © 2016, Amazon Web Services, Inc. or its Affiliates. All rights reserved. AWS Elastic Beanstalk (EB) Running Single and Multi-Container Docker applications Daniele Stroppa, Technical Account Manager October 10th, 2017
  • 2. Agenda • Overview • Elastic Beanstalk vs DIY • How to use Elastic Beanstalk • Single and Multi-Container Docker with AWS Elastic Beanstalk • Best Practices
  • 3. Developer challenges • Complexity of deploying code, provisioning and managing infrastructure • Expertise and time needed to manage and configure servers, databases, load balancers, firewalls, and networks • How to automate application scaling • Lack of consistency across teams
  • 4. What is Elastic Beanstalk? AWS Elastic Beanstalk is an easy-to-use service for deploying, scaling, and managing web applications and services.
  • 5. AWS Elastic Beanstalk vs. Do It Yourself Your code HTTP Server Application Server Language Interpreter Operating System Host Elastic Beanstalk configures each EC2 instance in your environment with the components necessary to run applications for the selected platform. Focus on building your application Provided by you Provided and managed by AWS Elastic Beanstalk (EB) On-instance configuration
  • 6. AWS Elastic Beanstalk vs. Do It Yourself • Preconfigured Infrastructure • Single Instance (Dev, Low Cost) • Load Balanced, Auto Scaling (Production) • Web & Worker tiers • Elastic Beanstalk provisions necessary infrastructure resources such as the load balancer, Auto Scaling group, security groups, database (optional), etc. • Provides a unique domain name for your application (e.g.: youapp.regionx.elasticbeanstalk.com) Infrastructure stack
  • 7. Elastic Beanstalk benefits Fast & simple to begin Developer productivity/agility Impossible to outgrow Complete resource control No additional charge to use Elastic Beanstalk. You pay only for underlying AWS resources (i.e., EC2 instances, S3, etc.)
  • 9. Getting started with Elastic Beanstalk:
  • 10. Information required to deploy application 01 02 03 04 Region Stack (container) type Single Instance Load Balanced with Auto ScalingOR Database (RDS) Your code Optional Supported Platforms Custom Platforms Create and use your own custom platform
  • 11. Building blocks Application Application Versions ( V1, V2, …,Vx) Environm ent 1 Environm ent 2 Environm ent .. n
  • 12. How to deploy applications 1. Via AWS Management Console 2. Via AWS Toolkit for Eclipse and Visual Studio IDE 3. Via AWS SDKs and CLI 4. Via EB command line interface $ eb deploy
  • 13. Deploy sample application (EB CLI) Initial application deployment workflow $ git clone https://github.com/awslabs/eb- node-express-sample.git Download sample application2 $ eb init Create your Elastic Beanstalk app3 Follow the prompts to configure the environment 4 5 Create the resources and launch the application $ eb create $ pip install --upgrade awsebcli Install the AWS Elastic Beanstalk command line interface (EB CLI) 1
  • 14. Demo
  • 15. Update sample application (EB CLI) Update application workflow Update your code1 $ git add . $ git commit –m “v2.0” $ eb deploy Add & commit code to repository2 Open application once deployment completes 3 $ eb open
  • 16. Docker with AWS Elastic Beanstalk
  • 17. Docker Platform Configurations • Single Container Docker • Multi-Container Docker
  • 18. Multi Container: Architecture • Each environment has its own ECS Cluster • Supports a single ECS Task definition per environment • The ECS Task is defined in the Dockerrun.aws.json file • Uses a flood scheduling mechanism • Provides out of the box auto scaling for ECS Tasks Elastic Beanstalk Environment Auto Scaling Group / ECS Cluster Instance 1 Instance 2 app1.elasticbeanstalk.com Elastic Load Balancing Container 2Container 1 Container 3 Container 2Container 1 Container 3
  • 19. Multi Container: Dockerrun.aws.json { "AWSEBDockerrunVersion": 2, "volumes": [ { "name": "node-app", "host": { "sourcePath": "/var/app/current/node-app" } }, { "name": "tomcat-app", "host": { "sourcePath": "/var/app/current/tomcat-app" } } ], "containerDefinitions": [ { "name": "node-app", "image": "node:0.12", "essential": true, "memory": 128, "portMappings": [ { "hostPort": 80, "containerPort": 8000 } ], "command": [ "/bin/bash", "/usr/src/app/run.sh" ], "mountPoints": [ { "sourceVolume": "node-app", "containerPath": "/usr/src/app" } ] }, { "name": "tomcat-app", "image": "tomcat:8.0", "essential": true, "memory": 256, "portMappings": [ { "hostPort": 8080, "containerPort": 8080 } ], "mountPoints": [ { "sourceVolume": "awseb-logs-tomcat-app", "containerPath": "/usr/local/tomcat/logs" }, { "sourceVolume": "tomcat-app", "containerPath": "/usr/local/tomcat/webapps/ROOT", "readOnly": true } ] } ] } Multi Container requires version 2
  • 20. Multi Container with Elastic Beanstalk Nginx Proxy Example Code at: https://github.com/awslabs/eb-docker-nginx-proxy
  • 21. Demo
  • 22. Multi Container with Elastic Beanstalk Multiple Ports Example Code at: https://github.com/awslabs/eb-docker-multiple-ports Elastic Beanstalk Environment Auto Scaling Group / ECS Cluster Instance 1 Instance 2 Node.js Node.js Tomcat 80 8080 Tomcat app1.elasticbeanstalk.com:80 app1.elasticbeanstalk.com:8080 Elastic Load Balancing
  • 23. Multi Container with Elastic Beanstalk Virtual Hosts Example Code at: https://github.com/awslabs/eb-docker-virtual-hosting Elastic Beanstalk Environment Auto Scaling Group / ECS Cluster Instance 1 Instance 2 80 Container 1 Container 2 Nginx Container 1 Container 2 Nginx container1.app1.elasticbeanstalk.com container2.app1.elasticbeanstalk.com Elastic Load Balancing
  • 24. Benefits of using Multi-Container Docker with Elastic Beanstalk • Automation of capacity provisioning, load balancing, scaling, and application health monitoring • One stop management of your application in an environment that supports range of services that are integrated with Elastic Beanstalk, including but not limited to VPC, RDS, and IAM.
  • 26. Deployment options * Default method ^ ”All at Once” Method used Environment Type Deployment category Method All at Once* Immutable (New) Disabled*^ Immutable (New) All at Once Rolling* Rolling with additional batch Immutable Disabled^ Rolling based on Health* Rolling based on Time Immutable Single Instance Load Balanced/Auto-Scaled Application Platform/Configuration Application Platform/Configuration
  • 27. Application deployment options Method Impact of failed deployment Deploy Time Zero Downtime No DNS Change Rollback process Code Deployed To All at Once¬ Downtime ¹ X ü Re-deploy Existing instances Rolling Single batch out of service. Any successful batches prior to failure running new application version ¹¹♦ ü ü Re-deploy Existing instances Rolling with additional batch Minimum if first batch fails, otherwise similar to Rolling ¹¹¹♦ ü ü Re-deploy New & existing instances Immutable¬ Minimal ¹¹¹¹ ü ü Re-deploy New instances Blue/Green Minimal ¹¹¹¹¹ ü X Swap URL New instances ¬ Options available for both Single Instance and Load Balanced/Auto-Scaled Environments ♦ Varies depending on instance batch size
  • 28. Managed Platform Update Configure your environment to automatically upgrade to the latest version of a platform during a scheduled maintenance window. • Permissions • Maintenance Window • Minor and Patch Updates Key benefits: • Automated Upgrades • No/Minimal downtime • No/Minimal impact on capacity • Flexibility of manual updates • Instance replacement
  • 29. Auto Scaling Min/Max instances Availability Zones Scaling cooldown Triggers based scaling Trigger measurement (CPU utilization, network traffic, disk activity, instance health) Trigger statistic Measurement period Breach duration Thresholds Breach scale increment Time-based scaling Name Min/Max instance Occurrence (One-time, Recurrent) Recurrence (CRON expression- 30 8 * * 3)
  • 30. Logs, Metrics, & Alarms • Enable log rotation to automatically publish logs to S3. • Set up alarms to automatically monitor critical metrics and send notifications when metrics are outside normal operating range. • Enable Amazon Route 53 health checks and alarms • CloudWatch Log streaming to stream logs in real time from Elastic Beanstalk managed EC2 instance to CloudWatch
  • 31. Other tips Tag your environments • Resource discoverability, cost monitoring, access control • Elastic Beanstalk automatically tags environments Application version lifecycle management: • Automate application version cleanup • Does not apply to deployed versions
  • 32. Custom Platform • Create and manage your own custom Elastic Beanstalk platforms • Get greater control over the AMI, metadata, and configuration • Enforce and manage standardization/best practices across environments (without the need for .ebextensions)
  • 33. Custom Platform Examples: • Create your own platforms on Ubuntu or Red Hat Enterprise • Customize your instances with languages/frameworks currently not supported by Elastic Beanstalk e.g. Rust, Sinatra etc. • Create your own platform that uses encrypted AMIs or custom disk layouts e.g. multiple volumes, EFS mounts etc.
  • 34. Custom Platform Creating a Custom Platform: • Uses Packer: an open-source tool for creating machine images • EB CLI, API, SDK • Platform Definition archive • Packer template (Platform name, base AMI) • Platform definition file: platform.yml (metadata: OS, language/framework) • Builder (runtime scripts, hooks, configuration) • EB CLI • eb platform init • eb platform create
  • 35. Custom Platform Using a Custom Platform in an environment: • AWS Management console, EB CLI, API, SDK • EB CLI: • eb init • select option “Custom Platform” for the question “select a platform” • eb create • Console:
  • 36. Custom Platform Feature control option_settings: # default environment variable - namespace: aws:elasticbeanstalk:application:environment option_name: MYENVPARAM value: "MyApplicationControl" # default autoscaling group attribute - namespace: aws:autoscaling:asg option_name: MinSize value: 2 - namespace: aws:autoscaling:asg option_name: MaxSize value: 8 # default autoscaling launch configuration attribute - namespace: aws:autoscaling:launchconfiguration option_name: InstanceType value: m3.large # default log streaming setting - namespace: aws:elasticbeanstalk:cloudwatch:logs option_name: StreamLogs value: true - namespace: aws:elasticbeanstalk:cloudwatch:logs option_name: DeleteOnTerminate value: false - namespace: aws:elasticbeanstalk:cloudwatch:logs option_name: RetentionInDays # default deployment preference - namespace: aws:elasticbeanstalk:command option_name: DeploymentPolicy value: Rolling - namespace: aws:elasticbeanstalk:command option_name: BatchSize value: 30 - namespace: aws:elasticbeanstalk:command option_name: BatchSizeType value: Percentage # default scaling setting - namespace: aws:autoscaling:trigger option_name: MeasureName value: CPUUtilization - namespace: aws:autoscaling:trigger option_name: Period value: 1 - namespace: aws:autoscaling:trigger option_name: Unit value: Percent - namespace: aws:autoscaling:trigger option_name: UpperThreshold value: 90 - namespace: aws:autoscaling:trigger option_name: LowerThreshold value: 35
  • 37. Questions? How to get in touch with the EB team? Forum: https://forums.aws.amazon.com/forum.jspa?forumID=86 Twitter @aws_eb