C# 无法从EC2实例元数据服务获取IAM安全凭据-。netcore AWS SDK

C# 无法从EC2实例元数据服务获取IAM安全凭据-。netcore AWS SDK,c#,amazon-web-services,.net-core,aws-sdk,amazon-glacier,C#,Amazon Web Services,.net Core,Aws Sdk,Amazon Glacier,我有一个命令行应用程序,我正在使用它将一些文件上传到AWS。我使用了身份验证示例 var options = new CredentialProfileOptions { AccessKey = "bleh", SecretKey = "bleh" }; var profile = new CredentialProfile("basi

我有一个命令行应用程序,我正在使用它将一些文件上传到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工具包,并验证了基本的_配置文件可以浏览S3

谢谢大家!

从中,您的角色似乎需要
glacier:UploadArchive

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