AWS Elastic Beanstalk provides an easy way for you to quickly deploy, manage, and scale applications in the AWS cloud. Through interactive demos and code samples, this session will teach you how to deploy your code to Elastic Beanstalk, provision and use additional AWS resources (for example, Amazon SNS, Amazon SQS, and Amazon DynamoDB), use your application’s health metrics to tune performance, scale your application to handle millions of requests, and perform zero-downtime deployments with traffic routing. Demos and code samples will be available to all session attendees.
2. Agenda
• AWS Elastic Beanstalk (Elastic Beanstalk) vs. DIY
• Developer workflow (sample application)
• Demo
• Best practices
• Demo
• Customer story
3. After this session, you should be able to:
• Understand the benefits of using Elastic Beanstalk vs. DIY
• Deploy applications to Elastic Beanstalk using the EB command line interface (EB
CLI)
• Modify application configuration (e.g., environment variables, proxy, etc.)
• Extend applications to use additional AWS resources (e.g., Amazon RDS, Amazon
SNS, etc.)
• Debug, load test, and scale applications to handle millions of web requests
• Use deployment options available for zero-downtime deployments:
• Rolling deployments (in-place deployments)
• Swap URL (blue/green deployments)
• Set up alarms and notifications to monitor your running applications
• Use tags for cost management
4. Elastic Beanstalk vs. DIY
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. No more worrying
about logging into instances to
install and configure your
application stack.
Focus on building your
application
Provided by you
Provided and managed by Elastic Beanstalk
On-instance configuration
5. Elastic Beanstalk vs. DIY
• Preconfigured infrastructure:
• Single-instance (dev, low cost)
• Load-balanced, Auto Scaling (production)
• Web and 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., yourapp.elasticbeanstalk.com)
Infrastructure stack
6. Information required to deploy an application
01
02
03
04
Region
Stack (container) type
Single-instance
Load balanced with
autoscaling
Or
Database (RDS) Optional
Your code
Supported platforms
7. How to deploy applications
1. With the AWS Management Console
2. With the AWS Toolkit for Eclipse and Visual
Studio IDE
3. With the EB command line interface (EB
CLI)
$ eb deploy
8. Deploy a sample application
Initial application deployment workflow:
$ git clone
https://github.com/awslabs/eb-
node-express-sample.git
Download the sample application:02
$ eb init
Create your Elastic Beanstalk app:03
Follow the prompts to configure the
environment
04
05 Create the resources and launch the
application:
$ eb create
$ pip install --upgrade awsebcli
Install the EB CLI:01
9. Update the sample application
Workflow for updating the application:
Update your code01
$ git add .
$ git commit –m “v2.0”
$ eb deploy
Add and commit code to repository:02
Open the application after
deployment completes:
03
$ eb open
15. Sample application details
How to configure and customize an environment using .ebextensions
https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
22. Testing and tuning your application
• Pick performance metrics you want to optimize for (e.g., latency, concurrent
users, number of web requests, etc.)
• Load test your application:
• Start with autoscaling minimum and maximum of 1 to understand how your application
degrades under an overload condition
• Understand available metrics and how they correspond to your performance metric
• Configure autoscaling to optimize for performance metrics:
• Number of instances to add on scale out
• Breach duration
• Metric to scale on
• Tune the back end (DynamoDB, RDS, etc.) for optimal performance; leave
enough headroom for full scale out
23. Deployment option (rolling)
Pros:
• Deployments are fast (20-60 sec.)
Cons:
• Slower rollback because the previous application version must be
redeployed
• Possibility of state build-up on long-running environments
24. Deployment option (blue/green)
Pros:
• Fast rollback because the environment running the previous version has not
been modified in any way
• Ensures no state build up on environments
Cons:
• Deployments take longer than rolling deployments (2-5 min.) because a
new environment must be created
• Clients (i.e., mobile devices) might cache DNS addresses and not respect
DNS TTL, resulting in staggered/non-deterministic traffic rollover to the new
environment
25. Logs, metrics, and alarms
• Enable log rotation to automatically publish logs to Amazon S3
• Understand metrics available for your environment and what they mean
• 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
26. Tag your environments
• Makes it easy to find resources belonging to a given environment
• Can be used to monitor costs associated with a given environment, or
application, or both
• Elastic Beanstalk automatically tags environments with:
• Environment name
• Environment ID
29. Royal Caribbean Cruises Ltd.
• Operates 43 ships with 6 more under construction
contract and 2 more on firm order under 6 brands
• Services 490 destinations on all 7 continents
• 9,000 HTML pages served from the Royal Caribbean
site alone
• royalcaribbean.com launched using Elastic Beanstalk
in March 2015
• 100 mm monthly page views during peak season
• 6 mm monthly unique visitors during peak season
• 40 mm page-view surge above average during peak
30. Historical challenges
• On-premises:
• High demand for limited development and test environments
• Procurement dependencies, hardware failures, low
resilience, fixed scale, high operational cost
• Cloud Infrastructure as a Service (IaaS vs PaaS):
• Learning curve and retooling is costly and time consuming:
• It’s more complicated than a collection of cloud servers
• Architecting an enterprise-grade stack requires many
components working in concert:
• Networking, security, provisioning, deployment mechanisms,
configuration management, load balancing, autoscaling, fault
tolerance and recovery, and monitoring
31. The case for Elastic Beanstalk
• Elastic Beanstalk ̶ a key component of continuous delivery:
• Reduces the cost, time, and risk of delivering regular, incremental value to users
• Lower IT burden during and after delivery:
• Mostly self-serve environments (dev, test, perf)
• Automated provisioning, scaling, healing
• Single pane of glass for managing the stack (Elastic Load Balancing, Amazon EC2,
Auto Scaling, Amazon CloudWatch)
• Environments just work…it’s very stable
• Zero-downtime production deployments are fast and reliable
• Technology enablement:
• Empowers the Marketing team
• Provides visibility into environments, health, performance, KPIs
• Provides the ability to easily create and manage own environments for multiple
projects and tracks
32. Environments on demand
• Easily spin up identical or similar environment stacks for test cycles, parallel release tracks, and other
projects
• Different projects can have different environment requirements, yet follow a common paradigm
• A few templates and a couple commands are all that you need
Dev Dev2 Tst Tst2
Website brand 1
Dev Dev2 Dev3 Tst Tst2
Website brand 2
Tst3
Dev/test VPC Stage/prod VPC
Stg Stg2 Preprd Prod
Website brand 1
Stg Stg2 Stg3 Preprd Preview
Website brand 2
Prod
33. Redis Labs
Cache Cluster
S3
Apache/
Tomcat
Zone 1
Zone 2
ELB
Zone 1
ELB
Internet
gateway
AWS Direct
Connect
Private subnets
Service APIs,
Splunk
Security
layer
Zone 2
ELB
Zone 1
ELB
Public subnets
VPN
fallback
Security
layer
Zone 1
Zone 2
Royal
Datacenter
Apache/
Tomcat
Zone 2
Application architecture
Elastic Beanstalk
34. Automation
AWS CloudFormation + AWS APIs + CI + Elastic Beanstalk
• Use CloudFormation templates to create and manage environment configuration:
• Nested for shared and environment-specific configurations
• Use AWS APIs to script environment creation and updates
• Use Jenkins for continuous integration and deployment to Elastic Beanstalk
• Use Git for code and infrastructure configuration management
(Elastic Beanstalk templates)
• Use the Elastic Beanstalk console to monitor and troubleshoot
• Automate everything for repeatability, reliability, and reportability:
• Standardized configuration enforced
• No room for human error
• Rollbacks and auditing
• Quick and easy
AWS
CloudFormation
AWS APIs
Jenkins CI Elastic Beanstalk
35. Design Code Build Test OperateRelease Deploy
Develop
Continuous integration
Release cycles
DevOps
Automated builds,
tests, and
code scans
Automated
deployment and
provisioning
Automated load
balancing, scaling, and
cluster health
management
Git + Elastic Beanstalk + CloudFormation
Continuous delivery
36. Results
• Zero-downtime deployments
• 30-minute deployments vs. up to 3 hours
• Very stable under high load
• One part-time resource to support all Elastic Beanstalk
environments
• In October, we will also launch the following on Elastic
Beanstalk:
• royalcaribbean.com.br
• royalcaribbean.es
• royalcaribbean-espanol.com
• royalcaribbean.com.au
• Mobile booking
83%
Deployment time
reduced by
0
Outages since March
go live
75%
Web app ops reduced
by