Deploying Applications to AWS Elastic Beanstalk Environments
You can use the AWS Management Console to upload an updated source bundle and deploy it to your AWS Elastic Beanstalk environment, or redeploy a previously uploaded version.
Deploying a new version of your application to an environment is typically a fairly quick process. The new source bundle is deployed to an instance and extracted, and then the web container or application server picks up the new version and restarts if necessary. During deployment, your application might still become unavailable to users for a few seconds. You can prevent this by configuring your environment to use rolling deployments to deploy the new version to instances in batches.
Each deployment is identified by a deployment ID. Deployment IDs start at one and increment by one with each deployment and instance configuration change. Elastic Beanstalk displays the deployment ID in both the health console and the EB CLI when it reports instance health status if you have enabled enhanced health reporting. The deployment ID can help you determine the state of your environment when a rolling update fails.
If you need to ensure that your application source is always deployed to new instances, instead of updating existing instances, you can configure your environment to use immutable updates for deployments. In an immutable update, a second AutoScaling group is launched in your environment and the new version serves traffic alongside the old version until the new instance pass health checks.
To configure deployments
For deployments that are dependent on resource configuration changes or a new version that can't run alongside the old version, you can launch a new environment with the new version and perform a CNAME swap for a blue/green deployment.
The following table compares deployment methods:
|Method||Impact of Failed Deployment||Deploy Time||Zero Downtime||No DNS Change||Rollback Process||Code Deployed To|
|All at once||Downtime||☓||✓||Re-deploy||Existing instances|
|Rolling||Single batch out of service. Any successful batches prior to failure running new application version.||†||✓||✓||Re-deploy||Existing instances|
|Rolling with additional batch||Minimal if first batch fails, otherwise similar to Rolling.||†||✓||✓||Re-deploy||New & existing instances|
|Blue/green||Minimal||✓||☓||Swap URL||New instances|
† Varies depending on batch size.
If you deploy often, consider using the Elastic Beanstalk Command Line Interface to manage your environments. The EB CLI creates a repository alongside your source code and can create a source bundle, upload it to Elastic Beanstalk, and deploy with a single command.
Deploying a New Application Version
You can perform deployments from your environment's dashboard.
To deploy a new application version to an Elastic Beanstalk environment
Open the Elastic Beanstalk console.
Navigate to the management page for your environment.
Choose Upload and Deploy,
Choose Browse to select the application source bundle for the application version you want to deploy.
For Version label, type a unique version label to represent the new application version.
Redeploying a Previous Version
You can also deploy a previously uploaded version of your application to any of its environments from the application versions page.
To deploy an existing application version to an existing environment
Open the Elastic Beanstalk console.
Choose Actions next to the application name and then choose View Application Versions.
Select the application version that you want to deploy, and then click Deploy.
Choose an environment and then choose Deploy.