SlideShare a Scribd company logo
1 of 43
AWS Elastic Beanstalk In Depth
Vancouver Amazon Web Services User Group
Yaroslav Tkachenko
@sap1ens
Director of Engineering, Platform at Bench Accounting
AWS Elastic Beanstalk
Goals for today:
✓ You’ve been using EC2, ELBs, etc., but you don’t want to setup
anything manually anymore and CF is too complex*
✓ You want to run Docker in AWS*
✓ You’ve been using Elastic Beanstalk, but you have some issues
(who doesn’t?) you want to discuss
3
AWS Elastic Beanstalk
Agenda:
✓ Intro
✓ Details
✓ Our tooling
4
Section TitleAWS Elastic Beanstalk - Intro 5
AWS Elastic Beanstalk - Intro
Environment = Application(X, Y) | X <- Config, Y <- Version
6
AWS Elastic Beanstalk - Intro 7
AWS Elastic Beanstalk - Intro 8
AWS Elastic Beanstalk - Intro 9
AWS Elastic Beanstalk - Intro 10
AWS Elastic Beanstalk - Intro 11
AWS Elastic Beanstalk - Intro 12
AWS Elastic Beanstalk - Intro
aws elasticbeanstalk describe-environments
{
"Environments": [
{
"ApplicationName": "eventing",
"EnvironmentName": "prod-eventing",
"VersionLabel": "2016-10-06T01-47-06Z1-9c7d71b",
"Status": "Ready",
"Description": "prod-eventing",
"EnvironmentLinks": [],
"EnvironmentId": "e-xxxxxxxxxx",
"EndpointURL": "awseb-e-t-AWSEBLoa-XXXXXXXXXXXX-11111111.us-east-1.elb.amazonaws.com",
"SolutionStackName": "64bit Amazon Linux 2016.03 v2.1.6 running Multi-container Docker 1.11.2 (Generic)",
"CNAME": "prod-xxxxxxxxxx.elasticbeanstalk.com",
"Health": "Green",
"AbortableOperationInProgress": false,
"Tier": {
"Version": " ",
"Type": "Standard",
"Name": "WebServer"
},
"HealthStatus": "Ok",
"DateUpdated": "2016-10-11T01:44:22.012Z",
"DateCreated": "2016-01-23T23:28:46.050Z"
}
]
}
13
AWS Elastic Beanstalk - Intro
Every Elastic Beanstalk environment:
✓ EC2/ASG
✓ ELB
✓ CloudWatch
✓ S3
✓ …
14
AWS Elastic Beanstalk - Intro 15
AWS Elastic Beanstalk - Intro
Supported platforms:
✓ Single Container Docker
✓ Multicontainer Docker
✓ Preconfigured Docker
✓ Go
✓ Java SE
✓ Java with Tomcat
✓ .NET on Windows Server with IIS
✓ Node.js
✓ PHP
✓ Python
✓ Ruby
16
AWS Elastic Beanstalk - Intro 17
AWS Elastic Beanstalk - Intro 18
AWS Elastic Beanstalk - Intro
Deployment policies:
✓ All at once – Deploy the new version to all instances simultaneously.
All instances in your environment are out of service for a short time
while the deployment occurs.
✓ Rolling – Deploy the new version in batches. Each batch is taken out
of service during the deployment phase, reducing your environment's
capacity by the number of instances in a batch.
✓ Rolling with additional batch – Deploy the new version in batches,
but first launch a new batch of instances to ensure full capacity during
the deployment process.
✓ Immutable – Deploy the new version to a fresh group of instances by
performing an immutable update.
19
Section TitleAWS Elastic Beanstalk - Details 20
AWS Elastic Beanstalk - Details
We’re going to take a look at:
✓ Web Server environment type
✓ Multicontainer Docker platform
21
AWS Elastic Beanstalk - Details
There is no magic:
✓ CloudFormation template to rule them all
✓ You can see and modify (?) all resources separately: EC2
instances, ELBs, etc.
22
AWS Elastic Beanstalk - Details 23
AWS Elastic Beanstalk - Details
ECS is used for Docker platform:
24
AWS Elastic Beanstalk - Details
ECS is used for Docker platform:
25
AWS Elastic Beanstalk - Details
But EB != ECS:
✓ One EB environment always equals to one ECS cluster
✓ Every EC2 instance runs fixed configuration of Docker images,
usually 1…
✓ Which means utilization is not great
26
AWS Elastic Beanstalk - Details
ECS is used for Docker platform (Dockerrun.aws.json):
{
"AWSEBDockerrunVersion": 2,
"containerDefinitions": [{
"mountPoints": [],
"name": "service-name",
"image":
"DOCKER_REGISTRY/service/SERVICE_IMAGE:VE
RSION",
"portMappings": [{
"containerPort": 80,
"hostPort": 80
}],
"memory": "7000",
"essential": true
}],
"volumes": []
}
27
AWS Elastic Beanstalk - Details
VCS commit
Tests
Docker image
EB version
EB deployment
28
AWS Elastic Beanstalk - Details
So, deployment pipeline looks like:
✓ Build new Docker image, tag and push it
✓ Create Dockerrun.aws.json, containing new Docker image
✓ $ aws s3 cp artifact.zip s3://BUCKET/SERVICE/VERSION.zip
✓ $ aws elasticbeanstalk create-application-version --application-
name SERVICE --version-label VERSION --source-bundle
S3Bucket=BUCKET,S3Key=SERVICE/VERSION.zip
✓ $ aws elasticbeanstalk update-environment --environment-name
SERVICE_ENV --version-label VERSION
29
AWS Elastic Beanstalk - Details
Someone said “push Docker image”? Use ECR (EC2 Container
Registry)!
30
AWS Elastic Beanstalk - Details
$ mkdir HelloWorld
$ cd HelloWorld
$ eb init -p PHP
$ echo "Hello World" > index.html
$ eb create dev-env
$ eb open
$ eb deploy
31
AWS Elastic Beanstalk - Details
.ebextensions is a secret weapon:
✓ Packages
✓ Groups
✓ Users
✓ Sources
✓ Files
✓ Commands
✓ Services
✓ Container Commands
32
AWS Elastic Beanstalk - Details
Files Container commands
And Any AWS
Resource!
files:
"/home/ec2-user/myfile" :
mode: "000755"
owner: root
group: root
source: http://foo.bar/myfile
"/home/ec2-user/myfile2" :
mode: "000755"
owner: root
group: root
content: |
# this is my file
# with content
container_commands:
collectstatic:
command: "django-admin.py collectstatic --noinput"
01syncdb:
command: "django-admin.py syncdb --noinput"
leader_only: true
02migrate:
command: "django-admin.py migrate"
leader_only: true
99customize:
command: "scripts/customize.sh"
Resources:
AWSEBLoadBalancer:
Type:
"AWS::ElasticLoadBalancing::LoadBalancer"
Properties:
AccessLoggingPolicy:
S3BucketName: logs
S3BucketPrefix: elb-logs/SERVICE
Enabled: true
EmitInterval: 60
33
AWS Elastic Beanstalk - Details
"Resources": {
"EventingService": {
"Type" : "AWS::ElasticBeanstalk::Environment",
"Properties": {
"ApplicationName": "eventing",
"EnvironmentName": { "Fn::Join": ["", [ { "Ref": "EnvPrefix" }, "-eventing" ] ] },
"TemplateName": { "Ref": "EventingConfig" },
"OptionSettings": [
{
"Namespace": "aws:elasticbeanstalk:application:environment",
"OptionName": "EB_MICROSERVICE",
"Value": "true"
},
{
"Namespace": "aws:elasticbeanstalk:application:environment",
"OptionName": "ENV_VAR",
"Value": {"Ref" : "EnvValue"}
}
],
"VersionLabel": { "Ref": "EventingVersion" },
"Tier" : {
"Type" : "Standard",
"Name" : "WebServer"
}
}
}
}
34
AWS Elastic Beanstalk - Details
Best practices and things to notice:
✓ Use environment variables as much as you can
✓ Staging/prod environments should be as close as possible,
obviously use the same Docker image everywhere
✓ Think about restricting access early
✓ Health status is not always correct and it’s definitely not real-time
✓ Not all errors are recovered automatically. Sometimes you have
to recreate environment from scratch*
3535
Section TitleAWS Elastic Beanstalk - Our tooling 36
https://github.com/BenchLabs/eb-tools
AWS Elastic Beanstalk - Our tooling
✓ eb-artifacts
✓ eb-envconf
✓ eb-environments
✓ eb-notifications
37
AWS Elastic Beanstalk - Our tooling
usage: eb-artifacts.py [-h] --name NAME --version VERSION
[--container-port CONTAINER_PORT]
[--port-mappings [PORT_MAPPINGS [PORT_MAPPINGS ...]]]
[--mount-points [MOUNT_POINTS [MOUNT_POINTS ...]]]
[--log-path LOG_PATH] [--memory MEMORY]
[--registry REGISTRY] [--templates TEMPLATES]
[--extensions-filter EXTENSIONS_FILTER]
[--output OUTPUT]
38
AWS Elastic Beanstalk - Our tooling
usage: eb-envconf.py [-h] [-p PREFIXES] [-t TEMPLATE] [-i INSTANCE_TYPE]
[-k KEY_NAME] [-e ENV_VARS]
applications [applications ...]
39
AWS Elastic Beanstalk - Our tooling
usage: eb-environments.sh [arg...]
You can pass in one of the following options:
--list List all applications and environments, their health and other status.
--events List all events for every applications and environments.
--status APPLICATION ENVIRONMENT Get environment status and health.
--ready-and-green APPLICATION ENVIRONMENT Wait for environment to be green and ready.
--is-online APPLICATION ENVIRONMENT Wait for environment's actual heartbeat endpoint to be alive.
--ready-and-online APPLICATION ENVIRONMENT Wait for environment to be green, ready and actual heartbeat endpoint to be alive.
--help Print this help message.
40
AWS Elastic Beanstalk - Our tooling 41
AWS Elastic Beanstalk - Conclusion
✓ EB gives you first-class Docker support
✓ EB is not similar to Kubernetes/Mesos despite of using ECS
internally
✓ EB seamlessly integrates with other AWS tools
✓ EB is the easiest way to quickly get auto-scaled, load-balanced
and monitored application with almost zero work in AWS. At the
same time, every component is customizable when needed
42
Questions?
sap1ens.com
@sap1ens
43

More Related Content

Viewers also liked

Introducing AWS Elastic Beanstalk
Introducing AWS Elastic BeanstalkIntroducing AWS Elastic Beanstalk
Introducing AWS Elastic BeanstalkAmazon Web Services
 
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...Amazon Web Services
 
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
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Amazon Web Services
 
Ultimate Guide to 30+ API Documentation Solutions
Ultimate Guide to 30+ API Documentation SolutionsUltimate Guide to 30+ API Documentation Solutions
Ultimate Guide to 30+ API Documentation SolutionsBill Doerrfeld
 
Webcast: Pragmatic REST: The Next Generation
Webcast: Pragmatic REST: The Next GenerationWebcast: Pragmatic REST: The Next Generation
Webcast: Pragmatic REST: The Next GenerationApigee | Google Cloud
 
Lessons & Use-Cases at Scale - Dr. Pete Stanski
Lessons & Use-Cases at Scale - Dr. Pete StanskiLessons & Use-Cases at Scale - Dr. Pete Stanski
Lessons & Use-Cases at Scale - Dr. Pete StanskiAmazon Web Services
 
Build Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSBuild Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSMitoc Group
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsJonas Bonér
 
Build a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersBuild a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersAmazon Web Services
 
Modern data architectures for real time analytics and engagement
Modern data architectures for real time analytics and engagementModern data architectures for real time analytics and engagement
Modern data architectures for real time analytics and engagementAmazon Web Services
 
Introduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web ServicesIntroduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web ServicesAmazon Web Services
 
Real-time Data Processing using AWS Lambda
Real-time Data Processing using AWS LambdaReal-time Data Processing using AWS Lambda
Real-time Data Processing using AWS LambdaAmazon Web Services
 
Introduction to AWS Step Functions:
Introduction to AWS Step Functions: Introduction to AWS Step Functions:
Introduction to AWS Step Functions: Amazon Web Services
 
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureAmazon Web Services
 

Viewers also liked (17)

Introducing AWS Elastic Beanstalk
Introducing AWS Elastic BeanstalkIntroducing AWS Elastic Beanstalk
Introducing AWS Elastic Beanstalk
 
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...
AWS re:Invent 2016: Scaling Your Web Applications with AWS Elastic Beanstalk ...
 
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
 
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
Running Microservices and Docker on AWS Elastic Beanstalk - August 2016 Month...
 
Ultimate Guide to 30+ API Documentation Solutions
Ultimate Guide to 30+ API Documentation SolutionsUltimate Guide to 30+ API Documentation Solutions
Ultimate Guide to 30+ API Documentation Solutions
 
Webcast: Pragmatic REST: The Next Generation
Webcast: Pragmatic REST: The Next GenerationWebcast: Pragmatic REST: The Next Generation
Webcast: Pragmatic REST: The Next Generation
 
Lessons & Use-Cases at Scale - Dr. Pete Stanski
Lessons & Use-Cases at Scale - Dr. Pete StanskiLessons & Use-Cases at Scale - Dr. Pete Stanski
Lessons & Use-Cases at Scale - Dr. Pete Stanski
 
Build Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWSBuild Web Applications using Microservices on Node.js and Serverless AWS
Build Web Applications using Microservices on Node.js and Serverless AWS
 
Scalability, Availability & Stability Patterns
Scalability, Availability & Stability PatternsScalability, Availability & Stability Patterns
Scalability, Availability & Stability Patterns
 
Build a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million UsersBuild a Website on AWS for Your First 10 Million Users
Build a Website on AWS for Your First 10 Million Users
 
Modern data architectures for real time analytics and engagement
Modern data architectures for real time analytics and engagementModern data architectures for real time analytics and engagement
Modern data architectures for real time analytics and engagement
 
Operating your Production API
Operating your Production APIOperating your Production API
Operating your Production API
 
What's New with AWS Lambda
What's New with AWS LambdaWhat's New with AWS Lambda
What's New with AWS Lambda
 
Introduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web ServicesIntroduction to Cloud Computing with Amazon Web Services
Introduction to Cloud Computing with Amazon Web Services
 
Real-time Data Processing using AWS Lambda
Real-time Data Processing using AWS LambdaReal-time Data Processing using AWS Lambda
Real-time Data Processing using AWS Lambda
 
Introduction to AWS Step Functions:
Introduction to AWS Step Functions: Introduction to AWS Step Functions:
Introduction to AWS Step Functions:
 
A Brief Look at Serverless Architecture
A Brief Look at Serverless ArchitectureA Brief Look at Serverless Architecture
A Brief Look at Serverless Architecture
 

More from Yaroslav Tkachenko

Dynamic Change Data Capture with Flink CDC and Consistent Hashing
Dynamic Change Data Capture with Flink CDC and Consistent HashingDynamic Change Data Capture with Flink CDC and Consistent Hashing
Dynamic Change Data Capture with Flink CDC and Consistent HashingYaroslav Tkachenko
 
Streaming SQL for Data Engineers: The Next Big Thing?
Streaming SQL for Data Engineers: The Next Big Thing?Streaming SQL for Data Engineers: The Next Big Thing?
Streaming SQL for Data Engineers: The Next Big Thing?Yaroslav Tkachenko
 
Apache Flink Adoption at Shopify
Apache Flink Adoption at ShopifyApache Flink Adoption at Shopify
Apache Flink Adoption at ShopifyYaroslav Tkachenko
 
Storing State Forever: Why It Can Be Good For Your Analytics
Storing State Forever: Why It Can Be Good For Your AnalyticsStoring State Forever: Why It Can Be Good For Your Analytics
Storing State Forever: Why It Can Be Good For Your AnalyticsYaroslav Tkachenko
 
It's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda ArchitectureIt's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda ArchitectureYaroslav Tkachenko
 
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streaming
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to StreamingBravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streaming
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to StreamingYaroslav Tkachenko
 
Apache Kafka: New Features That You Might Not Know About
Apache Kafka: New Features That You Might Not Know AboutApache Kafka: New Features That You Might Not Know About
Apache Kafka: New Features That You Might Not Know AboutYaroslav Tkachenko
 
Building Scalable and Extendable Data Pipeline for Call of Duty Games: Lesson...
Building Scalable and Extendable Data Pipeline for Call of Duty Games: Lesson...Building Scalable and Extendable Data Pipeline for Call of Duty Games: Lesson...
Building Scalable and Extendable Data Pipeline for Call of Duty Games: Lesson...Yaroslav Tkachenko
 
Designing Scalable and Extendable Data Pipeline for Call Of Duty Games
Designing Scalable and Extendable Data Pipeline for Call Of Duty GamesDesigning Scalable and Extendable Data Pipeline for Call Of Duty Games
Designing Scalable and Extendable Data Pipeline for Call Of Duty GamesYaroslav Tkachenko
 
10 tips for making Bash a sane programming language
10 tips for making Bash a sane programming language10 tips for making Bash a sane programming language
10 tips for making Bash a sane programming languageYaroslav Tkachenko
 
Actors or Not: Async Event Architectures
Actors or Not: Async Event ArchitecturesActors or Not: Async Event Architectures
Actors or Not: Async Event ArchitecturesYaroslav Tkachenko
 
Kafka Streams: the easiest way to start with stream processing
Kafka Streams: the easiest way to start with stream processingKafka Streams: the easiest way to start with stream processing
Kafka Streams: the easiest way to start with stream processingYaroslav Tkachenko
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With AkkaYaroslav Tkachenko
 
Querying Data Pipeline with AWS Athena
Querying Data Pipeline with AWS AthenaQuerying Data Pipeline with AWS Athena
Querying Data Pipeline with AWS AthenaYaroslav Tkachenko
 
Akka Microservices Architecture And Design
Akka Microservices Architecture And DesignAkka Microservices Architecture And Design
Akka Microservices Architecture And DesignYaroslav Tkachenko
 
Why Actor-Based Systems Are The Best For Microservices
Why Actor-Based Systems Are The Best For MicroservicesWhy Actor-Based Systems Are The Best For Microservices
Why Actor-Based Systems Are The Best For MicroservicesYaroslav Tkachenko
 
Быстрая и безболезненная разработка клиентской части веб-приложений
Быстрая и безболезненная разработка клиентской части веб-приложенийБыстрая и безболезненная разработка клиентской части веб-приложений
Быстрая и безболезненная разработка клиентской части веб-приложенийYaroslav Tkachenko
 

More from Yaroslav Tkachenko (17)

Dynamic Change Data Capture with Flink CDC and Consistent Hashing
Dynamic Change Data Capture with Flink CDC and Consistent HashingDynamic Change Data Capture with Flink CDC and Consistent Hashing
Dynamic Change Data Capture with Flink CDC and Consistent Hashing
 
Streaming SQL for Data Engineers: The Next Big Thing?
Streaming SQL for Data Engineers: The Next Big Thing?Streaming SQL for Data Engineers: The Next Big Thing?
Streaming SQL for Data Engineers: The Next Big Thing?
 
Apache Flink Adoption at Shopify
Apache Flink Adoption at ShopifyApache Flink Adoption at Shopify
Apache Flink Adoption at Shopify
 
Storing State Forever: Why It Can Be Good For Your Analytics
Storing State Forever: Why It Can Be Good For Your AnalyticsStoring State Forever: Why It Can Be Good For Your Analytics
Storing State Forever: Why It Can Be Good For Your Analytics
 
It's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda ArchitectureIt's Time To Stop Using Lambda Architecture
It's Time To Stop Using Lambda Architecture
 
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streaming
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to StreamingBravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streaming
Bravo Six, Going Realtime. Transitioning Activision Data Pipeline to Streaming
 
Apache Kafka: New Features That You Might Not Know About
Apache Kafka: New Features That You Might Not Know AboutApache Kafka: New Features That You Might Not Know About
Apache Kafka: New Features That You Might Not Know About
 
Building Scalable and Extendable Data Pipeline for Call of Duty Games: Lesson...
Building Scalable and Extendable Data Pipeline for Call of Duty Games: Lesson...Building Scalable and Extendable Data Pipeline for Call of Duty Games: Lesson...
Building Scalable and Extendable Data Pipeline for Call of Duty Games: Lesson...
 
Designing Scalable and Extendable Data Pipeline for Call Of Duty Games
Designing Scalable and Extendable Data Pipeline for Call Of Duty GamesDesigning Scalable and Extendable Data Pipeline for Call Of Duty Games
Designing Scalable and Extendable Data Pipeline for Call Of Duty Games
 
10 tips for making Bash a sane programming language
10 tips for making Bash a sane programming language10 tips for making Bash a sane programming language
10 tips for making Bash a sane programming language
 
Actors or Not: Async Event Architectures
Actors or Not: Async Event ArchitecturesActors or Not: Async Event Architectures
Actors or Not: Async Event Architectures
 
Kafka Streams: the easiest way to start with stream processing
Kafka Streams: the easiest way to start with stream processingKafka Streams: the easiest way to start with stream processing
Kafka Streams: the easiest way to start with stream processing
 
Building Stateful Microservices With Akka
Building Stateful Microservices With AkkaBuilding Stateful Microservices With Akka
Building Stateful Microservices With Akka
 
Querying Data Pipeline with AWS Athena
Querying Data Pipeline with AWS AthenaQuerying Data Pipeline with AWS Athena
Querying Data Pipeline with AWS Athena
 
Akka Microservices Architecture And Design
Akka Microservices Architecture And DesignAkka Microservices Architecture And Design
Akka Microservices Architecture And Design
 
Why Actor-Based Systems Are The Best For Microservices
Why Actor-Based Systems Are The Best For MicroservicesWhy Actor-Based Systems Are The Best For Microservices
Why Actor-Based Systems Are The Best For Microservices
 
Быстрая и безболезненная разработка клиентской части веб-приложений
Быстрая и безболезненная разработка клиентской части веб-приложенийБыстрая и безболезненная разработка клиентской части веб-приложений
Быстрая и безболезненная разработка клиентской части веб-приложений
 

Recently uploaded

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningVitsRangannavar
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software DevelopersVinodh Ram
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutionsmonugehlot87
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 

Recently uploaded (20)

Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
cybersecurity notes for mca students for learning
cybersecurity notes for mca students for learningcybersecurity notes for mca students for learning
cybersecurity notes for mca students for learning
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Professional Resume Template for Software Developers
Professional Resume Template for Software DevelopersProfessional Resume Template for Software Developers
Professional Resume Template for Software Developers
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
buds n tech IT solutions
buds n  tech IT                solutionsbuds n  tech IT                solutions
buds n tech IT solutions
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

AWS Elastic Beanstalk In Depth

  • 1. AWS Elastic Beanstalk In Depth Vancouver Amazon Web Services User Group Yaroslav Tkachenko @sap1ens Director of Engineering, Platform at Bench Accounting
  • 2.
  • 3. AWS Elastic Beanstalk Goals for today: ✓ You’ve been using EC2, ELBs, etc., but you don’t want to setup anything manually anymore and CF is too complex* ✓ You want to run Docker in AWS* ✓ You’ve been using Elastic Beanstalk, but you have some issues (who doesn’t?) you want to discuss 3
  • 4. AWS Elastic Beanstalk Agenda: ✓ Intro ✓ Details ✓ Our tooling 4
  • 5. Section TitleAWS Elastic Beanstalk - Intro 5
  • 6. AWS Elastic Beanstalk - Intro Environment = Application(X, Y) | X <- Config, Y <- Version 6
  • 10. AWS Elastic Beanstalk - Intro 10
  • 11. AWS Elastic Beanstalk - Intro 11
  • 12. AWS Elastic Beanstalk - Intro 12
  • 13. AWS Elastic Beanstalk - Intro aws elasticbeanstalk describe-environments { "Environments": [ { "ApplicationName": "eventing", "EnvironmentName": "prod-eventing", "VersionLabel": "2016-10-06T01-47-06Z1-9c7d71b", "Status": "Ready", "Description": "prod-eventing", "EnvironmentLinks": [], "EnvironmentId": "e-xxxxxxxxxx", "EndpointURL": "awseb-e-t-AWSEBLoa-XXXXXXXXXXXX-11111111.us-east-1.elb.amazonaws.com", "SolutionStackName": "64bit Amazon Linux 2016.03 v2.1.6 running Multi-container Docker 1.11.2 (Generic)", "CNAME": "prod-xxxxxxxxxx.elasticbeanstalk.com", "Health": "Green", "AbortableOperationInProgress": false, "Tier": { "Version": " ", "Type": "Standard", "Name": "WebServer" }, "HealthStatus": "Ok", "DateUpdated": "2016-10-11T01:44:22.012Z", "DateCreated": "2016-01-23T23:28:46.050Z" } ] } 13
  • 14. AWS Elastic Beanstalk - Intro Every Elastic Beanstalk environment: ✓ EC2/ASG ✓ ELB ✓ CloudWatch ✓ S3 ✓ … 14
  • 15. AWS Elastic Beanstalk - Intro 15
  • 16. AWS Elastic Beanstalk - Intro Supported platforms: ✓ Single Container Docker ✓ Multicontainer Docker ✓ Preconfigured Docker ✓ Go ✓ Java SE ✓ Java with Tomcat ✓ .NET on Windows Server with IIS ✓ Node.js ✓ PHP ✓ Python ✓ Ruby 16
  • 17. AWS Elastic Beanstalk - Intro 17
  • 18. AWS Elastic Beanstalk - Intro 18
  • 19. AWS Elastic Beanstalk - Intro Deployment policies: ✓ All at once – Deploy the new version to all instances simultaneously. All instances in your environment are out of service for a short time while the deployment occurs. ✓ Rolling – Deploy the new version in batches. Each batch is taken out of service during the deployment phase, reducing your environment's capacity by the number of instances in a batch. ✓ Rolling with additional batch – Deploy the new version in batches, but first launch a new batch of instances to ensure full capacity during the deployment process. ✓ Immutable – Deploy the new version to a fresh group of instances by performing an immutable update. 19
  • 20. Section TitleAWS Elastic Beanstalk - Details 20
  • 21. AWS Elastic Beanstalk - Details We’re going to take a look at: ✓ Web Server environment type ✓ Multicontainer Docker platform 21
  • 22. AWS Elastic Beanstalk - Details There is no magic: ✓ CloudFormation template to rule them all ✓ You can see and modify (?) all resources separately: EC2 instances, ELBs, etc. 22
  • 23. AWS Elastic Beanstalk - Details 23
  • 24. AWS Elastic Beanstalk - Details ECS is used for Docker platform: 24
  • 25. AWS Elastic Beanstalk - Details ECS is used for Docker platform: 25
  • 26. AWS Elastic Beanstalk - Details But EB != ECS: ✓ One EB environment always equals to one ECS cluster ✓ Every EC2 instance runs fixed configuration of Docker images, usually 1… ✓ Which means utilization is not great 26
  • 27. AWS Elastic Beanstalk - Details ECS is used for Docker platform (Dockerrun.aws.json): { "AWSEBDockerrunVersion": 2, "containerDefinitions": [{ "mountPoints": [], "name": "service-name", "image": "DOCKER_REGISTRY/service/SERVICE_IMAGE:VE RSION", "portMappings": [{ "containerPort": 80, "hostPort": 80 }], "memory": "7000", "essential": true }], "volumes": [] } 27
  • 28. AWS Elastic Beanstalk - Details VCS commit Tests Docker image EB version EB deployment 28
  • 29. AWS Elastic Beanstalk - Details So, deployment pipeline looks like: ✓ Build new Docker image, tag and push it ✓ Create Dockerrun.aws.json, containing new Docker image ✓ $ aws s3 cp artifact.zip s3://BUCKET/SERVICE/VERSION.zip ✓ $ aws elasticbeanstalk create-application-version --application- name SERVICE --version-label VERSION --source-bundle S3Bucket=BUCKET,S3Key=SERVICE/VERSION.zip ✓ $ aws elasticbeanstalk update-environment --environment-name SERVICE_ENV --version-label VERSION 29
  • 30. AWS Elastic Beanstalk - Details Someone said “push Docker image”? Use ECR (EC2 Container Registry)! 30
  • 31. AWS Elastic Beanstalk - Details $ mkdir HelloWorld $ cd HelloWorld $ eb init -p PHP $ echo "Hello World" > index.html $ eb create dev-env $ eb open $ eb deploy 31
  • 32. AWS Elastic Beanstalk - Details .ebextensions is a secret weapon: ✓ Packages ✓ Groups ✓ Users ✓ Sources ✓ Files ✓ Commands ✓ Services ✓ Container Commands 32
  • 33. AWS Elastic Beanstalk - Details Files Container commands And Any AWS Resource! files: "/home/ec2-user/myfile" : mode: "000755" owner: root group: root source: http://foo.bar/myfile "/home/ec2-user/myfile2" : mode: "000755" owner: root group: root content: | # this is my file # with content container_commands: collectstatic: command: "django-admin.py collectstatic --noinput" 01syncdb: command: "django-admin.py syncdb --noinput" leader_only: true 02migrate: command: "django-admin.py migrate" leader_only: true 99customize: command: "scripts/customize.sh" Resources: AWSEBLoadBalancer: Type: "AWS::ElasticLoadBalancing::LoadBalancer" Properties: AccessLoggingPolicy: S3BucketName: logs S3BucketPrefix: elb-logs/SERVICE Enabled: true EmitInterval: 60 33
  • 34. AWS Elastic Beanstalk - Details "Resources": { "EventingService": { "Type" : "AWS::ElasticBeanstalk::Environment", "Properties": { "ApplicationName": "eventing", "EnvironmentName": { "Fn::Join": ["", [ { "Ref": "EnvPrefix" }, "-eventing" ] ] }, "TemplateName": { "Ref": "EventingConfig" }, "OptionSettings": [ { "Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "EB_MICROSERVICE", "Value": "true" }, { "Namespace": "aws:elasticbeanstalk:application:environment", "OptionName": "ENV_VAR", "Value": {"Ref" : "EnvValue"} } ], "VersionLabel": { "Ref": "EventingVersion" }, "Tier" : { "Type" : "Standard", "Name" : "WebServer" } } } } 34
  • 35. AWS Elastic Beanstalk - Details Best practices and things to notice: ✓ Use environment variables as much as you can ✓ Staging/prod environments should be as close as possible, obviously use the same Docker image everywhere ✓ Think about restricting access early ✓ Health status is not always correct and it’s definitely not real-time ✓ Not all errors are recovered automatically. Sometimes you have to recreate environment from scratch* 3535
  • 36. Section TitleAWS Elastic Beanstalk - Our tooling 36
  • 37. https://github.com/BenchLabs/eb-tools AWS Elastic Beanstalk - Our tooling ✓ eb-artifacts ✓ eb-envconf ✓ eb-environments ✓ eb-notifications 37
  • 38. AWS Elastic Beanstalk - Our tooling usage: eb-artifacts.py [-h] --name NAME --version VERSION [--container-port CONTAINER_PORT] [--port-mappings [PORT_MAPPINGS [PORT_MAPPINGS ...]]] [--mount-points [MOUNT_POINTS [MOUNT_POINTS ...]]] [--log-path LOG_PATH] [--memory MEMORY] [--registry REGISTRY] [--templates TEMPLATES] [--extensions-filter EXTENSIONS_FILTER] [--output OUTPUT] 38
  • 39. AWS Elastic Beanstalk - Our tooling usage: eb-envconf.py [-h] [-p PREFIXES] [-t TEMPLATE] [-i INSTANCE_TYPE] [-k KEY_NAME] [-e ENV_VARS] applications [applications ...] 39
  • 40. AWS Elastic Beanstalk - Our tooling usage: eb-environments.sh [arg...] You can pass in one of the following options: --list List all applications and environments, their health and other status. --events List all events for every applications and environments. --status APPLICATION ENVIRONMENT Get environment status and health. --ready-and-green APPLICATION ENVIRONMENT Wait for environment to be green and ready. --is-online APPLICATION ENVIRONMENT Wait for environment's actual heartbeat endpoint to be alive. --ready-and-online APPLICATION ENVIRONMENT Wait for environment to be green, ready and actual heartbeat endpoint to be alive. --help Print this help message. 40
  • 41. AWS Elastic Beanstalk - Our tooling 41
  • 42. AWS Elastic Beanstalk - Conclusion ✓ EB gives you first-class Docker support ✓ EB is not similar to Kubernetes/Mesos despite of using ECS internally ✓ EB seamlessly integrates with other AWS tools ✓ EB is the easiest way to quickly get auto-scaled, load-balanced and monitored application with almost zero work in AWS. At the same time, every component is customizable when needed 42