How to enable application version lifecycle policy in Elastic Beanstalk
Welcome to CloudAffaire and this is Debjeet.
In the last blog post, we have discussed how to deploy a new application version in Elastic Beanstalk.
In this blog post, we will discuss how to enable application version lifecycle policy in Elastic Beanstalk.
Application version lifecycle policy in Elastic Beanstalk:
Each time you upload a new version of your application with the Elastic Beanstalk console or the EB CLI, Elastic Beanstalk creates an application version. If you don’t delete versions that you no longer use, you will eventually reach the application version limit (max 1000 application versions for all applications in a region) and be unable to create new versions of that application. Elastic Beanstalk supports. You can avoid hitting the limit by applying an application version lifecycle policy to your applications.
A lifecycle policy tells Elastic Beanstalk to delete application versions that are old, or to delete application versions when the total number of versions for an application exceeds a specified number. Elastic Beanstalk applies an application’s lifecycle policy each time you create a new application version, and deletes up to 100 versions each time the lifecycle policy is applied. Elastic Beanstalk does not delete application versions that are currently being used by an environment, or application versions deployed to environments that were terminated less than ten weeks before the policy was triggered.
Next, we are going to create a lifecycle policy for our PHP web application versions.
Prerequisite for this demo:
- PHP web application deployed to Elastic Beanstalk (as per previous blog post)
Step 1: Login to the AWS console and navigate to ‘Elastic Beanstalk’.
Step 2: From ‘Actions’ click ‘View application versions’.
Step 3: Click ‘Settings’ to enable lifecycle policy.
Step 4: Provide lifecycle policy details and click ‘Save’.
Note: Version lifecycle policy can be defined either on number or age of versions. You can also define retention policy of application version files in S3 once the version is expired.
Hope you have enjoyed this article. In the next blog post, we will discuss how to create a new application environment in Elastic Beanstalk configurations.
To get more details on AWS Elastic Beanstalk, please refer below AWS documentation