https://pulumi.com logo
#getting-started
Title
# getting-started
a

abundant-oil-31046

02/20/2024, 2:52 PM
Hey friends, I'm new to Pulumi and I've been trying to set up a "sandbox" of the following stack in AWS: VPC + RDS + ECR + EKS. I'm using Python. I've been trying to wrap my head around aws, awsx (and aws-native). I've been following the docs around the mentioned components in the different modules and I've been using the Chatbot extensively. Sadly I can't figure out how to do the following; I'd really appreciate some pointers. 1. Create VPC with public/private/database subnets in 2 AZs, but leave space for extension into third AZ later. That last part is what I can't figure out how to in a "feasible" way. 2. Assign the database subnet to an RDS subnet group. Currently the DB subnet is public (for legacy reasons...), but will be changed to isolated soon. I can't figure out how to deterministically select the correct subnets from the
vpc.public_subnet_ids
or
vpc.subnets
output. I looked into
apply
but couldn't find a solution. I haven't looked any further because I'm already stuck at this point. The AI bot wasn't helpful at all, sadly. Is what I'm trying to do crazy? Seems like a relatively standard use case to me? 🤔
Is awsx the even the "recommended" way to create a VPC? The more I fiddle with this, the less confident I become. For example, I haven't found a way to create said VPC in two AZ in such a way that I can later change it to three. Even though the subnet allocation does not conflict, Pulumi can't manage to change the number of subnets
Coming from terraform I'm a bit confused, since there I never had any problems with the aws modules. It creates all the resources I need with "reasonable" defaults and a "reasonable" amount of code.
l

little-cartoon-10569

02/20/2024, 7:47 PM
You can use any of the plugins for this. If you use AWSX, make sure you provide a CIDR that leaves room for future expansion, since AWSX will assign CODRs to your subnets to fill the CIDR you give it.
You'll have much more control if you don't use AWSX, but you'll also have to do a lot more work.