https://pulumi.com logo
Title
r

ripe-lifeguard-34041

03/06/2022, 1:07 PM
Hi Team, I am looking for sample code - working on selfservice-flatform application folder structure 1. vpc.py - creates vpc, route tables, subnets, security groups, nat gateway, Internetgateway. (this created as it is one time setup) 2. ec2.py. - Team creates ec2 instances when ever required from UI, challenge - how can i get VPC id in ec2.py file
g

great-queen-39697

03/07/2022, 11:29 PM
Is this with the automation API (I'm assuming you're working from something like https://github.com/komalali/self-service-platyform based on your description)?
r

ripe-lifeguard-34041

03/08/2022, 12:22 AM
Thank you for responding, Correct. virtual_machines.py. - while creating ec2 instance subnet are not mentioned, but my use case i want to created in specified VPC, not in default VPC.
g

great-queen-39697

03/08/2022, 10:38 PM
Gotcha. That example uses an inline program (in the
create_pulumi_program()
function), so you'd add the subnet as you would in any Pulumi program. For an example of what that would look like in a standard Pulumi program, try https://github.com/pulumi/examples/blob/master/aws-py-eks/vpc.py
r

ripe-lifeguard-34041

03/13/2022, 2:28 PM
Thank you
👍 1