To use elastic beanstalk, you create the application, upload the application version (e.g. .war file) to Elastic Beanstalk and then provide some information about your application. Elastic Beanstalk automatically launches an environment and creates the required resources to run your application. Information about your application like metrics, events, environment status, etc. is available using Elastic Beanstalk console, APIs, CLI or AWS CLI.
Elastic Beanstalk enables you to manage all the AWS resources that run your application as environment. Key concepts include - Application, Application Version, Environment, Environment Tier, Environment Configuration, Saved Configuration, Platform
When you update the Environment Configuration, Elastic Beanstalk automatically applies the changes.
Web Server Environment Tier: Application that servers HTTP requests
HM = Host Manger, responsible for reports instance status, monitors logs, deployment, generates events, etc.
MyApp.elasticbeanstalk.com is URL configured in Route 53 that points to a load balancer
Software stack running in EC2 instance depends on the ‘Platform’ that you have selected for your application
By default, Elastic Beanstalk creates a security group which allows everyone to connect using HTTP over port 80
Worker Environment Tier: Environment that pulls tasks from SQS and runs in
Any long running tasks or resource consuming tasks in ‘web environment’ are offloaded to ‘worker environment’
Elastic Beanstalk creates & provisions an SQS (if you don’t have)
It also installs a ‘Daemon’ on each EC2 instance in ASG
Web environment passes the job which can be run in background to SQS
The daemon reads the messages available in SQS and sends it as an HTTP request like http://localhost:80 to process the tasks in EC2 instance of worker environment, if HTTP response is
OK 200 = daemon deletes the message from SQS
Any other response = retry after VisibilityTimeoutPeriod
No response = wait for InactivityTimoutPeriod and then daemon puts the message back in SQS for another attempt
SQS delete the messages which are there longer than ‘Retention Period’
Dead-letter-queue: Other queues sends UNSUCCESSFUL messages to dead-letter-queue so that these can be analyzed later
Below are the key features in Elastic Beanstalk web console for an app
Configuration: Shows current configuration of your environment including EC2 instances, load balancers, notifications, health monitoring settings, etc.
Logs: Lets you retrieve logs from EC2 environment
Health: Live health info for EC2 instances like CPU Utilization, load, latency, etc.
Monitoring: Overall health of the environment over time
Alarms: Configured notifications & alarms for your environment
Managed updates: Info about upcoming & completed managed platform updates & instance replacements
Events: Messages for any interaction with the environment
Tags: Any tags you added while creating environment i.e. key-value pairs
‘Deployment Policy’ for Elastic Beanstalk, below are the supported 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. When all of the new instances pass health checks, Elastic Beanstalk transfers them to the original Auto Scaling group, and terminates the temporary Auto Scaling group and old instances
Blue-Green deployment: Clone existing environment, deploy new application version, test it & then swap the URLs
No comments:
Post a Comment