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

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则