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}"
        }
1 Answer
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
EXPERT
answered 2 months ago
  • I am running into the same issue but don't know how to reference the shared ssm parameter arn into the CF Template

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions