Public SSM parameter and CloudFormation

0

Hi, I am using image builder to fetch latest ami and SSM:

Parameters: LatestAmiId: Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>' Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'

In order to fetch the latest AMI do I need all the time update the CF stack?

BR, M

1개 답변
1
수락된 답변

Yes, your stack won't be automatically updated when the parameter value changes (which is desired behavior I think).

From https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html

CloudFormation doesn't currently support drift detection on dynamic references. For ssm dynamic references where you haven't specified the parameter version, we recommend that, if you update the parameter version in SSM, you also perform a stack update operation on any stacks that include the ssm dynamic reference, in order to fetch the latest parameter version.

One way to trigger the update, could be listing the version of parameter you want to use and then update when you are ready for an update. You can find the latest available version in parameter details.

$ aws ssm get-parameters --names /aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id --region us-east-1
{
    "Parameters": [
        {
            "Name": "/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id",
            "Type": "String",
            "Value": "ami-04215982dedb895b4",
            "Version": 123,
            "LastModifiedDate": "2023-10-26T21:03:08.758000+03:00",
            "ARN": "arn:aws:ssm:us-east-1::parameter/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id",
            "DataType": "text"
        }
    ],
    "InvalidParameters": []
}
profile picture
전문가
Kallu
답변함 6달 전
profile picture
전문가
검토됨 6달 전

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

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

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

관련 콘텐츠