Upgrading An Elastic Beanstalk Platform: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
Tag: wikieditor
 
(4 intermediate revisions by the same user not shown)
Line 44: Line 44:
* Click '''Edit inbound rules'''
* Click '''Edit inbound rules'''
** Add 3 rules:  
** Add 3 rules:  
** HTTPS, source ::/0
** HTTPS, source ::/0 (Anywhere IPv6)
** SSH,  source [REMOTE_IP]/32
** HTTPS, source 0.0.0.0/0 (Anywhere IPv4)
** HTTPS, source 0.0.0.0/0
** SSH,  source [REMOTE_IP]/32 (My IP)


==== Create a key pair ====
==== Create a key pair ====


See [[Enabling_SSH_Connections_to_an_Elastic_Beanstalk_Environment#Key_Pairs|Key Pairs]] in [[Enabling SSH Connections to an Elastic Beanstalk Environment]]
See [[Enabling_SSH_Connections_to_an_Elastic_Beanstalk_Environment#Key_Pairs|Key Pairs]] in [[Enabling SSH Connections to an Elastic Beanstalk Environment]]
=== Update DNS ===
* '''Route 53''' console > '''Hosted zones''' > ''Select domain name'' > '''View Details''' button
* Select a hosted subdomain > '''Edit record''' button > Select the new EBS environment under '''Route traffic to'''
=== Configure security certificates ===
See [[Elastic Beanstalk Security Certificates]]


=== Deploy app ===
=== Deploy app ===
==== Update ESB environment app settings ====


In the local project, update environment settings in `.elasticbeanstalk/config.yml`:
In the local project, update environment settings in `.elasticbeanstalk/config.yml`:
Line 63: Line 74:
* `global.default_platform`
* `global.default_platform`


==== Confirm GitHub access, if needed ====
If the deployment requires installing anything from private GitHub repos, confirm that [[Troubleshooting_Elastic_Beanstalk_Deployment#Errors_running_composer_install|the GitHub personal access token has not expired]].
==== Deploy the app using eb-cli ====
Deploy the app with
<syntaxhighlight lang="bash">
$ eb deploy
</syntaxhighlight>
Or with the `--staged` option if files have been modified but not pushed to remote yet. The files have to be added to the commit to be included.
<syntaxhighlight lang="bash">
$ eb deploy --staged
</syntaxhighlight>


=== Cleanup ===
=== Cleanup ===

Latest revision as of 20:49, 21 August 2022

Overview[edit]

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[edit]

Select tier[edit]

Select environment tier: Web server environment

Create a web server environment[edit]

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[edit]

Copy any configuration stored in the old environment.

Environment > Configuration > Software > Edit > Environment Properties

Configure EC2 instance[edit]

Add inbound rules[edit]

  • 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 (Anywhere IPv6)
    • HTTPS, source 0.0.0.0/0 (Anywhere IPv4)
    • SSH, source [REMOTE_IP]/32 (My IP)

Create a key pair[edit]

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

Update DNS[edit]

  • Route 53 console > Hosted zones > Select domain name > View Details button
  • Select a hosted subdomain > Edit record button > Select the new EBS environment under Route traffic to

Configure security certificates[edit]

See Elastic Beanstalk Security Certificates

Deploy app[edit]

Update ESB environment app settings[edit]

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

Confirm GitHub access, if needed[edit]

If the deployment requires installing anything from private GitHub repos, confirm that the GitHub personal access token has not expired.

Deploy the app using eb-cli[edit]

Deploy the app with

$ eb deploy

Or with the --staged option if files have been modified but not pushed to remote yet. The files have to be added to the commit to be included.

$ eb deploy --staged

Cleanup[edit]

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