I have my ssm parameter store set up in one of the aws account (account Source). I want to access the parameters in another aws account (account target). Earlier parameter store did not directly allow to share parameter in cross account. I came across this article that says now paramter store can access parameters in cross account using Resource access manager
https://aws.amazon.com/about-aws/whats-new/2024/02/aws-systems-manager-parameter-store-cross-account-sharing/#:~:text=To%20share%20parameters%2C%20you%20add,see%20Working%20with%20shared%20parameters.
I have added my parameter in RAM in Source account and gave target account execution role permissions to access this parameter.
Now i need to fetch the parameters programatically.
def fetch_parameters(key):
ssm_client = build_client(service="ssm", region=get_aws_region())
result = ssm_client.get_parameters(Names=[ARN], WithDecryption=True))
return result["Parameters"][0]["Value"]
I’m executing this code from Target account and getting the following error:
IndexError: list index out of range
Can someone please guide on what’s missing. Thanks!