gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-05 07:00:45 25 4
gpt4 key购买 nike

我有一个命令行应用程序,用于将一些文件上传到 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 和冰川进行测试。我的开发环境是否缺少某些配置?我还安装了适用于 VS2019 的 AWS SDK 工具包并验证了 basic_profile 可以探索 S3。

谢谢!

最佳答案

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

enter image description here

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

关于c# - 无法从 EC2 实例元数据服务获取 IAM 安全凭证 - .netcore AWS SDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64053577/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com