Chef’s knife ec2 plugin create server inside VPC with public IP

amazon-vpcamazon-web-serviceschefknife

So I'm using knife ec2 plugin to create a server, inside a VPC, and then provision it with chef-solo.

Here is my basic command:

    knife ec2 server create -S private-key -I ami-1234 --flavor=m1.medium --subnet xyz

The server is spun up properly, and has the proper VPC IP address. My problem is, I also need a public IP address. When I spin up an instance through the ec2 web console, it simply has an option for this Automatically assign a public IP address to your instances

I simply am unable to figure out how to do this via the knife command.

Best Answer

Here is one solution I have used, although note that it requires a manual step and knowledge of your free elastic IP pool:

  • Create one or more elastic IPs on the EC2 webconsole
  • On the end of your knife ec2 create server command add --associate-eip <free elastic ip address>
Related Topic