AWS Elastic Beanstalk: Difference between revisions
| (9 intermediate revisions by the same user not shown) | |||
| Line 3: | Line 3: | ||
=== Web application configuration files === | === Web application configuration files === | ||
Configuration is stored in ` | ==== AWS eb cli configuration ==== | ||
Configuration is stored in `.elasticbeanstalk/config.yml`. | |||
This file should ''not'' be included in git repo. | This file should ''not'' be included in git repo. | ||
The Elastic Beanstalk (EBS) application and environment names are specified in this yaml file. This is determines these properties for the AWS `eb cli`. | The Elastic Beanstalk (EBS) application and environment names are specified in this yaml file. This is determines these properties for the AWS `eb cli`. | ||
By default, `eb deploy` will upload all files in the git repo. | |||
==== Server configuration ==== | |||
`.config` files in `.ebextensions/` contain server configuration directives. <ref>[https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/ebextensions.html Advanced environment customization with configuration files (.ebextensions)] - AWS documentation</ref> | |||
Files are processed in alphabetical order. | |||
The directives in the files are processed on the server. The config files are uploaded to a staging directory, e.g. `/var/app/staging/` where they are executed. They are not moved to the web root directory with the rest of the web app files. | |||
==== Uploading a distribution outside of git ==== | |||
To upload another installation, e.g. wiki files, specify a zip archive to upload to the server in `.elasticbeanstalk/config.yml`: | |||
<syntaxhighlight lang="yaml"> | |||
deploy: | |||
artifact: name_of_archive.zip | |||
</syntaxhighlight> | |||
`eb deploy` will look in the project root for the zip file. | |||
If it is necessary to upload `.ebextensions` config files, these files must be added to the root of the zipped distribution. | |||
=== Security rules === | === Security rules === | ||
| Line 20: | Line 45: | ||
=== Web app environment variables === | === Web app environment variables === | ||
Any variables needed by the app can be stored here. E.g. `LETSENCRYPT_DOMAIN` for the purposes of installing a security certificate, or RDS connection properties. | |||
* '''AWS Management Console''' > '''Elastic Beanstalk''' > ''web app environment'' > '''Configuration''' > '''Software''' Group > '''Edit''' | * '''AWS Management Console''' > '''Elastic Beanstalk''' > ''web app environment'' > '''Configuration''' > '''Software''' Group > '''Edit''' | ||
* Scroll down to '''Environment Properties''' at the bottom | * Scroll down to '''Environment Properties''' at the bottom | ||
* Enter key/value pairs as needed | * Enter key/value pairs as needed | ||
<p class="alert alert-info">These key/value pairs can be created in an `.ebextensions` config file, but should be created manually if they contain sensitive information.</p> | |||
== Deployment == | |||
Use the [https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3.html Elastic Beanstalk Command Line Interface (EB CLI)] to deploy applications to EBS. See [[#AWS_eb_cli_configuration| AWS eb cli configuration]] for `eb cli` configuration. | |||
From the root of the local application directory: | |||
<pre> | |||
$ eb deploy | |||
</pre> | |||
== Upgrading the platform of an Elastic Beanstalk instance == | == Upgrading the platform of an Elastic Beanstalk instance == | ||
| Line 34: | Line 73: | ||
== Troubleshooting == | == Troubleshooting == | ||
See [[Troubleshooting Elastic Beanstalk Deployment]] | |||
== Notes == | |||
<references /> | |||
[[Category:AWS]] [[Category:Elastic Beanstalk]] [[Category:Web Development]] | [[Category:AWS]] [[Category:Elastic Beanstalk]] [[Category:Web Development]] | ||
Latest revision as of 23:28, 3 July 2021
Configuration[edit]
Web application configuration files[edit]
AWS eb cli configuration[edit]
Configuration is stored in .elasticbeanstalk/config.yml.
This file should not be included in git repo.
The Elastic Beanstalk (EBS) application and environment names are specified in this yaml file. This is determines these properties for the AWS eb cli.
By default, eb deploy will upload all files in the git repo.
Server configuration[edit]
.config files in .ebextensions/ contain server configuration directives. [1]
Files are processed in alphabetical order.
The directives in the files are processed on the server. The config files are uploaded to a staging directory, e.g. /var/app/staging/ where they are executed. They are not moved to the web root directory with the rest of the web app files.
Uploading a distribution outside of git[edit]
To upload another installation, e.g. wiki files, specify a zip archive to upload to the server in .elasticbeanstalk/config.yml:
deploy:
artifact: name_of_archive.zip
eb deploy will look in the project root for the zip file.
If it is necessary to upload .ebextensions config files, these files must be added to the root of the zipped distribution.
Security rules[edit]
AWS Console > EC2 > instances > instance linked to EBS environment > details > click on security group > inbound rules tab
Open up the SSH port (22) to specific public IP of the local development LAN. e.g. XX.XX.XX.XX/32 where XX.XX.XX.XX is the IPv4 public address.
Open up the HTTPS port (443) to all IP addresses, e.g. 0.0.0.0/0 and ::/0
.ebextensions config file. See Open the HTTPS port for Let's Encrypt certificates.Web app environment variables[edit]
Any variables needed by the app can be stored here. E.g. LETSENCRYPT_DOMAIN for the purposes of installing a security certificate, or RDS connection properties.
- AWS Management Console > Elastic Beanstalk > web app environment > Configuration > Software Group > Edit
- Scroll down to Environment Properties at the bottom
- Enter key/value pairs as needed
These key/value pairs can be created in an .ebextensions config file, but should be created manually if they contain sensitive information.
Deployment[edit]
Use the Elastic Beanstalk Command Line Interface (EB CLI) to deploy applications to EBS. See AWS eb cli configuration for eb cli configuration.
From the root of the local application directory:
$ eb deploy
Upgrading the platform of an Elastic Beanstalk instance[edit]
- AWS Management Console > Compute > Elastic Beanstalk
- Click on an EB instance
- Under Platform on the left click the Change button.
- Select the new platform from the dropdown and click Save
Troubleshooting[edit]
See Troubleshooting Elastic Beanstalk Deployment
Notes[edit]
- ↑ Advanced environment customization with configuration files (.ebextensions) - AWS documentation