Skip to content

Instantly share code, notes, and snippets.

@flomotlik
Last active August 3, 2016 14:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save flomotlik/5b971aa7752d2c066d46af4797cff1db to your computer and use it in GitHub Desktop.
Save flomotlik/5b971aa7752d2c066d46af4797cff1db to your computer and use it in GitHub Desktop.

Setting the AWS API Key & Secret

To start using Serverless and access the AWS API you need to set the AWS API Access Key & Secret.

Quick Setup

As a quick setup to get started you can export them as environment variables so they will be accessible to Serverless and the AWS SDK in your shell:

export AWS_ACCESS_KEY_ID=<key>
export AWS_SECRET_ACCESS_KEY=<secret>
serverless deploy

Advanced and longer term

For a more permanent solution you can also set up credentials through the aws-cli, or by configuring the credentials file of the aws-cli directly. To set them up through the aws-cli install it first the run aws configure to configure the aws-cli and credentials. Serverless will automatically use those credentials. You can even set up a different profiles for different accounts, which can be used by Serverless as well.

$ aws configure
AWS Access Key ID [None]: AKIAIOSFODNN7EXAMPLE
AWS Secret Access Key [None]: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
Default region name [None]: us-west-2
Default output format [None]: ENTER

You can also edit the credentials file which is located in ~/.aws/credentials directly. Read more about that file in the AWS documentation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment