[英]How can I get the CIDR block of the VPC selected by the user in CloudFormation?
I am asking the user to choose an existing VPC: 我要求用户选择现有的VPC:
Parameters:
MyVPC:
Type: AWS::EC2::VPC::Id
Then in my 'Resources' block I am trying to get the CIDR block of that VPC. 然后在“资源”块中,我尝试获取该VPC的CIDR块。
When I try this: 当我尝试这个:
- Fn::GetAtt:
- MyVPC
- CidrBlock
I get: 我得到:
Template error: instance of Fn::GetAtt references undefined resource MyVPC
Which I understand I guess because technically MyVPC is a parameter not a resource. 我理解这是因为从技术上讲MyVPC是一个参数而不是资源。
So how can I get the CIDR block of the VPC selected by the user? 那么,如何获得用户选择的VPC的CIDR块?
I don't think it is possible. 我认为不可能。
The Parameter
is merely a VPC ID , not the VPC itself. Parameter
仅仅是VPC ID ,而不是VPC本身。
The GetAtt
command is expecting a Resource
in the template, which is not there. GetAtt
命令在模板中需要一个Resource
,该Resource
不存在。
You would either need to add the CIDR block as another parameter, or create a Lambda-backed Custom Resource that would fetch the information and make it available to the template. 您可能需要添加CIDR块作为另一个参数,或者创建一个由Lambda支持的自定义资源 ,该资源将获取信息并使该信息可用于模板。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.