简体   繁体   中英

Error when creating a parameter in Parameter Store that stores an ImageID of an AMI built in the same Cloudformation template

I receive this error when running the cloudformation template: CREATE_FAILED: Stabilizing the parameter creation for parameter /GS/web:1

Below is the code for the resource creation of the parameter and the policies, both in the resources section:

- PolicyName: SSMCreation
    PolicyDocument:
      Version: "2012-10-17"
      Statement:
        - Effect: Allow
          Action:
            - ssm:DescribeParameters
            - ssm:AddTagsToResource
            - ssm:GetParameter
            - ssm:GetParameters
            - ssm:GetParametersByPath
            - ssm:GetParameterHistory
            - ssm:PutParameter
            - ssm:LabelParameterVersion
            - ssm:DeleteParameter
            - ssm:DeleteParameters
          Resource:
            - !Sub "arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter/*"

SSMImageParameter:
Type: AWS::SSM::Parameter
Properties:
  Type: String
  DataType: aws:ec2:image
  Name: /GS/web
  Value: !GetAtt CustomImage.ImageId

Add a waitCondition to imageCreation Lambda

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-waitcondition.html

Image creation will take a while and SSM parameter creation may happen before ImageId is available (lambda creation would succeed and dependency will succeed but has to happen after custom lambda executes)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM