Use an API key with Credential Broker
This is prerelease documentation for a service in preview release. It is subject to change.
Use an API key provider when the external service accepts only a static API key and does not
support OAuth. Your workload calls GetApiKey with its own AWS IAM credentials,
and an IAM policy controls which workloads can retrieve the key. Credential Broker holds the
key centrally instead of leaving it in your workload's configuration.
A credential provider holds one type of credential, either OAuth or an API key, and its type is fixed when you create the provider. An API key provider holds one API key.
Key characteristics
An API key provider has the following characteristics:
-
The external service accepts a static API key rather than OAuth
-
There is no end user, no consent prompt, and no token exchange
-
The provider holds one API key, and its type is fixed when you create it
-
Your workload retrieves the key with
GetApiKeyusing its own AWS IAM credentials
Example scenario
An application that runs on Lambda calls an external service that authenticates with a static API key. There is no end user; the application calls the service as itself.
-
Priya (identity admin) creates a credential provider pool and an API key provider that holds the key for the external service, and grants the application's role permission to call the broker.
-
Diego (application developer) calls the broker from the application with the provider ARN. He stores no API key in the application's configuration. Credential Broker returns the API key, which the application uses to call the external service.
How it works
At runtime, your workload retrieves the API key in a single call.
To retrieve an API key
-
Call
GetApiKeywith the provider ARN. The response returns the API key. -
Use the API key to call the external service.
The following example retrieves an API key with the AWS CLI.
aws credential-broker get-api-key \ --region us-east-1 \ --credential-provider-arn <providerArn>
Set up
To set up an API key provider, create a credential provider in your credential provider pool and enter the API key.
To create an API key provider
-
In the credential provider pool, create a credential provider.
-
For Credential type, choose API key.
-
For API key source, choose Enter a new API key, and then enter the API key value. Credential Broker stores the key in a managed AWS Secrets Manager secret.
(Optional) For API key source, you can instead choose an existing AWS Secrets Manager secret that contains your API key. When you do, you control that secret's encryption, rotation, tags, and other settings.
For a worked example that configures a credential provider and retrieves a credential, see Getting started: Set up your first credential provider.
Permissions
The caller needs the credentialbroker:GetApiKey action on the API key
provider's ARN. For an example policy for this flow, see Control access to AWS IAM Credential Broker.