I have AWS Lambda NET6 function and AWS PS parameters: RDS Connection string Swagger enabled Cognito Authority
When I run it locally (LocalEntryPoint) and read parameters - it works fine. When run the Lambda from AWS it cannot read PS and gives me an error:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Amazon.SimpleSystemsManagement.AmazonSimpleSystemsManagementException: User: arn:aws:sts::074xxxxxxx:assumed-role/pm2supplier-stack-AspNetCoreFunctionRole-13TO039VZBQ7Y/pm2suppliers is not authorized to perform: ssm:GetParametersByPath on resource: arn:aws:ssm:eu-west-2:074xxxxxxxxx:parameter/PM2AWSLambda/ because no identity-based policy allows the ssm:GetParametersByPath action
How to fix it?
You need to add permission to the Lambda execution role to allow making read calls to the SSM service.
Hope this helps.