gpt4 book ai didi

amazon-web-services - 无法从此帐户的参数存储中获取参数(参数值)

转载 作者:行者123 更新时间:2023-12-03 22:50:12 41 4
gpt4 key购买 nike

我收到错误:

$ 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 实际上能够获取该值...但它似乎试图从名称为该值的参数中读取它出去了...我认为我的用法不正确?

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

最佳答案

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

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 具有以下参数和资源(将出现“无法获取参数”错误。)

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 参数。

要解决此问题,template2 参数类型应该只是实际参数值的类型。在这种情况下,它应该是字符串

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

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

关于amazon-web-services - 无法从此帐户的参数存储中获取参数(参数值),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51918238/

41 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com