I’m spinning up new servers in a newly-created VPC I’m not sure which file contains the directive to change the VPC ID so the servers are created in the correct new VPC?
Hi,
I presume here you’re using the ‘ec2’ module to create your instances. If so the module has a ‘vpc_subnet_id’ option, where you have to specify the id of the subnet that you want your instance attached to. The subnet is already bound to a VPC.
kind regards
Pshem
Further to this, if you specify network interfaces, they will be in subnets too, so the VPC is implied.
Regards, K.
I am trying to setup a playbook that launches new instance but keep running into issues like “local” or "localhost not found. Do you have a playbook that you could share.
Post your playbook here. 99% of errors in beginners’ playbooks are simple syntax errors.
To create an instance, you first need to create a VPC, at least one subnet, a keypair and a security group. If you don’t create a VPC and a subnet, your new instance will end up in the default VPC in one of the default subnets and that is almost certainly NOT what you want, though it might be OK for initial experimenting.
I’ve posted a very small snippet separately that builds an instance.
While researching, remember that the older ec2 module is different to the newer ec2_instance module. A lot of examples on the Internet refer to the older module.
Regards, K.