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
preguntada hace 2 meses326 visualizaciones
1 Respuesta
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
EXPERTO
respondido hace 2 meses
  • I am running into the same issue but don't know how to reference the shared ssm parameter arn into the CF Template

No has iniciado sesión. Iniciar sesión para publicar una respuesta.

Una buena respuesta responde claramente a la pregunta, proporciona comentarios constructivos y fomenta el crecimiento profesional en la persona que hace la pregunta.

Pautas para responder preguntas