Providing AWS Credentials

To connect to any AWS service, you must provide your AWS credentials. The AWS SDKs and CLIs use provider chains to look for AWS credentials in a number of different places, including system or user environment variables and in local AWS configuration files.

The AWS Flow Framework for Ruby is based on the SDK for Ruby. The setup and specification of AWS credentials is the same for both. You can set your credentials for the SDK in a number of ways. The following are the recommended approaches:

  • Set credentials in the AWS credentials profile file on your local system, located at:

    • ~/.aws/credentials on Linux, OS X, or Unix
    • C:\Users\USERNAME\.aws\credentials on Windows

    This file contains lines in the following format:

    [default]
    AWS_ACCESS_KEY_ID = your_access_key_id
    AWS_SECRET_ACCESS_KEY = your_secret_access_key
    

    Note

    Substitute your own AWS credentials values for the values your_access_key_id and your_secret_access_key.

  • Set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.

    To set these variables on Linux, OS X, or Unix, use export:

    export AWS_ACCESS_KEY_ID=your_access_key_id
    export AWS_SECRET_ACCESS_KEY=your_secret_access_key
    

    To set these variables on Windows, use set:

    set AWS_ACCESS_KEY_ID=your_access_key_id
    set AWS_SECRET_ACCESS_KEY=your_secret_access_key
    
  • To set credentials for an EC2 instance, you should specify an IAM role and then give your EC2 instance access to that role.

Once you set your AWS credentials using one of these methods, you can load the credentials automatically using the AWS SDK for Ruby and the default credential provider chain.