aws-samples/aws-net-guides

Parameter Store Fails in Visual Studio 2019 v16.4.5

genifycom opened this issue · 2 comments

Created a DotNet Core 2.1 Console application and added <PackageReference Include="AWSSDK.SimpleSystemsManagement" Version="3.3.118.2" />

Made the changes to Program.cs as per the GitHub code and tried to run.
The error I get in the exception block is "Unable to get IAM security credentials from EC2 Instance Metadata Service."

How are we supposed to test this locally on a development machine?

When you run the code locally, you need to supply credentials so the sdk can call out to AWS services. When deployed, the code gets credentials automatically (provided a role is specified that as has AssumeRole privileges) so you don't deploy with, and risk, credentials leaving your local machine.

You can read more about setting up credential profiles containing simple access/secret key pairs in the sdk's user guide here. Create an IAM user with programmatic credentials in the AWS console and download the csv file containing the generated credentials to your local machine. Using the AWS Explorer inside Visual Studio (installed with the AWS Toolkit for Visual Studio), import the credential file and you should be good to run locally. The user guide for the toolkit can be found here.

Age of issue.