Elastic Beanstalk groups application versions and environments. The Standard web and worker sections explain EC2 deployments, configuration, health, and the choices that preserve serving capacity and database availability.
Elastic Beanstalk basics
AWS Elastic Beanstalk takes your application and builds the environment that runs it.
How it works
- Upload the application.
- Elastic Beanstalk provisions compute, load balancing and monitoring.
- It scales the environment as load changes.
Exam cues
- If the question says deploy an app without setting up the infrastructure yourself, think Elastic Beanstalk.
Remember
- Handles provisioning, load balancing, health and scaling.
Trap: You still own and can see the resources Elastic Beanstalk creates; it is not serverless.
From the AWS docs (6)
- AWS Elastic Beanstalk deploys web applications: you upload the app and it provisions EC2 instances or EKS clusters, load balancing, health monitoring and scaling.
- An application groups versions, environments, and environment configurations.
- An application can have independent environments running the same or different application versions.
- With Elastic Beanstalk you upload an application source bundle and it provisions and runs the AWS resources, such as EC2 instances, a load balancer and Auto Scaling, while you keep control of them.
- Elastic Beanstalk has no additional charge; you pay only for the AWS resources your application uses.
- Basic health reporting uses load balancer health checks (or EC2 status checks in a single-instance environment), checks that the Auto Scaling group has at least one instance, and publishes no metrics to CloudWatch.
Rolling deployment policies
Elastic Beanstalk rolling application deployments update code in batches to limit how much serving capacity is unavailable. Configuration updates that replace instances are a separate mechanism, with separate capacity and rollback settings. A batch is the group of instances processed together.
How it works
- Choose the application
DeploymentPolicyinaws:elasticbeanstalk:command. All at once is the default; an EB CLI scalable environment created without--singleuses Rolling. - For rolling application deployments, choose
BatchSizeandBatchSizeType:Fixedis an instance count andPercentageis a share of the group. Percentage can be up to 100 percent; Fixed can be up to the group’s maximum instance count. - Beanstalk removes a batch from the load balancer, updates its code, reattaches it, and waits for health before continuing. Rolling with additional batch launches extra capacity first and removes the extra batch when done.
- After an application deployment fails, inspect the mixed versions and deploy a fixed or known-good version. Terminating an instance causes replacement with the last successfully deployed version.
- For settings that replace instances, such as instance type, configure
aws:autoscaling:updatepolicy:rollingupdate. A rolling configuration update terminates and replaces batches. If code and a replacement-triggering setting change together, the replacement instances receive the new code.
| Application policy | What happens | Serving capacity |
|---|---|---|
| All at once | Update all instances together | Brief outage |
| Rolling | Update existing instances in batches | Reduced by a batch |
| Rolling with additional batch | Add a batch before updating | Full capacity |
| Immutable | Launch a new fleet | Original fleet remains available |
| Traffic splitting | Launch a new fleet and evaluate a share of traffic | Original fleet remains available |
| Blue/green | Deploy to a separate environment | Old environment remains available |
Configuration updates use MaxBatchSize for replacement batch size and MinInstancesInService for minimum serving capacity. RollingUpdateType selects Health, Time, or Immutable. Time-based updates use PauseTime; health-based updates use Timeout. A failed rolling configuration update attempts another rolling update to restore the previous configuration. If that rollback fails, fix the underlying problem and update again.
Exam cues
- If the question says update existing application instances without losing capacity, think Rolling with additional batch, because new capacity starts first.
- If the question says a code deployment failed with mixed versions, think redeploy a known-good version, because application rolling deployments do not automatically restore every batch.
- If the question says an instance type change needs controlled replacement capacity, think the configuration update policy, because application
BatchSizedoes not control that mechanism.
Remember
- Application settings:
DeploymentPolicy,BatchSize,BatchSizeType. - Replacement settings:
MaxBatchSize,MinInstancesInService,RollingUpdateType. - Health-based configuration update timeout defaults to 30 minutes.
Trap: An instance type change is not just a rolling code deployment. It replaces instances and uses the configuration update policy.
From the AWS docs (21)
- All at once is the default application deployment policy.
- EB CLI scalable environments created without --single use Rolling application deployments.
- All at once updates all instances simultaneously and takes them briefly out of service.
- Rolling detaches a batch from the load balancer, deploys code, reattaches it, and waits for health before the next batch.
- Rolling with additional batch starts extra instances before taking a batch out of service to maintain full serving capacity.
- Rolling with additional batch terminates the additional batch after deployment.
- Application deployments use DeploymentPolicy, BatchSize, and BatchSizeType in aws:elasticbeanstalk:command.
- BatchSizeType is Fixed for an instance count or Percentage for a share of the group.
- An application deployment percentage batch can be up to 100 percent.
- A fixed application deployment batch can be up to the Auto Scaling maximum instance count.
- A failed rolling application deployment can leave completed batches on the new version and pending batches on the old one.
- Recover from a failed rolling application deployment by deploying a fixed or known-good version.
- Instances terminated after a failed deployment are replaced with the application version from the most recent successful deployment.
- Instance-replacing configuration updates use aws:autoscaling:updatepolicy:rollingupdate separately from application deployment settings.
- A rolling configuration update terminates and replaces each batch; changing instance type or key-pair settings can trigger replacement, including during application deployment.
- Configuration updates use MaxBatchSize and MinInstancesInService to control replacement capacity.
- RollingUpdateType selects Health, Time, or Immutable configuration updates.
- Time-based configuration updates use PauseTime; health-based configuration updates use Timeout.
- The health-based rolling configuration update timeout defaults to 30 minutes.
- A failed rolling configuration update starts another rolling update to restore the prior configuration; a failed rollback can leave mixed configurations.
- Immutable and Traffic splitting launch new instances; blue/green deploys to a separate environment.
Immutable deployments and traffic splitting
Immutable updates build a replacement fleet beside the running fleet so a failed deployment can discard the replacements. Traffic splitting adds a canary evaluationTesting a new application version with a configured share of real traffic before switching all traffic.: a selected share of real requests reaches the new version before the final switch. An Auto Scaling groupA group that maintains a configured count of EC2 instances. is the set that maintains a fleet’s desired instance count.
How it works
- For Immutable, Beanstalk creates a temporary Auto Scaling group behind the existing load balancer and launches one new instance.
- After that instance passes health checks, Beanstalk starts enough new instances to match the original fleet. Enhanced health reporting is required, and instance capacity temporarily doubles.
- After every new instance passes, Beanstalk moves the replacements into the original group, removes the old instances, and deletes the temporary group. Failure removes the temporary group and leaves the old fleet untouched.
- For Traffic splitting, Beanstalk launches a full replacement fleet and an Application Load Balancer sends it the
NewVersionPercentshare forEvaluationTimeminutes. Both fleets keep their starting instance counts during evaluation. - A healthy evaluation moves all requests to the new fleet and completes replacement. Failed health checks or an abort return traffic to the original fleet and remove the new one.
AbortEnvironmentUpdatecan stop the operation.
Application deployment and instance configuration policies are independent. To use immutable behavior for both, set DeploymentPolicy: Immutable in aws:elasticbeanstalk:command and RollingUpdateType: Immutable in aws:autoscaling:updatepolicy:rollingupdate.
Other resource changes, such as load balancer settings, cannot be combined with an immutable updateAn update that launches replacement instances beside the original fleet before removing the old instances.. Apply independent changes separately. Use blue/green when resource changes depend on the new application or instance configuration.
Exam cues
- If the question says failure must leave the original instances untouched, think Immutable, because the replacement group can be discarded.
- If the question says evaluate a percentage of real requests before full rollout, think Traffic splitting, because its ALB separates traffic during the evaluation window.
- If the question says code and instance type both need immutable replacement, think configure both policies, because application and configuration update settings are separate.
- If the question says dependent load balancer and application changes in one release, think blue/green, because concurrent resource changes are restricted during immutable updates.
Remember
- Immutable needs enhanced health and quota for temporary double capacity.
- Traffic splitting needs an ALB and a full second fleet for the evaluation period.
- Instance replacement loses accumulated EC2 burst balances, the credits used by burstable instances.
NewVersionPercentcontrols the traffic share;EvaluationTimeis in minutes.
Trap: Rolling with additional batch preserves capacity while updating existing instances. It does not provide Immutable’s guarantee that failure leaves the original instances untouched.
Create a temporary group and launch one instance.
The original fleet remains available while the first replacement is evaluated.
After the first passes, launch the remaining replacements. Move the healthy fleet to the original group on success; discard the temporary group on failure.
Requests reach the environment ALB.
The ALB sends the configured share to the new fleet during EvaluationTime.
The old fleet serves the remainder. Healthy evaluation switches all traffic; failure or abort returns it to the old fleet.
From the AWS docs (15)
- An immutable update starts one new instance in a temporary Auto Scaling group behind the existing load balancer.
- After the first replacement passes health checks, Beanstalk grows the temporary group to match the original fleet.
- After all replacements pass, Beanstalk transfers them to the original group and removes the old fleet and temporary group.
- A failed immutable deployment removes the temporary group and leaves original instances untouched.
- Immutable updates require enhanced health reporting.
- Immutable updates temporarily double instance capacity and require sufficient instance quota.
- Replacing instances with immutable updates or traffic splitting loses their accumulated EC2 burst balances.
- Configure DeploymentPolicy: Immutable in aws:elasticbeanstalk:command and RollingUpdateType: Immutable in aws:autoscaling:updatepolicy:rollingupdate to use immutable behavior for both application deployments and instance configuration changes.
- An immutable update cannot concurrently change other resource configuration such as load balancer settings; use separate updates for independent changes or blue/green for dependent changes.
- Traffic splitting launches a full fleet in a temporary Auto Scaling group and keeps each fleet at its starting count throughout deployment.
- Traffic splitting requires an Application Load Balancer.
- NewVersionPercent and EvaluationTime in aws:elasticbeanstalk:trafficsplitting set the traffic share and evaluation duration in minutes.
- If the new fleet stays healthy for the evaluation period, Beanstalk moves all traffic to it, transfers it to the original group, and removes old instances and the temporary group.
- If traffic-splitting health checks fail or the deployment is aborted, traffic returns to the old fleet and the new instances are terminated.
- AbortEnvironmentUpdate can abort an ongoing deployment.
Blue/green environments
Elastic Beanstalk blue/green deployment tests a release in a separate environment before switching its public name. A CNAMEA DNS alias that directs one name to another name. is a DNS alias: swapping environment URLs changes where the environment names direct requests.
How it works
- Keep the production database independent of the environment. Use an external database, or retain and decouple a Beanstalk-created database before the change.
- Clone the current environment or create a new one. Cloning stays within the same platform branchA family of related platform versions used to run an application., the family of related platform versions. For an incompatible branch, create the target environment manually and adapt the code and settings.
- Deploy and test the new version there. A clone omits RDS data and changes made outside Beanstalk. Reestablish ingress security groupsA set of rules controlling traffic allowed to and from attached resources., the rules controlling incoming traffic.
- Choose Swap environment URLs to exchange the environments’ CNAME records. Confirm the old production URL reaches the replacement.
- Keep the old environment until DNS changes propagate and cached records expire. Before termination, remove dependencies that reference its security group. After termination, delete any custom DNS records still pointing to its released name.
Exam cues
- If the question says an incompatible platform update needs separate testing, think a new environment and CNAME swap, because blue/green separates deployment from the traffic switch.
- If the question says the clone is missing database contents or manual resource edits, think cloning limits, because only managed configuration and resources are reproduced.
- If the question says clients still reach the old environment after swapping URLs, think cached DNS, because the swap does not invalidate resolver caches.
Remember
- Clone within a platform branch; create an environment manually for a different branch.
- A clone does not copy RDS contents, unmanaged changes, or ingress security groups.
- TTLThe intended duration a DNS record can remain in a resolver cache. means time to live, the intended cache lifetime; some DNS resolvers retain old records longer.
- Blue/green needs a production database that survives independently.
Trap: A completed CNAME swap is not permission to immediately terminate the old environment. Cached DNS can still send users there.
Clients resolve the environment URL through DNS.
After testing the replacement, swap CNAMEs to direct the production name to it.
Keep the old environment available while cached records still direct clients there.
From the AWS docs (12)
- Blue/green deploys and tests a new version in a separate environment, then swaps the environments' CNAME records.
- An incompatible platform version update requires blue/green.
- Keep the old environment until DNS changes propagate and cached records expire; resolvers may retain records beyond their TTL.
- Blue/green requires an environment independent of its production database; use an external database or retain and decouple a coupled database.
- Cloning does not copy RDS database contents.
- Cloning does not reproduce unmanaged resource changes.
- Cloning reproduces Beanstalk-managed environment settings and resources.
- Cloning can change platform versions only within the same platform branch.
- A different platform branch requires manually creating a new environment and adapting application code and settings as needed.
- Cloned environments do not carry over ingress security groups; reestablish the intended ingress rules.
- References from another environment's security group to the retiring environment's group can prevent termination.
- Delete custom DNS records pointing to a terminated environment because its released CNAME can be reused.
Configuration files and hooks
Elastic Beanstalk configuration files describe environment settings and instance customization alongside the application. On Amazon Linux 2 and Amazon Linux 2023, platform hooksA script that runs at a defined point in application or configuration deployment. are scripts run at specific points in deployment. This gives repeatable setup rather than relying on manual instance edits.
How it works
- For Beanstalk Standard, include YAML or JSON
.configfiles, preferably in one.ebextensionsdirectory at the archive root. Files run alphabetically. Use each top-level key once. - Use
option_settingsfor environment options andResourcesfor additional CloudFormation resources. CloudFormation is the template system Beanstalk uses to create its environment resources. Keys such aspackagesandfilescustomize the operating system. - For Linux customization, run
commandsbefore the source archive is extracted and the application is set up. Runcontainer_commandsagainst the extracted source in the staging directoryThe temporary location where application source is prepared before final deployment., the temporary location before final deployment. Both run as root, the operating system administrator. - Use application hooks under
.platform/hooks:prebuildfollowscommands;predeployfollowscontainer_commands;postdeployfollows application and proxy deployment. A proxy is the server in front of the application. - Use
.platform/confighooksfor configuration deployments that update existing instances without recreating them. Hook files run in filename order as root; a nonzero exit code fails the deployment.
| Setting source | Precedence, highest first | Consequence |
|---|---|---|
| Direct environment setting | Highest | Includes console and EB CLI recommended values |
| Saved configuration | Next | Stored settings override file values |
| Configuration file | Next | Applies when higher levels do not set the option |
| Default | Lowest | Applies when no other level sets the option |
leader_only runs a container command on one instance during environment creation and deployments. It does not run for launch configuration changes such as instance type replacement.
Exam cues
- If the question says a file option is ignored, think higher-precedence environment settings, because console and EB CLI values override files.
- If the question says edit application files before final deployment, think
container_commands, because they run in the extracted staging directory. - If the question says hook an environment property change without replacing instances, think
.platform/confighooks, because it handles configuration deployments.
Remember
- Files:
.config, YAML or JSON, alphabetical order, no duplicate top-level keys. - Application hooks:
prebuild,predeploy,postdeploy. leader_onlyapplies to creation and deployments, not launch configuration changes.
Trap: Changing a lower-precedence file repeatedly will not override an option stored directly on the environment. Remove the higher-precedence value first.
Run commands before extraction; prebuild follows extraction.
Configure the application and server before container_commands.
Run predeploy after container_commands.
Deploy the application and proxy, then run postdeploy.
From the AWS docs (19)
- Configuration precedence is direct environment settings, saved configurations, .ebextensions files, then defaults.
- Console and EB CLI recommended values are direct environment settings; remove higher-precedence values to let configuration file values apply.
- .ebextensions configuration files use YAML or JSON and have a .config extension.
- AWS recommends one .ebextensions directory at the source bundle root.
- Configuration files execute in alphabetical order.
- Use each top-level key once per file; duplicate keys can cause a section to be dropped.
- option_settings sets environment options; Resources defines CloudFormation resources; packages, files, commands, and container_commands customize instances.
- Configuration files customize EC2-based Beanstalk Standard environments.
- commands run as root before the application and web server are set up and before source extraction.
- container_commands run as root in the extracted application staging directory before final deployment.
- leader_only container commands run on one instance during creation and deployments, but not for launch configuration changes such as instance type changes.
- prebuild hooks follow commands and source extraction but precede application setup.
- predeploy hooks follow container_commands and precede final deployment.
- postdeploy hooks run after application and proxy deployment.
- Configuration deployments that update instances without recreating them use .platform/confighooks with the same three stages.
- Platform hooks run as root in filename order.
- A nonzero hook exit code aborts and fails deployment.
- Platform hooks are supported on Amazon Linux 2 and Amazon Linux 2023 platforms; they are not supported on the earlier Amazon Linux AMI platforms.
- A reverse proxy receives traffic on an instance and forwards requests to the application.
Worker environments
Elastic Beanstalk worker environments move slow background jobs away from the web request path. The web application queues work in SQS, and separate worker instances process it. A daemonA background process that performs ongoing work such as polling a queue. is a background process; Beanstalk’s worker daemon bridges the queue to the local HTTP application.
How it works
- Send jobs to the worker’s SQS queue. Worker instances run in an Auto Scaling groupA group that maintains a configured count of EC2 instances. without a load balancer.
- Each daemon reads a message and POSTs its body to the local application. The default path is
/. Port 80 is fixed, so the application or its proxy, a server that forwards requests to the application, must listen there. - Return
200 OKafter successful processing. Only that response causes the daemon to delete the message. - A different response makes the job available after
ErrorVisibilityTimeout. No response usesInactivityTimeout. SetVisibilityTimeout, the time a received message is hidden from other readers, longer than expected processing time. Make handling idempotent, meaning repeating a message does not repeat its intended side effect. - Repeated failures go to a dead-letter queueA queue that receives messages that repeatedly fail processing., a queue for jobs that could not be processed, when one is configured. Autogenerated queues include one; existing queues need their own SQS configuration. Without one, retrying messages remain until retention expires.
- For scheduled work, include
cron.yamlwith unique task names, URL paths, and cron schedules, the expressions describing when jobs run. An elected worker queues the scheduled message; any worker can process it. Existing FIFOA queue type that preserves the order of messages within each message group. queues, which preserve message order within each message group, do not support periodic tasks.
Exam cues
- If the question says long jobs block web responses, think a worker tier and SQS queue, because separate instances process the work.
- If the question says a successful-looking 202 response keeps retrying, think return 200 after processing, because that is the daemon’s deletion acknowledgment.
- If the question says scheduled work with an existing FIFO queue, think change the queue choice, because periodic tasks are unsupported with FIFO.
Remember
- HTTP path defaults to
/; port 80 cannot be changed. MaxRetries: default 10, range 1 to 100, applies when a dead-letter queue exists.InactivityTimeout: default 180 seconds.RetentionPeriod: default 345600 seconds.- Autogenerated queues are standard queues; existing standard and FIFO queues are accepted.
Trap: Accepting a job is not enough to delete it. The worker must report successful processing with HTTP 200 OK.
The daemon receives an SQS message.
It posts to the local app. A 200 response deletes the message; errors or no response allow retry.
From the AWS docs (19)
- Worker environments offload long-running jobs to separate instances using an SQS queue.
- The worker daemon reads SQS messages and POSTs their bodies to the local application; the default path is / and port 80 is fixed.
- Only HTTP 200 OK acknowledges successful processing and causes the daemon to delete the SQS message.
- A non-200 response retries after ErrorVisibilityTimeout; no response retries after InactivityTimeout.
- Autogenerated worker queues have a dead-letter queue by default.
- For an existing worker queue, configure a dead-letter queue separately in SQS.
- MaxRetries defaults to 10 and accepts values from 1 through 100.
- Without a dead-letter queue, messages remain eligible for processing until retention expires.
- Worker RetentionPeriod defaults to 345600 seconds.
- InactivityTimeout defaults to 180 seconds.
- VisibilityTimeout should exceed expected processing time; it controls how long a received message is unavailable to other readers.
- cron.yaml defines unique task names, URL paths, and cron schedules; an elected worker queues each scheduled job and any worker can process it.
- Autogenerated worker queues are standard queues.
- Existing worker queues can be standard or FIFO.
- Periodic tasks are unsupported with FIFO worker queues.
- Standard SQS queues can redeliver messages, so applications should be idempotent and tolerate repeated processing.
- Worker environments have no load balancer and scale their processing instances in an Auto Scaling group.
- FIFO preserves message order within each message group.
- A reverse proxy receives traffic on an instance and forwards requests to the application.
Database lifecycle
A database coupled to Elastic Beanstalk shares lifecycle management with its environment. Decoupling removes that management relationship. An external database lets environments be replaced while the same database stays available.
How it works
- Decide what must survive. A deletion policy controls what happens to the coupled database when it is decoupled or the environment terminates.
- To keep it running, apply
DBDeletionPolicy: Retaininaws:rds:dbinstanceand wait for that update to finish. - In a separate update, set
HasCoupledDatabase: falseto decouple. Any other database changes submitted with decoupling are ignored, including a pending deletion policy. - Configure the application’s connection stringThe parameters an application uses to locate and connect to a database., the parameters it uses to locate and connect to the database, and the database security groupA set of rules controlling traffic allowed to and from attached resources. to allow the replacement environment. External databases can be shared by multiple environments.
- Before retiring the old environment, preserve replacement access and remove security group references to the old environment that would prevent its termination.
| Deletion policy | Saved data | Running database after removal |
|---|---|---|
| Snapshot | A database snapshotA saved database backup from which a database instance can be restored., a restorable backup | Deleted |
| Delete | No snapshot from this policy | Deleted |
| Retain | Existing database | Still running externally |
Exam cues
- If the question says retain the operational database while replacing an environment, think Retain then decouple, because environment removal must not delete the running database.
- If the question says Retain was selected in the same update as decoupling, think the previous policy still applies, because other pending database changes are ignored.
- If the question says only a recoverable backup is needed, think Snapshot, because it saves a backup before deleting the DB instance.
Remember
DBDeletionPolicy:Snapshot,Delete, orRetain.HasCoupledDatabase: falsestarts decoupling.- Change deletion policy and decouple in separate updates.
Trap: Decouple does not automatically mean keep the database. The active deletion policy can still delete it.
Complete the Retain policy update before requesting decoupling.
Decouple in a separate update and configure external database access.
From the AWS docs (10)
- A coupled RDS database is managed with its Beanstalk environment.
- The coupled database deletion policy applies when it is decoupled or its environment is terminated.
- Snapshot creates a database snapshot and then deletes the running DB instance.
- Delete removes the DB instance.
- Retain keeps the DB instance running as an external database.
- Changes submitted with the decouple operation, including a new deletion policy, are ignored; apply them in a separate earlier update.
- DBDeletionPolicy selects Snapshot, Delete, or Retain in aws:rds:dbinstance.
- HasCoupledDatabase: false starts database decoupling in aws:rds:dbinstance.
- External databases can serve multiple environments and require appropriate security group and connection string configuration.
- An external reference to a retiring environment's security group can prevent termination; preserve replacement environment access before removing the old dependency.
Health and deployment troubleshooting
Elastic Beanstalk enhanced health explains why an environment or instance is unhealthy by combining request results, system metrics, and operation state. A green load balancer check alone can miss an application that accepts connections before it is ready.
How it works
- The instance health agent reads request logs and operating system metrics and sends metrics to Beanstalk every 10 seconds. Beanstalk combines these with load balancer, Auto Scaling, and deployment state.
- Inspect Health in the console or
eb healthfor causes. Compare each instance’s deployment ID, the identifier of its last deployment, to locate versions left behind after a failed rolling deployment. Retrieve instance logs for the failure details. - Check the application’s health URL. The load balancer expects HTTP GET to return 200. Without a URL, a successful TCP connection, the network connection beneath HTTP, can mark an instance ready before application startup finishes.
- Allow enough startup time with Command timeout. With enhanced health, a web batch needs 12 consecutive OK checks within two minutes; a worker batch needs 18 within three minutes.
- If an application is confirmed stable at a lower status, adjust
HealthCheckSuccessThreshold.Ignore health checkprevents rollback after the health timeout but does not repair the cause. - Match health transitions or operation state changes with EventBridge rules to invoke SNS notifications or Lambda functions. Beanstalk events use best-effort delivery, so individual events can be delayed or missing.
Enable instance log streaming to send environment log files to CloudWatch Logs.
Exam cues
- If the question says failed rolling deployment with different versions across instances, think deployment IDs and health causes, because they identify which deployment reached each instance.
- If the question says the load balancer sends requests before startup finishes, think an application health check URL, because accepting a TCP connection does not prove the app is ready.
- If the question says notify on environment health or deployment failure, think EventBridge rules, because Beanstalk publishes health and operation transitions.
- If the question says failed immutable instances disappeared, think S3 bundle logs, because they are uploaded before termination.
- If the question says send instance logs to CloudWatch Logs, think instance log streaming, because Elastic Beanstalk sends the environment’s log files when it is enabled.
Remember
- Agent reports: every 10 seconds.
- Command timeout default: 10 minutes. This differs from the configuration rolling update timeout.
- Enhanced deployment health: 12 checks in two minutes for web; 18 in three minutes for workers.
- Failed immutable logs: one hour in S3. Standard bundle and tail logs: 15 minutes.
Trap: Ignore health check changes whether deployment continues after failed health checks. It does not make an unhealthy application healthy.
From the AWS docs (17)
- Enhanced health combines an instance agent's operating system metrics and request logs with load balancer, Auto Scaling, and deployment information.
- The enhanced health agent reports instance metrics to Beanstalk every 10 seconds.
- The console Health page and eb health show health status and causes.
- Instance deployment IDs identify versions left after a failed rolling application deployment.
- Instances in a failed immutable update upload bundle logs to S3 before termination.
- Failed immutable update logs remain in S3 for one hour, compared with the standard 15 minutes for bundle and tail logs.
- With enhanced health during rolling deployments, web instances need 12 consecutive OK checks within two minutes.
- With enhanced health during rolling deployments, worker instances need 18 consecutive OK checks within three minutes.
- HealthCheckSuccessThreshold allows a lower accepted health status such as Warning.
- Command timeout in aws:elasticbeanstalk:command defaults to 10 minutes and controls the time allowed for instance deployment health.
- Ignore health check prevents rollback when a batch does not become healthy within Command timeout; it does not repair the application.
- An application health check URL must return HTTP 200 to an HTTP GET before the load balancer sends traffic; without a URL, accepting a TCP connection can satisfy the check before application readiness.
- Beanstalk sends environment health transitions, operation state changes, resource state changes, and managed update events to EventBridge.
- EventBridge rules match Beanstalk events and invoke targets such as SNS notifications or Lambda functions.
- Beanstalk events use best-effort delivery to EventBridge; events may be delayed or not delivered.
- Instance logs provide command and application output for investigating deployment failures.
- When instance log streaming is enabled, Elastic Beanstalk sends environment instance log files to CloudWatch Logs.
Flashcards
Nothing to review here right now. Pick other topics or another filter.
·
All 55 cards as a list
Developers want to upload application code and have AWS create the servers, load balancer and scaling for them. Which service fits?
AWS Elastic Beanstalk.
An Elastic Beanstalk team needs isolated test and production deployments of one application. How should it organize them?
Create separate environments in the same application. They can run different application versions independently.
A developer wants to upload a web application and have AWS provision the servers, load balancing and scaling, with no extra service fee. Which service fits?
AWS Elastic Beanstalk.
It has no additional charge; you pay for the EC2 instances and other resources it creates.
What does Elastic Beanstalk basic health reporting check, and does it publish metrics to CloudWatch?
Load balancer health checks (or EC2 status checks for a single instance) and that the Auto Scaling group has at least one instance. It publishes no CloudWatch metrics; enhanced health adds an agent and more data.
What is the Elastic Beanstalk application deployment default, and what does EB CLI choose for a scalable environment?
All at once is the default. EB CLI uses Rolling when creating a scalable environment without --single.
An Elastic Beanstalk team wants a rolling application deployment without reduced serving capacity. Which policy fits?
Rolling with additional batch. It starts extra capacity before taking a batch out of service.
An Elastic Beanstalk rolling application deployment fails after completing some batches. How does the team restore one working version?
Deploy a fixed or known-good version. Completed batches may have the new version while pending batches still have the old version.
How do Elastic Beanstalk application policies differ in their use of existing or new instances?
All at once and rolling policies deploy code to existing instances. Immutable and Traffic splitting launch new instances. Blue/green uses a separate environment. Instance-replacing configuration changes follow their own update policy.
Which Elastic Beanstalk option sets the application deployment policy, and what is its default?
DeploymentPolicy in aws:elasticbeanstalk:command. The default is All at once; EB CLI scalable environments use Rolling.
An Elastic Beanstalk application can tolerate a brief outage while every instance receives the release simultaneously. Which policy fits?
All at once. Every instance is briefly out of service during deployment.
An Elastic Beanstalk application must retain serving capacity while existing instances receive code in batches. Which policy fits?
Rolling with additional batch. Extra instances are launched before existing batches are updated.
What version replaces an instance terminated after a failed Elastic Beanstalk rolling application deployment?
The version from the most recent successful deployment. To restore the whole environment, deploy a known-good version.
An Elastic Beanstalk team configured application BatchSize but must control replacement during an instance type change. Which options apply?
MaxBatchSize and MinInstancesInService in aws:autoscaling:updatepolicy:rollingupdate. Instance replacement has a separate policy from application deployment.
How can an Elastic Beanstalk rolling application deployment size each batch?
Use BatchSize and BatchSizeType: Fixed for an instance count or Percentage for a share of the fleet.
An Elastic Beanstalk rolling configuration update fails its health checks. Does it use the application deployment recovery procedure?
It starts another rolling configuration update to restore the previous configuration. A failed application deployment requires a fixed or known-good application deployment.
An Elastic Beanstalk deployment failure must leave the original instances untouched. Which policies fit?
Immutable and Traffic splitting. Both launch a new fleet in a temporary Auto Scaling group and discard it on failure.
What does Elastic Beanstalk traffic splitting require and which options control the evaluation?
An Application Load Balancer. Set NewVersionPercent for the new fleet traffic share and EvaluationTime for the evaluation duration in minutes.
An Elastic Beanstalk team wants replacement instances and recovery that leaves the original fleet untouched. How does Immutable work?
Launch one instance in a temporary group, expand after health checks, then transfer the healthy fleet. On failure, remove the temporary group.
What must an Elastic Beanstalk team account for before enabling immutable updates?
Enhanced health reporting, quota for a temporary doubling of instances, and loss of accumulated EC2 burst balances when instances are replaced.
How does Elastic Beanstalk traffic splitting add testing beyond an immutable deployment?
It sends a configured percentage of traffic to the new fleet for an evaluation period before switching all traffic. It requires an Application Load Balancer.
An Elastic Beanstalk team needs a new version to receive a configurable traffic share for an evaluation window. Which policy fits?
Traffic splitting. Configure NewVersionPercent and EvaluationTime.
An Elastic Beanstalk release changes code and instance type. Can immutable behavior cover both?
Yes, configure immutable application deployments and immutable configuration updates, or separate the changes. Concurrent changes to other resource settings, such as the load balancer, still need separate updates or blue/green.
An Elastic Beanstalk release changes a load balancer setting that depends on new application code. Can it use one immutable update?
Use blue/green. An immutable update cannot concurrently apply other resource configuration changes; separate updates work when the changes are independent.
An Elastic Beanstalk traffic-splitting release starts failing during evaluation. How does the team stop it?
Abort the operation, including with AbortEnvironmentUpdate. Beanstalk returns traffic to the old fleet and terminates the new instances.
How does Elastic Beanstalk blue/green deploy a version, and which lifecycle risks matter?
Deploy and test in a separate environment, then swap environment URLs. Keep the database independent and retain the old environment until DNS caches expire.
An Elastic Beanstalk team must move to an incompatible platform branch and test separately. What should it do?
Create a new environment for the target branch, deploy and test, then swap environment URLs. Cloning only changes versions within the same branch.
After an Elastic Beanstalk CNAME swap, some clients still reach the old environment. Why?
DNS resolvers cache records and may retain them beyond their TTL. Keep the old environment until propagation and record expiration.
An Elastic Beanstalk clone lacks database data and manual resource changes. Is this unexpected?
No. Cloning omits RDS contents and unmanaged changes. Reestablish the intended ingress security groups too.
A retired Elastic Beanstalk environment still has a custom DNS alias. What must the team remove?
Remove DNS records pointing to the terminated environment. Its released CNAME can be reused by another customer.
What is Elastic Beanstalk configuration option precedence from highest to lowest?
Direct environment settings, saved configurations, .ebextensions configuration files, then defaults.
An Elastic Beanstalk .ebextensions option is ignored after a console setting was applied. What should be checked?
Remove the higher-precedence environment setting if the file should control the value. Console and EB CLI recommended settings also have this precedence.
What format, naming, and ordering rules apply to Elastic Beanstalk .ebextensions configuration files?
Use YAML or JSON files ending in .config, preferably in a root .ebextensions directory. Files execute alphabetically. Use each top-level key once.
How do commands and container_commands differ in Elastic Beanstalk configuration files?
commands run before source extraction and application setup. container_commands run in the extracted staging directory before final deployment; leader_only limits a command to one instance during creation or deployment.
Can an Elastic Beanstalk Standard .ebextensions file create an additional queue or alarm?
Yes. Resources accepts CloudFormation resource definitions. option_settings configures environment options.
An Elastic Beanstalk deployment needs a script after source extraction but before application setup. Which hook stage fits?
prebuild under .platform/hooks. It runs after commands and before application setup.
An Elastic Beanstalk configuration change updates environment properties without recreating instances. Where should its deployment hooks live?
Under .platform/confighooks, using prebuild, predeploy, or postdeploy.
An Elastic Beanstalk instance type update must run a leader_only container command. Will it do so?
No. leader_only commands run during creation and deployments, not launch configuration changes such as an instance type change.
How does an Elastic Beanstalk worker instance receive and acknowledge an SQS job?
The daemon sends the message body as an HTTP POST to the local application, using / by default and fixed port 80. Only 200 OK causes message deletion.
What happens to repeatedly failing Elastic Beanstalk worker messages?
With a dead-letter queue, MaxRetries controls transfer there and defaults to 10. Without one, messages remain until retention expires. Existing queues need a separately configured dead-letter queue.
How does an Elastic Beanstalk worker environment schedule periodic tasks?
Include cron.yaml with task names, URL paths, and cron schedules. An elected worker queues each job; any worker can process it. Periodic tasks do not support FIFO queues.
An Elastic Beanstalk worker returns 202 after accepting an SQS job. Will the daemon delete the message?
No. Only 200 OK deletes it. A different response retries after ErrorVisibilityTimeout.
An Elastic Beanstalk worker app listens on a custom port. Can the queue daemon be reconfigured to use it?
No. The daemon always posts to port 80. Make the application or its proxy listen on port 80; the URL path is configurable.
An Elastic Beanstalk worker sometimes processes the same message again. What application property is needed?
Idempotent handling: repeated processing must not repeat the intended side effect. SQS at-least-once delivery can produce repeated messages.
Which Elastic Beanstalk database arrangement can survive replacing or terminating an environment?
An external database, or a coupled database retained through Retain. Snapshot preserves a backup but deletes the running instance.
An Elastic Beanstalk team selects Retain and Decouple database in one update. Which policy applies?
The previously active policy. The pending deletion policy is ignored. Apply Retain first, then decouple in a separate update.
An Elastic Beanstalk team plans blue/green and must retain its coupled database. What sequence should it follow?
Apply DBDeletionPolicy: Retain first, then set HasCoupledDatabase: false in a separate update. Configure both environments to reach the external database.
An Elastic Beanstalk team wants a database backup but does not need the DB instance to keep running after environment termination. Which policy fits?
Snapshot. It creates a snapshot and deletes the DB instance. Retain keeps the instance running.
An old Elastic Beanstalk environment cannot terminate because another security group references its group. What should be checked?
Preserve database access from the replacement environment, then remove the reference to the retiring environment group that blocks termination.
An Elastic Beanstalk deployment stays at Warning even though the team has confirmed it operates correctly. Which health settings can change acceptance?
Lower Healthy threshold with HealthCheckSuccessThreshold, or increase Command timeout if startup needs more time. Ignore health check forces continuation when a batch cannot become healthy; it does not fix the cause.
How does Elastic Beanstalk enhanced health help troubleshoot a failed release?
It combines request and operating system data with environment state. Inspect Health or eb health causes, compare instance deployment IDs, and retrieve logs.
An Elastic Beanstalk batch fails before a slow application becomes ready. Which checks and setting should be reviewed?
Review the application health check URL and Command timeout. The URL must return 200 when ready; allow sufficient startup time before changing health acceptance.
An Elastic Beanstalk environment should notify operators when health degrades. Which integration fits?
Use an EventBridge rule matching environment health transitions and target SNS or Lambda. Delivery is best effort.
An Elastic Beanstalk immutable update failed and its replacement instances were removed. Where are the diagnostic logs and how long do they remain?
The instances upload bundle logs to S3 before termination. Logs from a failed immutable update remain for one hour.
How many consecutive enhanced health checks must an Elastic Beanstalk rolling deployment batch pass?
Web instances need 12 OK checks within two minutes; worker instances need 18 within three minutes.
A team wants Elastic Beanstalk environment instance logs sent to CloudWatch Logs for troubleshooting. What should it enable?
Enable instance log streaming to CloudWatch Logs.