This message was deleted.
# aws
s
This message was deleted.
g
I've not seen that error before, but setting a
subnetID
is straightforward. If you have an existing Subnet you want to use can just set it as
subnetid: 'subnet-abc123'
. Otherwise you can create a VPC, Subnet, etc. and then pass the
subnetId
value in the same way.
m
Hey @gentle-diamond-70147 thank you for the quick reply 😄 So I have created a VPC:
Copy code
const stagingVpc = new awsx.ec2.Vpc(
  'xyz-staging',
  {
    numberOfNatGateways: 2,
    numberOfAvailabilityZones: 2,
    subnets: [
      { type: 'public', name: '1' },
      { type: 'public', name: '2' },
      { type: 'private', name: '1' },
      { type: 'private', name: '2' },
    ],
  },
  {}
)
And have a variable:
const stagingVpcPublicSubnetIds = stagingVpc.publicSubnetIds
I may be a bit rusty here, but I’m having difficulty taking one of those IDs into my EC2 instance, if I try: Do you know if there’s an easy way to grab the ID of one of those subnets as a string?
g
Ah, yea. It's not quite as straightforward as I mentioned when using awsx, but here's an example:
subnetId: pulumi.output(stagingVpc.publicSubnetIds).apply(it => it[0]),
🥇 1
m
Thank you @gentle-diamond-70147 that solved the issue! 🙇
👍 1