Can anyone give me an example for creating vpc usi...
# aws
f
Can anyone give me an example for creating vpc using awsx. For now I create vpc using aws classic. I just need 1 route table(have 3 subnets public associate) and 1 route table(have 3 subnets private associate). How this code translate/if i want using awsx. ``````
g
It would be something like this:
Copy code
new awsx.ec2.Vpc("vpc", {
        cidrBlock: "your_desired_cidr",
        numberOfAvailabilityZones: 3,
        numberOfNatGateways: 3,
        subnets: [
            {
                type: "public",
            },
            {
                type: "private"
            }]
    });
s
Let us know if you need the above in a different language.
f
After I run that code. It still shown 1 subnet 1 route(unexpect)
I expect is 1 route table have 3 subnet assoc like this:
s
@few-mechanic-54967 Try removing the
subnets
section; I think the default is to create both private and public subnets, and I suspect that
subnets
section is being interpreted to create one public and one private.
f
The result still same. Have you look to deep awsx code?, there is loop 1 subnet 1 route tables, so I think it is impossible to group 3 subnet to 1 route table only.
s
Why does the number of route tables matter, if the routes are configured correctly?
f
that's why there is a subnet associate if the purpose is, among other things, to group.
s
If you want more explicit control over route tables and route table associations, then I’d stick with using AWS instead of AWSx.
f
Agree