无法从此帐户的参数存储中获取参数

无法从此帐户的参数存储中获取参数

本文介绍了无法从此帐户的参数存储中获取参数(参数值)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了错误:

$ aws cloudformation deploy --template-file ./packaged-stack.yml --stack-name mystackname --capabilities CAPABILITY_NAMED_IAM`


An error occurred (ValidationError) when calling the CreateChangeSet operation: Unable to fetch parameters [XXX] from parameter store for this account.

这是怎么了?

奇怪的是 XXX 是参数存储中的值,因此CloudFormation实际上可以获取该值...但是似乎它试图从名称为值的参数中读取它出来了...我认为我的用法不正确吗?

The weird thing is XXX is the value from paramter store, so CloudFormation is actually able to get the value ... but it seems like its trying to read from the paramter whose name is the value it got out ... I think my usage is incorrect?

AWSTemplateFormatVersion : '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: '...'

Parameters:
  BaseStack:
    Type: AWS::SSM::Parameter::Value<String>
    Default: /some/thing/baseStack

在此示例中,存储在/some/thing/baseStack 中的值为 XXX

The value stored in /some/thing/baseStack is XXX in this example

推荐答案

当您将参数从一个模板传递到另一个模板时,通常会发生这种情况.

This usually happens when you pass the parameters from one template to another.

Template 1 has parameter reading from SSM store and passing it to another template
Parameters:
  SNSTopicArnParam:
    Description: Arn of the SNS topic
    Type: AWS::SSM::Parameter::Value<String>
    Default: /arn/topics/topic1
Resources:
  CallOtherStack:
    Type: AWS::CloudFormation::Stack
    Properties:
      TemplateURL: someurl/template2.yaml
      Parameters:
        SNSTopicArn: !Ref SNSTopicArnParam

模板2具有以下参数和资源(将因无法提取参数"错误而出错.)

And Template 2 has the following parameter and resources (will be erroring with the Unable to fetch parameters error.)

Parameters:
  SNSTopicArnFromCaller:
    Description: Arn of the SNS topic
    Type: AWS::SSM::Parameter::Value<String>
    Default: /arn/topics/topic1
Resources:
  NewSubscription:
    Type: AWS::SNS::Subscription
    Properties:
      Parameters:
        TopicArn: !Ref SNSTopicArnFromCaller
        Endpoint: someValue
        Protocol: SQS

这是因为模板之一将具有/arn/topics/topic1的值(主题的arn),并将arn值在调用时传递给template2.并且template2具有值的类型作为另一个SSM参数.

This is because the template one would have the value of /arn/topics/topic1 (the arn of the topic) and pass the arn value to template2 while calling it. And template2 has the type of the value as another SSM parameter.

要解决此问题,template2参数类型应仅为实际参数值的类型.在这种情况下,它应该是 String

To resolve this, the template2 parameter type should be just the type of the actual parameter value. In this case, it should be String

因此,模板2应该进行如下更新才能正常工作

so, template 2 should be updated as below to work properly

Parameters:
  SNSTopicArnFromCaller:
    Description: Arn of the SNS topic
    Type: String
Resources:
  NewSubscription:
    Type: AWS::SNS::Subscription
    Properties:
      Parameters:
        TopicArn: !Ref SNSTopicArnFromCaller
        Endpoint: someValue
        Protocol: SQS

这篇关于无法从此帐户的参数存储中获取参数(参数值)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 20:15