More Related Content Similar to DEV305_Manage Your Applications with AWS Elastic Beanstalk.pdf (20) More from Amazon Web Services (20) DEV305_Manage Your Applications with AWS Elastic Beanstalk.pdf1. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS re:INVENTM a n a g e Y o u r A p p l i c a t i o n s w i t h A W S E l a s t i c B e a n s t a l k
J e f f H o f f m a n | D i r e c t o r , S o f t w a r e D e v e l o p m e n t
A W S E l a s t i c B e a n s t a l k
A d h i r a j S i n g h | S r . P r o d u c t M a n a g e r
A W S E l a s t i c B e a n s t a l k
D E V 3 0 5
N o v e m b e r 2 8 , 2 0 1 7
2. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Agenda
• Why did we build AWS Elastic Beanstalk?
• What does Elastic Beanstalk do?
• Getting started with Elastic Beanstalk
• Walkthrough/demo
• Popular use cases
• Q&A
3. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Why did we build Elastic Beanstalk?
4. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Developer challenges
• Complexity of deploying code, provisioning,
and managing infrastructure
• Expertise and time needed to manage and
configure servers, databases, load balancers,
firewalls, and networks
• How to automate application scaling
• Lack of consistency across teams
5. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
What is Elastic Beanstalk?
Elastic Beanstalk is an easy-to-use service for
deploying, scaling, and managing web applications
and services
6. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Beanstalk benefits
Fast and simple
to begin
Developer
productivity/agility
Impossible
to outgrow
Complete
resource control
No additional charge to use Elastic Beanstalk—you pay only for underlying AWS
resources (i.e., EC2 instances, Amazon S3, etc.)
7. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
On-instance configuration
Your code
HTTP server
Application server
Language interpreter
Operating system
Host
Elastic Beanstalk configures each
Amazon EC2 instance in your
environment with the components
necessary to run applications for
the selected platform
Focus on building your application
Provided by you
Provided and managed by Elastic Beanstalk
8. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Infrastructure stack
• 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., youapp.regionx.elasticbeanstalk.com)
9. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Building blocks
Application
Application versions ( v1, v2, …,vn)
Environment 1 Environment 2 Environment … n
10. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Getting started with AWS Elastic Beanstalk
11. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
How to deploy applications
1. Via AWS Management Console
2. Via AWS Toolkit for Eclipse and Visual
Studio IDE
3. Via AWS SDKs and AWS CLI
4. Via Elastic Beanstalk command line
interface
$ eb deploy
12. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Information required to deploy application
01
02
03
04
Region
Platform type
Single Instance
Load Balanced
with Auto ScalingOR
Database (RDS)
Your code
Optional
Supported Platforms
Custom Platforms
Create and use your own
custom platform
13. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Walkthrough/demo
14. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Brief/requirement from the management
Rick Mathew,
27, Sr. Web Developer
Made-up Storage Solution Inc.
• Made-up StorageCon event in 6 months
• Create a website to accept registration—participant names, email
addresses
• Deadline—4 weeks
• Scope of features may increase
• Limited budget
• Once launched, no downtime
• Long-term potential:
• Used for every summit/event in the future
• Host content from summits/events
• May eventually evolve into a training portal
Let’s meet Rick
15. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Version Control
Build/
Compile
Code
Dev
Unit Test
App Code
Ops
Test Setup
Prod Setup
Dev Setup
Application
Write
App Code
Infrastructure
tar, war, zip
yum, rpm
Deploy
App
Package
Application
Deploy application
only
Deploy infrastructure
only
AMI
Build
AMIs
Validate
Templates
Write
Infra Code
Deploy
Infras
Deployment
Artifact Repository
CloudFormation
Rick’s concerns
Too many things to do
Rick’s anxiety scale
Week 1
16. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rick gives Elastic Beanstalk CLI a try
D e p l o y i n g a p p l i c a t i o n
Initial application deployment workflow
$ eb init
Create your Elastic Beanstalk app01
Follow the prompts to configure the
environment
02
03 Create the resources and launch the
application
$ eb create
U p d a t i n g a p p l i c a t i o n
Update application workflow
Update your code01
$ git add .
$ git commit –m “v2.0”
$ eb deploy
Add and commit code to repository02
Open application after deployment
completes
03
$ eb open
17. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rick’s questions Rick’s anxiety scale
Week 1
Configuration flexibility (e.g., database management options)
How easy is it to manage infrastructure and applications?
What are the scaling options?
How to monitor and debug applications?
?01
02
03
04
18. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Beanstalk:
Managing infrastructure and applications
19. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Version Control
Build/
Compile
Code
Dev
Unit Test
App Code
Ops
Test Setup
Prod Setup
Dev Setup
Application
Write
App Code
Infrastructure
tar, war, zip
yum, rpm
Deploy
App
Package
Application
Deploy application
only
Deploy infrastructure
only
AMI
Build
AMIs
Validate
Templates
Write
Infra Code
Deploy
Infras
Deployment
Artifact Repository
AWS CloudFormation
Rick’s concern: Infrastructure stack
20. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Beanstalk-supported platforms
Platform Options
Puma, Passenger, Tomcat
Preconfigured
Generic
Single Container
Multi Container
Resources
Proxy
Tools
Language
(npm version)
AMI
Platform components
Infrastructure resources with
default configuration
Nginx 1.12.1, Apache 2.4.27
Git (2.13.5), AWS X-Ray (2.0.0)
8.8.1 (5.4.2), 8.4.0 (5.3.0),
7.10.1 (4.2.0), 6.11.5 (3.10.10),
6.11.1 (3.10.10), 5.12.0 (3.8.6),
4.8.5 (2.15.11), 4.8.4 (2.15.11
2017.09.1
Example:
21. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Managed Platform Update (auto-patching)
Configure your environment to automatically upgrade to the latest version of a platform during a scheduled
maintenance window
Key benefits:
Automated upgrades
Bug and vulnerability fixes
Latest versions of language,
framework, and AMI
Latest features
Key features:
• Choose your maintenance window
• Choose between minor and patch updates
• No downtime
• No impact on capacity
• Flexibility to manually update
• Instance replacement
22. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Version Control
Build/
Compile
Code
Dev
Unit Test
App Code
Ops
Test Setup
Prod Setup
Dev Setup
Application
Write
App Code
Infrastructure
tar, war, zip
yum, rpm
Deploy
App
Package
Application
Deploy application
only
Deploy infrastructure
only
AMI
Build
AMIs
Validate
Templates
Write
Infra Code
Deploy
Infras
Deployment
Artifact Repository
CloudFormation
Rick’s concern: Application management
23. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
AWS
CodeBuild
AWS
CodeCommit
AWS
CodePipeline
AWS
CodeCommit
Elastic Beanstalk
Environment
AWS
CodeStar
Development Source Build Test Production
Elastic Beanstalk: CI/CD options
24. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Application deployment options
Recommended
deployment option
Need for
deployment speed
Need for
high availability
Setup type Production/Staging Test Development
High
High
Rolling with
additional
batches
Low
Immutable
Medium
High
Rolling
(default)
Low
Rolling
(default)
Low
High
All at
Once
Low
Rolling
(default)
26. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rick’s anxiety scale
Rick’s questions
Configuration flexibility (e.g., database management options)
How easy is it to manage infrastructure and applications?
What are the scaling options?
How to monitor and debug applications?
?
01
02
03
04
Week 2
27. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Beanstalk:
Resource and configuration flexibility
28. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
EBextensions
├───.ebextensions
│ ├───extension1.config
│ └───extension2.confg
├───.elasticbeanstalk
│ └─── config.yml
├───app.js
└───package.json
Ebextensions categories
Option_settings
Resource
Sample application archive
Modify/customize the application or configuration stack
YAML formatted with a .config file extension
Folder must be at the root of the archive
Configure AWS resources in your environment
Configure software that runs your application
Define additional AWS resources beyond the functionality provided by configuration
options
Configure any resource supported by AWS CloudFormation
30. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Database management options
Rick’s Environment Rick’s
Environment 2
Amazon
DynamoDB
32. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rick’s anxiety scale
Rick’s questions
Configuration flexibility (e.g., database management options)
How easy is it to manage infrastructure and applications?
What are the scaling options?
How to monitor and debug applications?
?
01
02
03
04
Week 2
33. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Beanstalk: Scaling options
34. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Beanstalk-managed scaling
Scaling options
Trigger-based scaling
• Trigger measurement
(CPU utilization, network traffic, disk
activity, instance health)
• Trigger statistic
• Measurement period
• Upper/Lower Thresholds
• Breach scale increments
Time-based scaling
• Min/Max instance
• Occurrence (One-time, Recurrent)
• Recurrence (CRON expression- 30 8
* * 3)
36. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rick’s anxiety scale
Rick’s questions
Configuration flexibility (e.g., database management options)
How easy is it to manage infrastructure and applications?
What are the scaling options?
How to monitor and debug applications?
01
02
03
04
?
Week 3
37. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring, logging, and alarms
38. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Monitoring
Environment Dashboard
39. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Alarms and notifications
• Elastic Beanstalk uses CloudWatch for monitoring and alarms
• Easy to set up alarms to automatically monitor critical metrics and send notifications
when metrics are outside normal operating range
• Easy to enable Amazon Route 53 health checks and alarms
40. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Logs
• Tail logs are the last 100 lines of the most
commonly used log files
• Bundle logs are the Full Logs
• Log rotation to Amazon S3
41. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
CloudWatch Log streaming:
Stream logs in real time from Elastic Beanstalk-managed Amazon EC2 instance to CloudWatch
Logs
42. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rick’s anxiety scale
Rick’s questions
Configuration flexibility (e.g., database management options)
How easy is it to manage infrastructure and applications?
What are the scaling options?
How to monitor and debug applications?
01
02
03
04
Week 4
43. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Rick’s team deploys to production—
and the application is live
44. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Elastic Beanstalk: Popular use cases
Websites
API
backends
Mobile
backends
Asynchronous
workers
45. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Q&A
46. Key links
Elastic beanstalk resources:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/RelatedResources.html
Sample application:
https://github.com/awslabs/eb-node-express-sample
Load testing with Locust:
https://aws.amazon.com/blogs/devops/using-locust-on-aws-elastic-beanstalk-for-distributed-load-generation-and-testing/
https://github.com/awslabs/eb-locustio-sample
Troubleshooting tips:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/troubleshooting.html
Tutorials and samples:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/tutorials.html
Additional:
Deployment options:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.deploy-existing-version.html
Managed Updates:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/environment-platform-update-managed.html
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/iam-servicerole.html#iam-servicerole-update
Configuring Auto Scaling:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/using-features.managing.as.html
47. © 2017, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Thank you!