【问题标题】:Unable to get IAM security credentials from EC2 Instance Metadata Service - .netcore AWS SDK无法从 EC2 实例元数据服务获取 IAM 安全凭证 - .netcore AWS SDK
【发布时间】:2021-01-11 04:00:51
【问题描述】:

我有一个命令行应用程序,用于将一些文件上传到 AWS。我使用的身份验证示例

        var options = new CredentialProfileOptions
        {
            AccessKey = "bleh",
            SecretKey = "bleh"
        };
        var profile = new CredentialProfile("basic_profile", options);
        profile.Region = RegionEndpoint.USEast2;
        var netSDKFile = new NetSDKCredentialsFile();
        netSDKFile.RegisterProfile(profile);
        var manager = new ArchiveTransferManager(Amazon.RegionEndpoint.USEast2);

何时上传

archiveToUpload = System.IO.Path.Combine(record.FolderName, record.FileName);
string archiveId = manager.UploadAsync(vaultName, "upload archivetest",archiveToUpload).Result.ArchiveId;

我收到“无法从 EC2 实例元数据服务获取 IAM 安全凭证”异常。这是在我的开发桌面上运行的。 IAM 用户还可以完全访问 S3 和 glacier 以进行测试。我的开发环境是否缺少一些配置?我还安装了适用于 VS2019 的 AWS SDK Toolkit 并验证 basic_profile 可以探索 S3。

谢谢!

【问题讨论】:

    标签: c# amazon-web-services .net-core aws-sdk amazon-glacier


    【解决方案1】:

    Documentation看来,您的角色需要glacier:UploadArchive

    确保您的角色拥有此权限。或者尝试以管理员角色运行它以确保没有任何其他问题。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-11-22
      • 2017-04-22
      • 1970-01-01
      • 2022-01-15
      • 1970-01-01
      • 2018-01-07
      相关资源
      最近更新 更多