AWS Elastic Beanstalk Deployment
This page documents deployments using the next major version dpl v2 which currently is in a beta release phase. Please see our blog post for details. The current default version is dpl v1. Check dpl v1 documentation here.
Travis CI can automatically deploy your application to Elastic Beanstalk after a successful build.
For a minimal configuration, add the following to your
deploy: provider: elasticbeanstalk access_key_id: <encrypted access_key_id> secret_access_key: <encrypted secret_access_key> bucket: <bucket> edge: true # opt in to dpl v2
Support for deployments to AWS Elastic Beanstalk is *stable**.
Known options #
Use the following options to further configure the deployment.
||AWS Access Key ID — required, secret, type: string|
||AWS Secret Key — required, secret, type: string|
||AWS Region the Elastic Beanstalk app is running in — type: string, default:
||Elastic Beanstalk application name — type: string, default:
||Elastic Beanstalk environment name to be updated. — type: string|
||Bucket name to upload app to — required, type: string, alias:
||Location within Bucket to upload app to — type: string|
||Description for the application version — type: string|
||Label for the application version — type: string|
||The zip file that you want to deploy. If not given, a zipfile will be created from the current directory, honoring .ebignore and .gitignore. — type: string|
||Wait until the deployment has finished — type: boolean, requires:
||How many seconds to wait for Elastic Beanstalk deployment update. — type: integer, default:
Shared options #
||Clean up build artifacts from the Git working directory before the deployment — type: boolean|
||Commands to execute after the deployment finished successfully — type: string or array of strings|
Environment variables #
All options can be given as environment variables if prefixed with
access_key_id can be given as
Securing secrets #
Secret option values should be given as either encrypted strings in your build
.travis.yml file) or environment variables in your repository
Environment variables can be set on the settings page of your repository, or
travis env set:
travis env set AWS_ACCESS_KEY_ID <access_key_id>
In order to encrypt option values when adding them to your
travis encrypt <access_key_id>
--add to directly add it to your
.travis.yml file. Note that this command has to be run in your repository’s root directory:
travis encrypt --add deploy.access_key_id <access_key_id>
Creating an application without deploying it #
To create an application without deploying it, use
deploy: provider: elasticbeanstalk # ⋮ only_create_app_version: true
Controlling which files are included in the ZIP archive #
You can control which files are included in the ZIP archive you upload with
.gitignore, as described in the AWS CLI documentation.
Pull Requests #
Note that pull request builds skip the deployment step altogether.