high-grass-3103
01/21/2022, 12:56 AMexport const infra_public = new awsn.ec2.Subnet('infra_public', {
tags: nativeTags({ ...tags, Name: `infra_pub` }),
cidrBlock: '10.0.0.16/28',
vpcId,
availabilityZone,
mapPublicIpOnLaunch: true,
});
But when I launch an instance:
const nic0 = new aws.ec2.NetworkInterface('nic0', {
subnetId: infra_public.id,
tags,
securityGroups: [sg_ssh.id],
});
const nic1 = new aws.ec2.NetworkInterface('nic1', {
subnetId: infra_private.id,
tags,
securityGroups: [sg_priv.id],
});
const bastion_node = new aws.ec2.Instance('bastion', {
keyName,
tags: { ...tags, Name: `${pulumi.getStack()}-bastion` },
instanceType: aws.ec2.InstanceType.T4g_Nano,
ami: ami.id,
networkInterfaces: [
{
deviceIndex: 0,
networkInterfaceId: nic0.id,
}, {
deviceIndex: 1,
networkInterfaceId: nic1.id,
}
],
creditSpecification: { cpuCredits: 'standard' },
monitoring: true,
availabilityZone,
});
the AWS console reports NO public IPv4 address. Am I missing something?little-cartoon-10569
01/21/2022, 1:12 AMassociatePublicIpAddress
property and EC2 will look after it for you.
https://www.pulumi.com/registry/packages/aws/api-docs/ec2/instance/#associatepublicipaddress_nodejsassociatePublicIpAddress
will create a DHCP-style public IP address (that will change when you destroy/recreate the instance). If you want a fixed public IP address, you'll want to add an elastic IP on top of the instance.high-grass-3103
01/21/2022, 1:30 AMassociatePublicIpAddress
in this scenario, with two NICs attached.
How do I route traffic between subnets?assignIpv6AddressOnCreation
is just a default for the option in Instance. Thank you for your help @little-cartoon-10569