Unable to extract SSM parameters, AccessDeniedException

0

I'm attempting to get my Fargate Task to access an SSM store. The error I'm getting from cloud logs is:

Unable to Extract SSM parameters! AccessDeniedException: User: arn:aws:sts::9xxxxxxxxxxx:assumed-role/my-latest-fargate-role/b9b873c1d5e44520a58e26993e3bad63 is not authorized to perform: ssm:GetParameter on resource: arn:aws:ssm:us-west-2:9xxxxxxxxxx:parameter/my_url because no identity-based policy allows the ssm:GetParameter action

The resulting AIM role looks like this:

{
	"Version": "2012-10-17",
	"Statement": [
		{
			"Action": [
				"kms:Decrypt"
			],
			"Resource": "arn:aws:kms:us-west-2::key/*",
			"Effect": "Allow"
		},
		{
			"Action": [
				"ssm:GetParameter",
				"ssm:GetParameters",
				"ssm:DescribeParameters"
			],
			"Resource": "arn:aws:ssm:us-west-2::parameter/*",
			"Effect": "Allow"
		}
	]
}

I'm not certain why this isn't working. If it matters, the parameter itself is a plain text string, because I'm testing that before I try to extract encrypted ones.

I've confirmed that this role is attached to the right task. The entire deployment is going as expected. This is the only error I'm getting.

Typescript code is this in case that matters:

try {
    console.log("Attempting to extract parameters from AWS SSM");
    const ssmClient = new SSMClient({ region: 'us-west-2' });
    const command = {
        Name: 'name_of_parameter',
        WithDecryption: true
    };
    const request = new GetParameterCommand(command);
    const my_url = await ssmClient.send(request);
    console.log("extracted secret parameter", mongo_url);
    //@ts-ignore
    config.my_url = mongo_url.Parameter.Value || "could not extract value";
}
catch (e) {
    console.log("Unable to Extract SSM parameters!", e);
}
2개 답변
1

Hello.

Is it possible that the parameter store ARN is written incorrectly?
Looking at the document, it looks like this:
https://docs.aws.amazon.com/ja_jp/service-authorization/latest/reference/list_awssystemsmanager.html#awssystemsmanager-parameter

arn:${Partition}:ssm:${Region}:${Account}:parameter/${ParameterNameWithoutLeadingSlash}

In other words, don't you need to include the AWS Account ID as shown below?

arn:aws:ssm:us-west-2:AWS Account ID:parameter/*
profile picture
전문가
답변함 한 달 전
profile pictureAWS
전문가
검토됨 한 달 전
0

Hello, have you found a solution to this yet? I am encountering the same issue attempting to read an SSM parameter from a browser. https://repost.aws/questions/QU_m8virJwQKacrrt6YZa-Pg/access-denied-to-ssm-parameter-but-policy-in-place is related but none of the solutions proposed there worked for me.

답변함 3일 전

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

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

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

관련 콘텐츠