Upgrading An Elastic Beanstalk Platform

From Littledamien Wiki
Jump to navigation Jump to search

Overview

Over time Amazon Web Services will send notices that an Elastic Beanstalk's platform will no longer be supported in the future. Eventually the environment will be tagged as "deprecated" in the EBS console.

There is an option within the EBS console under Environment > Platform to "Change" the platform. This leads to a dialog with a dropdown menu of the available platform options. I have run into situations where the available options are all older than the current platform and so are all deprecated.

In these cases it is necessary to create a new EBS application and new EBS environments within that application. These environments will have the latest platforms. It may be true that some upgrades may require a new application, but see if the desired platform is available in a new EBS environment first. It is usually necessary to update the configuration of those environments to suit the different layout of the updated platform.

Create new EBS environment

Select tier

Select environment tier: Web server environment

Create a web server environment

Application name: Will create a new application for the environment. Try entering an existing application name?

Environment name: [Environment identifier]

Platform: Managed platform

Platform: Choose the platform for the environment, e.g. PHP, Python, etc. Platform branch: Version of the environment.

Application code: Sample application (this will be overwritten with eb deploy

Wait for the environment to be created. The status under Health will change from "pending" to "ok".

A new EC2 instance will be created for the new EBS environment.

Copy configuration

Copy any configuration stored in the old environment.

Environment > Configuration > Software > Edit > Environment Properties

Configure EC2 instance

Add inbound rules

  • EC2 console > Security Groups > Select EC2 instance from list
  • In the instance details below, click the Inbound rules tab.
  • Click Edit inbound rules
    • Add 3 rules:
    • HTTPS, source ::/0
    • SSH, source [REMOTE_IP]/32
    • HTTPS, source 0.0.0.0/0

Create a key pair

See Key Pairs in Enabling SSH Connections to an Elastic Beanstalk Environment

Deploy app

In the local project, update environment settings in .elasticbeanstalk/config.yml:

  • branch-defaults.develop.environment
  • branch-defaults.master.environment
  • environment-defaults
  • global.application_name
  • global.default_ec2_keyname
  • global.default_platform


Cleanup

Delete the old EBS environment and its EC2 instance as soon as possible to avoid unnecessary charges.