This message was deleted.
# general
s
This message was deleted.
s
Do you mean 3 private subnets and one public subnet? If so, that’s not possible with AWSX and isn’t in line with best practices anyway. Your subnets should be uniform in all AZs, and you should have at least 3 AZs for any production workload.
You can have a single NAT Gateway to service all 3 subnets if you want tho. There’s an option for that in the AWSX vpc component.
d
Yes, I mean 3 private subnets and one public subnet. I tried it by using
nat_gateways
option:
Copy code
def create_vpc():
    <http://log.info|log.info>('[base.vpc.create_vpc]')
    eip = pulumi_aws.ec2.Eip(
        f"eip{DEPLOY_NAME_PREFIX}"
    )
    vpc = pulumi_awsx.ec2.Vpc(
        VPC_NAME,
        cidr_block="12.0.0.0/16",
        subnet_specs=[
            pulumi_awsx.ec2.SubnetSpecArgs(
                type=pulumi_awsx.ec2.SubnetType.PRIVATE,
                tags={
                    CLUSTER_TAG: "owned",
                    '<http://kubernetes.io/role/internal-elb|kubernetes.io/role/internal-elb>': '1',
                },
            ),
            pulumi_awsx.ec2.SubnetSpecArgs(
                type=pulumi_awsx.ec2.SubnetType.PUBLIC,
                tags={
                    CLUSTER_TAG: "owned",
                    '<http://kubernetes.io/role/elb|kubernetes.io/role/elb>': '1',
                },
            ),
        ],
        availability_zone_names=AVAILABILITY_ZONE_NAMES,
        nat_gateways=pulumi_awsx.ec2.NatGatewayConfigurationArgs(
            strategy=pulumi_awsx.ec2.NatGatewayStrategy.SINGLE,
            elastic_ip_allocation_ids=[eip.id],
        ),
        tags={"name": f"{VPC_NAME}-tag"}
    )
    return vpc
s
Did this end up working for you?