Unable to get IAM security credentials from EC2 Instance Metadata Service - .netcore AWS SDK

Viewed 669

I have a command line application that I am using to upload some files to AWS. I used the authentication example that

        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);

When it comes time to upload

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

I am getting a "Unable to get IAM security credentials from EC2 Instance Metadata Service" exception. This is running on my development desktop. The IAM user also has fullaccess to S3 and glacier for testing. Is there some configuration I am missing for my dev environment? I have also installed the AWS SDK Toolkit for VS2019 and verified the basic_profile can explore S3.

Thank you!

1 Answers

From the Documentation, it looks like your role needs glacier:UploadArchive:

enter image description here

Make sure your role has this permission. Or try running it as an Administer role to make sure there aren't any other problems.

Related