AWS Elastic Beanstalk Deployment
Travis CI can automatically deploy your application to Elastic Beanstalk after a successful build.
To deploy to AWS Elastic Beanstalk add the following to your
access-key-id: Encrypted AWS Access Key ID, obtained from your AWS Console.
secret-access-key: Encrypted AWS Secret Key, obtained from your AWS Console.
region: must be the region the Elastic Beanstalk application is running on, for example
app: Application name.
env: Elastic Beanstalk environment the application will be deployed to.
bucket_name: Bucket name to upload the code of your app to. Elastic Beanstalk will create and deploy an application version from the source bundle in this Amazon S3 bucket.
deploy: provider: elasticbeanstalk access_key_id: "Encrypted <access-key-id>=" secret_access_key: secure: "Encypted <secret-access-key>=" region: "us-east-1" app: "example-app-name" env: "example-app-environment" bucket_name: "the-target-S3-bucket"
Alternatively, use the Travis CI command line setup tool to add the deployment
travis setup elasticbeanstalk.
Creating an application without deploying it #
To create an application without deploying it, add
only_create_app_version: "true" to your
Optional settings #
zip_file: The zip file to deploy. You also need to set
skip_cleanupto prevent Travis CI deleting the zip file at the end of the build. If this is left unspecified, a zip file will be created from all the files that are part of the repository under test (determined with
bucket_path: Location within Bucket to upload app to.
Environment variables #
The following environment variables are available:
ELASTIC_BEANSTALK_ENV: Used if the
envkey is not set in your
ELASTIC_BEANSTALK_LABEL: Label name of the new version.
ELASTIC_BEANSTALK_DESCRIPTION: Description of the new version. Defaults to the last commit message.
Running commands before and after deploy #
Sometimes you want to run commands before or after deploying. You can use
after_deploy stages for this. These will only be
triggered if Travis CI is actually deploying.
before_deploy: "echo 'ready?'" deploy: .. after_deploy: - ./after_deploy_1.sh - ./after_deploy_2.sh