Documentation ¶
Index ¶
Constants ¶
const ( ALTERNATE_CREDENTIAL_PROFILE_ENV_VAR = "ECS_ALTERNATE_CREDENTIAL_PROFILE" DEFAULT_CREDENTIAL_PROFILE = "default" RotatingSharedCredentialsProviderName = "RotatingSharedCredentialsProvider" )
Variables ¶
This section is empty.
Functions ¶
func NewInstanceCredentialsCache ¶
func NewInstanceCredentialsCache( isExternal bool, rotatingSharedCreds aws.CredentialsProvider, imdsClient ec2rolecreds.GetMetadataAPIClient, ) *aws.CredentialsCache
NewInstanceCredentialsCache returns a chain of instance credentials providers wrapped in a credentials cache. The instance credentials chain is the default credentials chain plus the "rotating shared credentials provider", so credentials will be checked in this order:
- Env vars (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY).
- Shared credentials file (https://docs.aws.amazon.com/ses/latest/DeveloperGuide/create-shared-credentials-file.html) (file at ~/.aws/credentials containing access key id and secret access key).
- EC2 role credentials. This is an IAM role that the user specifies when they launch their EC2 container instance (ie ecsInstanceRole (https://docs.aws.amazon.com/AmazonECS/latest/developerguide/instance_IAM_role.html)).
- Rotating shared credentials file located at /rotatingcreds/credentials
Types ¶
type InstanceCredentialsProvider ¶
type InstanceCredentialsProvider struct {
// contains filtered or unexported fields
}
func (*InstanceCredentialsProvider) Retrieve ¶
func (p *InstanceCredentialsProvider) Retrieve(ctx context.Context) (aws.Credentials, error)
type RotatingSharedCredentialsProvider ¶
type RotatingSharedCredentialsProvider struct { // contains filtered or unexported fields }
RotatingSharedCredentialsProvider is a provider that retrieves credentials via the shared credentials provider, and adds the functionality of expiring and re-retrieving those credentials from the file.
func NewRotatingSharedCredentialsProvider ¶
func NewRotatingSharedCredentialsProvider() *RotatingSharedCredentialsProvider
NewRotatingSharedCredentials returns a rotating shared credentials provider with default values set.
func (*RotatingSharedCredentialsProvider) Retrieve ¶
func (p *RotatingSharedCredentialsProvider) Retrieve() (credentials.Value, error)
Retrieve will use the given filename and profile and retrieve AWS credentials.
type RotatingSharedCredentialsProviderV2 ¶
type RotatingSharedCredentialsProviderV2 struct { // contains filtered or unexported fields }
RotatingSharedCredentialsProviderV2 is a provider that retrieves credentials from the shared credentials file and adds the functionality of expiring and re-retrieving those credentials from the file. TODO (@tiffwang): Remove V2 suffix after the credentials package is fully migrated to aws-sdk-go-v2.
func NewRotatingSharedCredentialsProviderV2 ¶
func NewRotatingSharedCredentialsProviderV2() *RotatingSharedCredentialsProviderV2
NewRotatingSharedCredentials returns a rotating shared credentials provider with default values set.
func (*RotatingSharedCredentialsProviderV2) Retrieve ¶
func (p *RotatingSharedCredentialsProviderV2) Retrieve(ctx context.Context) (aws.Credentials, error)
Retrieve will use the given filename and profile and retrieve AWS credentials.