小编Rob*_*son的帖子

AWS DotNet SDK 错误:无法从 EC2 实例元数据服务获取 IAM 安全凭证

我使用这里的示例从AWS SecretsManager 中检索 c# 代码中的机密。

我已经通过 AWS CLI 在本地设置了凭证,并且能够使用 AWS CLI 命令“aws secretsmanager list-secrets”检索秘密列表。

但是 c# 控制台应用程序失败并出现错误:

> Unhandled exception. System.AggregateException: One or more errors occurred. (Unable to get IAM security credentials from EC2 Instance Metadata Service.)
 ---> Amazon.Runtime.AmazonServiceException: Unable to get IAM security credentials from EC2 Instance Metadata Service.
   at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.FetchCredentials()
   at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.GetCredentials()
   at Amazon.Runtime.DefaultInstanceProfileAWSCredentials.GetCredentialsAsync()
   at Amazon.Runtime.Internal.CredentialsRetriever.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.RetryHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.CallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.ErrorCallbackHandler.InvokeAsync[T](IExecutionContext executionContext)
   at Amazon.Runtime.Internal.MetricsHandler.InvokeAsync[T](IExecutionContext executionContext)
   --- …
Run Code Online (Sandbox Code Playgroud)

.net sdk credentials amazon-web-services

11
推荐指数
7
解决办法
2万
查看次数

标签 统计

.net ×1

amazon-web-services ×1

credentials ×1

sdk ×1