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.
Be sure to read the v2 deployment overview.
Travis CI can automatically deploy files to AWS CloudFormation after a successful build.
For a minimal configuration, add the following to your
deploy: provider: cloudformation access_key_id: <encrypted access_key_id> secret_access_key: <encrypted secret_access_key> template: <template> stack_name: <stack_name> edge: true # opt in to dpl v2
Support for deployments to AWS CloudFormation 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 to deploy to — type: string, default:
||CloudFormation template file — required, type: string, note: can be either a local path or an S3 URL|
||CloudFormation Stack Name. — required, type: string|
||CloudFormation Stack Name Prefix. — type: string|
||Deploy changes — type: boolean, default:
||AWS Role ARN — type: string|
||AWS Role ARN for cross account deployments (assumed by travis using given AWS credentials). — type: string|
||CloudFormation allowed capabilities — type: string or array of strings, known values:
||Wait for CloutFormation to finish the stack creation and update — type: boolean, default:
||How many seconds to wait for stack creation and update. — type: integer, default:
||How many seconds to wait before the stack status becomes CREATE_FAILED — type: integer, default:
||key=value pairs or ENV var names — type: string or array of strings|
||Path to output file to store CloudFormation outputs to — type: string|
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>
Pull Requests #
Note that pull request builds skip the deployment step altogether.