Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in AWS by (19.1k points)

I am trying to get travis-ci to run a custom deploy script that uses awscli to push a deployment up to my staging server.

In my .travis.yml file I have this:

before_deploy:

  - 'curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"'

  - 'unzip awscli-bundle.zip'

  - './awscli-bundle/install -b ~/bin/aws'

  - 'export PATH=~/bin:$PATH'

  - 'aws configure'

And I have set up the following environment variables:

AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY

AWS_DEFAULT_REGION

with their correct values in the travis-ci web interface.

However, when the aws configure runs, it stops and waits for user input. How can I tell it to use the environment variables I have defined?

1 Answer

0 votes
by (119k points)
edited by

You can set these in a couple of ways.

First, create a file at ~/.aws/config (or ~/.aws/credentials).

For example:

[default]

aws_access_key_id=foo

aws_secret_access_key=bar

region=us-west-2

Secondly, you can add environment variables for each of your settings.

For example, create the following environment variables:

AWS_DEFAULT_REGION

AWS_ACCESS_KEY_ID

AWS_SECRET_ACCESS_KEY

Thirdly, you can pass the region in as a command-line argument. For example:

aws eb deploy --region us-west-2

You don't require to run AWS configure in these cases as the cli is configured.

If you want to learn more, check out this AWS Certification by Intellipaat.

Related questions

Want to get 50% Hike on your Salary?

Learn how we helped 50,000+ professionals like you !

0 votes
1 answer
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...