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

Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...OnePlan Solutions
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolsosttopstonverter
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Anthony Dahanne
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...Bert Jan Schrijver
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesKrzysztofKkol1
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorTier1 app
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profileakrivarotava
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldRoberto Pérez Alcolea
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 

Recently uploaded (20)

Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
Revolutionizing the Digital Transformation Office - Leveraging OnePlan’s AI a...
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
eSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration toolseSoftTools IMAP Backup Software and migration tools
eSoftTools IMAP Backup Software and migration tools
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024Not a Kubernetes fan? The state of PaaS in 2024
Not a Kubernetes fan? The state of PaaS in 2024
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
JavaLand 2024 - Going serverless with Quarkus GraalVM native images and AWS L...
 
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilitiesAmazon Bedrock in Action - presentation of the Bedrock's capabilities
Amazon Bedrock in Action - presentation of the Bedrock's capabilities
 
Effectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryErrorEffectively Troubleshoot 9 Types of OutOfMemoryError
Effectively Troubleshoot 9 Types of OutOfMemoryError
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
SoftTeco - Software Development Company Profile
SoftTeco - Software Development Company ProfileSoftTeco - Software Development Company Profile
SoftTeco - Software Development Company Profile
 
Keeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository worldKeeping your build tool updated in a multi repository world
Keeping your build tool updated in a multi repository world
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 

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