Open benfmiller opened 2 months ago
@benfmiller Good afternoon. Are you referring to scenario where you replace instance profile for an EC2 instance, e.g. How do I attach or replace an instance profile on an Amazon EC2 instance??
@ashishdhingra Good afternoon. Yep, replacing the instance profile for an EC2 instance.
When we use the InstanceProfileAWSCredentials
to make sure we only use the instance profile, it won't pick up the new instance profile after it is replaced.
If we use the default credentials (not explicitly create any credentials) it successfully picks up the new instance profile after it is replaced, but it could accidentally pick up different credentials from the Credential search order. We don't control the environment the application is running in, so we want to make sure it always uses instance profile role.
Describe the feature
Allow specifying which
AWSCredentials
source to use so that we can ensure our application only uses credentials from one source (instance profile).Use Case
We are currently using
InstanceProfileAWSCredentials
to make sure we only get credentials from the instance profile. This has the downside that if the instance profile associated with the EC2 instance is changed, then the .NET application will still attempt to retrieve credentials for the old instance profile and fail. The new instance profile is only picked up after the application is restarted.We want to prevent any other credential source from being used but still automatically refresh the instance profile after a different instance profile is associated with the EC2 instance. (Skip to the last entry (Amazon EC2 instance metadata) in the Credential and profile resolution)
Proposed Solution
Add an option to
AWSConfigs
likeAWSProfileOnlyInstanceProfile
so that we can use the default way to get/refresh credentials but still prevent credentials from different sources from accidentally being used.Other Information
Error message trying to
s3:PutObject
usingInstanceProfileAWSCredentials
after a different instance profile is associated with the EC2 instanceAcknowledgements
AWS .NET SDK and/or Package version used
AWSSDK.Core 3.7.0.17
Targeted .NET Platform
.NET framework 4.7.2
Operating System and version
Windows 10