Tanay Suthar
Tanay Suthar

Reputation: 453

Assign Public IP address on AWS while creating Autoscaling groups that launch instances into an Amazon VPC in Ansible

I am actually trying to create public IP address and DNS name which is going to be used for auto scaling groups that launch instances into an amazon VPC.

Is that true that I have to use "assign_public_ip" parameter in ec2_lc module? If yes then how can I assign to it in Ansible script ?

I have created all the scripts for auto scaling, launch configuration and load balancing. It is just that I cannot log in to instance unless and until I assign Public IP or Public DNS name to it.

Upvotes: 3

Views: 744

Answers (1)

helloV
helloV

Reputation: 52423

From ec2 - create, terminate, start or stop an instance in ec2

Parameter: assign_public_ip (added in 1.5)

Choices: Yes / No

Comments: when provisioning within vpc, assign a public IP address. Boto library must be 2.13.0+

As long as your ansible version is >= 1.5, you should be able use this parameter.

- ec2:
    ...
    image: ami-123456
    ...
    vpc_subnet_id: subnet-12345678
    assign_public_ip: yes

Upvotes: 3

Related Questions