Advanced parameter store sharing parameters

0

Hi, I am want to try to use Advanced parameter store sharing parameters. I added to RAM an org sharing, also created an advanced parameter. My lambda in the member account still can't access it?

Error: Error: An error occurred (ParameterNotFound) when calling the GetParameter operation:

import boto3

def lambda_handler(event, context):
    # Initialize the SSM client
    ssm = boto3.client('ssm')
    
    # Specify the name of the parameter in Parameter Store
    parameter_name = '/test/shared'
    
    try:
        # Get the parameter value
        response = ssm.get_parameter(Name=parameter_name, WithDecryption=True)
        parameter_value = response['Parameter']['Value']
        
        # Print the parameter value
        print(f"Parameter value: {parameter_value}")
        
        return {
            'statusCode': 200,
            'body': f"Parameter value: {parameter_value}"
        }
    except Exception as e:
        # Print any errors that occur
        print(f"Error: {e}")
        
        return {
            'statusCode': 500,
            'body': f"Error: {e}"
        }
profile picture
已提問 2 個月前檢視次數 327 次
1 個回答
2

Make sure the Lambda function's execution role has the necessary permissions to access the SSM parameter, specifying the correct resource ARN in the policy and confirm that the Lambda function and the SSM parameter are in the same region.

You should have a policy similar to this attached to the role:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "ssm:GetParameter"
      ],
      "Resource": "arn:aws:ssm:<region>:<account-id>:parameter/test/shared"
    }
  ]
}
profile picture
專家
已回答 2 個月前
  • I am running into the same issue but don't know how to reference the shared ssm parameter arn into the CF Template

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南