Container credential provider - AWS SDKs and Tools (original) (raw)
The container credential provider fetches credentials for customer's containerized application. This credential provider is useful for Amazon Elastic Container Service (Amazon ECS) and Amazon Elastic Kubernetes Service (Amazon EKS) customers. SDKs attempt to load credentials from the specified HTTP endpoint through a GET request.
If you use Amazon ECS, we recommend you use a task IAM Role for improved credential isolation, authorization, and auditability. When configured, Amazon ECS sets theAWS_CONTAINER_CREDENTIALS_RELATIVE_URI
environment variable that the SDKs and tools use to obtain credentials. To configure Amazon ECS for this functionality, see Task IAM role in the Amazon Elastic Container Service Developer Guide.
If you use Amazon EKS, we recommend you use Amazon EKS Pod Identity for improved credential isolation, least privilege, auditability, independent operation, reusability, and scalability. Both your Pod and an IAM role are associated with a Kubernetes service account to manage credentials for your applications. To learn more on Amazon EKS Pod Identity, see Amazon EKS Pod Identities in the__Amazon EKS User Guide_. When configured, Amazon EKS sets theAWS_CONTAINER_CREDENTIALS_FULL_URI
andAWS_CONTAINER_AUTHORIZATION_TOKEN_FILE
environment variables that the SDKs and tools use to obtain credentials. For setup information, see Setting up the Amazon EKS Pod Identity Agent in the _Amazon EKS User Guide or Amazon EKS Pod Identity simplifies IAM permissions for applications on Amazon EKS clusters at the AWS Blog website.
Configure this functionality by using the following:
AWS_CONTAINER_CREDENTIALS_FULL_URI
- environment variable
Specifies the full HTTP URL endpoint for the SDK to use when making a request for credentials. This includes both the scheme and the host.
Default value: None.
Valid values: Valid URI.
Note: This setting is an alternative toAWSCONTAINERCREDENTIALSRELATIVEURI
and will only be used if AWSCONTAINERCREDENTIALSRELATIVEURI
is not set.
Linux/macOS example of setting environment variables via command line:
export AWS_CONTAINER_CREDENTIALS_FULL_URI=http://localhost/get-credentials
or
export AWS_CONTAINER_CREDENTIALS_FULL_URI=http://localhost:8080/get-credentials
AWS_CONTAINER_CREDENTIALS_RELATIVE_URI
- environment variable
Specifies the relative HTTP URL endpoint for the SDK to use when making a request for credentials. The value is appended to the default Amazon ECS hostname of169.254.170.2
.
Default value: None.
Valid values: Valid relative URI.
Linux/macOS example of setting environment variables via command line:
export AWS_CONTAINER_CREDENTIALS_RELATIVE_URI=/get-credentials?a=1
AWS_CONTAINER_AUTHORIZATION_TOKEN
- environment variable
Specifies an authorization token in plain text. If this variable is set, the SDK will set the Authorization header on the HTTP request with the environment variable's value.
Default value: None.
Valid values: String.
Note: This setting is an alternative toAWSCONTAINERAUTHORIZATIONTOKENFILE
and will only be used if AWSCONTAINERAUTHORIZATIONTOKENFILE
is not set.
Linux/macOS example of setting environment variables via command line:
export AWS_CONTAINER_CREDENTIALS_FULL_URI=http://localhost/get-credential
export AWS_CONTAINER_AUTHORIZATION_TOKEN=Basic abcd
AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE
- environment variable
Specifies an absolute file path to a file that contains the authorization token in plain text.
Default value: None.
Valid values: String.
Linux/macOS example of setting environment variables via command line:
export AWS_CONTAINER_CREDENTIALS_FULL_URI=http://localhost/get-credential
export AWS_CONTAINER_AUTHORIZATION_TOKEN_FILE=/path/to/token
Support by AWS SDKs and tools
The following SDKs support the features and settings described in this topic. Any partial exceptions are noted. Any JVM system property settings are supported by the AWS SDK for Java and the AWS SDK for Kotlin only.