
When I try to run this, I get the following error : System.AggregateException: ' OS/Microsoft_Windows_6.)'ĪmazonServiceException: Unable to get IAM security credentials from EC2 Instance Metadata Service. String decodedBinarySecret = 8.GetString(Convert.FromBase64String(reader.ReadToEnd())) StreamReader reader = new StreamReader(memoryStream) Depending on whether the secret is a string or binary, one of these fields will be populated. Decrypts secret using the associated KMS CMK. More than one of the above exceptions were triggered. We can't find the resource that you asked for. You provided a parameter value that is not valid for the current state of the resource. Deal with the exception here, and/or rethrow at your discretion You provided an invalid value for a parameter. Deal with the exception here, and/or rethrow at your discretion. Secrets Manager can't decrypt the protected secret text using the provided KMS key. Response = client.GetSecretValueAsync(request).Result In this sample we only handle the specific exceptions for the 'GetSecretValue' API. Request.VersionStage = "AWSCURRENT" // VersionStage defaults to AWSCURRENT if unspecified. GetSecretValueRequest request = new GetSecretValueRequest() IAmazonSecretsManager client = new AmazonSecretsManagerClient((new StoredProfileAWSCredentials())) IAmazonSecretsManager client = new AmazonSecretsManagerClient(RegionEndpoint.GetBySystemName(region))

MemoryStream memoryStream = new MemoryStream()
#Aws toolkit for visual studio 2019 code
Here is the code that is supposed to be used : public static void GetSecret() Once configured in the AWS Secrets manager console, I tried using their sample code to retrieve the secrets that I stored.

I am using AWS Secrets manager to store some API keys.
