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개 답변
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

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠