- It is a high-level deployment tool
- Helps you get an app from desktop to web in a matter of minutes.
- handles details of hosting environment for
- capacity provisioning
- load balancing
- scaling
- application health monitoring
- A platform configuration defines infrastructure and software stack to be used for a given environment.
- When you deploy app, Elastic Beanstalk provisions a set of AWS resources
- AWS resources can include Amazon EC2 instances, alarms, a load balancer, security groups, and more.
Using Beanstalk
- First create an application
- upload an application version in form of an application source bundle (for example, a Java .war file) to Elastic Beanstalk
- then, provide some information about application.
- Elastic Beanstalk automatically launches an environment and creates and configures AWS resources needed to run code.
- After environment is launched, you can then manage environment and deploy new application versions.
Following diagram illustrates workflow of Elastic Beanstalk.

After creating and deploying application, information about application—including metrics, events, and environment status, is available through
- AWS Management Console, APIs
- Command Line Interfaces and
- unified AWS CLI
Beanstalk Terms
Application
- It is a logical collection of Elastic Beanstalk components
- includes
- environments
- versions
- environment configurations.
- application is similar to a folder.
Application Version
- It is a specific, labeled iteration of deployable code for a web application.
- It points to S3 object having deployable code like a Java WAR file.
- It is part of an application.
- Applications can have multiple versions
- Each application version is unique.
- In a running environment, deploy any application version
Environment
- It is a collection of AWS resources running an application version.
- It runs only one application version at a time
- Same or different application versions can run in many environments simultaneously.
- After creating environment, Elastic Beanstalk provisions resources needed to run application version.
Environment Tier
- It designates type of application that environment runs
- It determines what resources Elastic Beanstalk provisions to support it.
- An application serving HTTP requests runs in a web server environment tier.
- It is to be selected if launching an Elastic Beanstalk environment
Environment Configuration
- Identifies parameters and settings which define behavior of environment and its resources.
- If environment’s configuration settings are changed, Elastic Beanstalk automatically applies changes to existing resources
Saved Configuration
- It is a template to be used as a starting point for creating unique environment configurations.
- Can create and modify saved configurations
- Apply saved configurations to environments
by
- Elastic Beanstalk console
- EB CLI
- AWS CLI or API.
- API and AWS CLI refer to saved configurations as configuration templates.
Platform
- It is a combination of
- operating system
- programming language runtime
- web server
- application server
- Elastic Beanstalk components.
Web Server Environments
Sample web server environment tier, and their working

Worker Environments
AWS resources created for a worker environment tier include
- Auto Scaling group,
- one or more Amazon EC2 instances
- an IAM role.
- SQS queue
- Elastic Beanstalk installs required files for programming language
- daemon also runs on each EC2 instance in Auto Scaling group to read messages from SQS queue
Components and their interactions

- Reliable, scalable, hosted queue service for sending, storing and retrieving messages.
- Queue act as a buffer between sender and receiver.
- 256kb message, >256kb managed using SQS extended client library which uses S3, deliver message atleast once, not FIFO, can be create in
- any region, retained for 14 days
- can be sent and read simultaneously
- long polling reduces frequent polling (wait 20 secs if queue empty)
- First 1 million request free, $0.50 next 1 million + data transfer charges, SQS queues can be scaled.
- Amazon SQS Architectures
- Priority (2 queues High/Low)
- Fanout (SNS topic/multiple SQS queues for parallel processing)
- Amazon SQS supports both standard and FIFO queues.
- Standard
Queue
- Unlimited Throughput
- At-Least-Once Delivery
- Best-Effort Ordering
- FIFO
Queue
- High Throughput
- Exactly-Once Processing
- First-In-First-Out Delivery
Distributed Queues
3 parts in a distributed messaging system
- components of distributed system
- queue (distributed on Amazon SQS servers),
- messages in queue.
Below, system send messages to queue and receive messages from queue. queue (holds messages A through E) redundantly stores messages across multiple Amazon SQS servers.

Message Lifecycle

- A producer or component 1 sends message A to a queue, and message is distributed across Amazon SQS servers redundantly.
- When a consumer or component 2 is ready to process messages, it consumes messages from queue, and message A is returned. While message A is being processed, it remains in queue and isn’t returned to subsequent receive requests for duration of visibility timeout.
- consumer or component 2 deletes message A from queue to prevent message from being received and processed again when visibility timeout expires.
Best Practices
- Processing Messages in a Timely Manner
- Handling Request Errors
- Setting Up Long Polling
- Capturing Problematic Messages
- Setting Up Dead-Letter Queue Retention
- Avoiding Inconsistent Message Processing
- Implementing Request-Response Systems
To reduce costs, batch message actions:
- use Amazon SQS batch API actions
- use long polling together with buffered asynchronous client.