Setting Up an Environment Variable in AWS Elastic Beanstalk

Step 1: Access Elastic Beanstalk

Log in to your AWS console and navigate to Elastic Beanstalk. Select your application.

Step 2: Select Your Environment

Choose the specific environment of your application where you want to add the environment variable.

Step 3: Environment Configuration

On the environment summary page, locate the “Configuration” section.

Step 4: Modify Software Configuration

Under “Configuration,” find and select “Updates, monitoring, and logging.” Within this section, you will find the option to modify the software configuration or a similar link that will take you to where you can adjust environment variables.

Step 5: Add the Environment Variable

Look for the section labeled “Environment properties.” This is where you can add new environment variables.

  • Click on “Add new property” or simply find the text boxes ready to be filled with the name and value of your new environment variable.
  • For the variable DJANGO_SECRET_KEY, enter “DJANGO_SECRET_KEY” in the name field and the actual secret key in the value field.

Step 6: Save and Apply Changes

After entering the name and value of your environment variable, make sure to save your changes. AWS Elastic Beanstalk may need to perform a deployment to update your application with the new environment settings.

Step 7: Verification

Once AWS has completed the deployment, your environment variable DJANGO_SECRET_KEY will be active and accessible to your Django application in the specified environment.