In CloudFormation How do I reference the VPC Id from a chosen subnet id? -
i creating ec2 instance cf template, , choose subnet on3 of parameters. once have chosen subnet, there way cloudformation find vpc id of subnet?
i'm afraid there isn't easy way vpc id automatically subnet id, cloudformation limitation @ moment. have 2 main options getting around this:
easiest option: pass in vpc id parameter matches subnet id.
harder option: create custom resource, lambda easiest way, gets vpc id subnet id. amazon has sample on creating custom resource values up.
looking around found someone has built library executing cli commands lambda custom resource. option if building own lambda function bit much.
wiki
Comments
Post a Comment