Cloudformation VPC build out. How to get Secondary CIDR of a VPC in the output of cloudformation execution.

0

Hi team need one help, though its more related to VPC feature, but asking here as well since I am trying with CF template, if any one came accorss this need - "I am using cloudformation to deploy vpc with ipam integration and tgw attachment. vpc would have 2 CIDRs. Now i am able to call primary cidr with "!GetAtt VPC.CidrBlock" intrinsic function call but I am not able to call the secondary cidr . Is there any way I can call the secondary cidr too ? Any help here please ?"

1回答
0
承認された回答

Unfortunately I thinnk there is no direct way to reference the secondary CIDR blocks for a VPC when using IPAM and CloudFormation. However, here are two potential options:

Use a Custom Resource to call the DescribeIpams API after creation to lookup the IPAM ID for the VPC, then call GetIpamResourceCidrs to retrieve the secondary CIDRs. You could store these CIDR values in Parameters or Outputs.

Use a Custom Resource with AWS Lambda to call the EC2 ModifyVpcAttribute API after creation to tag the VPC with the secondary CIDRs. Then reference the tags in other resources that need the values.

profile pictureAWS
回答済み 7ヶ月前
profile picture
エキスパート
レビュー済み 2ヶ月前
  • Thanks Dave, later on i realized their is no straight forward way of doing it , so created lambda function s custom resource and call the "describe_vpc" api, fetched in vpc cidr ( index1 ) and then use that to pass in as parameter in the subnet creation module. this works. But thanks for replying that is also an option .

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ