Configuration
With Amazon SDKs and other Amazon developer tools, such as the Amazon Command Line Interface (Amazon CLI), you can interact with Amazon service APIs. Before attempting that, however, you must configure the SDK or tool with the information that it needs to perform the requested operation.
This information includes the following items:
-
Credentials information that identifies who is calling the API. The credentials are used to encrypt the request to the Amazon servers. Using this information, Amazon confirms your identity and can retrieve permissions policies associated with it. Then it can determine what actions you're allowed to perform.
-
Other configuration details that you use to tell the Amazon CLI or SDK how to process the request, where to send the request (to which Amazon service endpoint), and how to interpret or display the response.
Each SDK or tool supports multiple sources that you can use to supply the required credential and configuration information. Some sources are unique to the SDK or tool, and you must refer to the documentation for that tool or SDK for the details on how to use that method.
However, most of the Amazon SDKs and tools support common settings from two primary sources (beyond the code itself):
-
Shared Amazon config and credentials files – The shared
config
andcredentials
files are the most common way that you can specify authentication and configuration to an Amazon SDK or tool. Use these files to store settings that your tools and applications can use. Settings within the sharedconfig
andcredentials
files are associated with a specific profile. With multiple profiles, you can create different settings configurations to apply in different scenarios. When you use an Amazon tool to invoke a command or use an SDK to invoke an Amazon API, you can specify which profile, and thus which configuration settings, to use for that action. One of the profiles is designated as thedefault
profile and is used automatically when you don't explicitly specify a profile to use. The settings that you can store in these files are documented in this reference guide. -
Environment variables – Some of the settings can alternatively be stored in the environment variables of your operating system. Although you can have only one set of environment variables in effect at a time, they are easily modified dynamically as your program runs and your requirements change.