another subnetting question using aws-python. I do...
# general
b
another subnetting question using aws-python. I don't see anywhere in the documentation how to differentiate between a public subnet and a private one when I'm creating them. Is there a way to do this?
l
A private subnet is a public subnet without a route to the IGW, but with an NAT server. If you're creating subnets manually, then you have to look after this yourself.
b
ok
b
@broad-holiday-50009 are you using crosswalk?
b
no
b
that’ll make your life a whole bunch easier
b
I tried to use it at first but it made it much more complicated for someone who doesn't understand pulumi fully
b
if you want to create the entire VPC manually, there is some prior art to follow here: https://github.com/jen20/pulumi-aws-vpc/tree/master/python
b
thank you
but creating a VPC with awsx is as simple as:
Copy code
import pulumi
import pulumi_awsx as awsx
import pulumi_aws as aws

config = pulumi.Config()
cidr_block = config.require("cidr_block")
stack_name = pulumi.get_stack()

vpc = awsx.ec2.Vpc(
    f"vpc-{stack_name}",
    cidr_block=cidr_block,
    subnet_specs=[
        awsx.ec2.SubnetSpecArgs(
            type="public",
        ),
        awsx.ec2.SubnetSpecArgs(
            type="private",
        ),
    ],
    number_of_availability_zones=2
    nat_gateways=awsx.ec2.NatGatewayConfigurationArgs(strategy="SINGLE":),
)

pulumi.export("vpc_id", vpc.vpc_id)
pulumi.export("public_subnet_ids", vpc.public_subnet_ids)
pulumi.export("private_subnet_ids", vpc.private_subnet_ids)
b
ok that's perfect, I didn't know about SubnetSpecArgs
like I'm looking at the ec2 subnet documentation and that's not even in there. Am I just having issues understanding the layout of the documentation? I haven't found anything I needed in there yet
b
unfortunately the awsx documentation isn’t great right now 😞 we’re aware of it
you’re using an IDE like vscode?
b
I can, I have it but so far i've just been coding in terminal
b
okay, vscode is going to make your life much easier
are you completely new to Pulumi and writing pythin?
b
yes I'm pretty fresh to devops in general but this is by far the most complex undertaking I've tried yet
b
if you want to hop on a zoom, download vscode and install it and I can take you through some tips to make your life easier. I’m free for the next 90 minutes
b
I have vscode on this computer already but I work in a library so I can't really do a zoom call at the moment
b
no problem, if you install vscode and configure it correctly, you can right click on most resources and select “Go to definition” and you’ll see all the inpits and outputs you can configure
b
oh man that's fantastic the one thing pulumi seems to do really well is name things in a way that they make sense so that should really help