I'm creating a tool to deploy Docker images to EC2 via ElasticBeanstalk, so the dev team can quickly demo their work without having to merge. I don't want Elastic IP to be enabled for these apps as they are short lived.
The reason I'm asking this is because if my tool builds more than 5 apps (and it has quite quickly) any new app will fail because no Elastic IP can be assigned to the new app. This is because an AWS account typically has a max of 5 Elastic IPs available. I can go to the aws web console and choose 'Disassociate Elastic IP Address' (see below) on an instance, after which the ec2 instance will get a new ip (after a few minutes). This is what I want, but I want to do it programmatically, and would prefer to boot the app without it instead of doing it once the instance is created.
Is there a configuration option I can use to use to disable Elastic IP for the new instance?
I'm using the node aws-sdk, but any tips in any language will do.
I'm creating m1.small
single instances.
If this isn't possible when launching, I'll have to disassociate the Elastic IP from the instance using the EC2.disassociateAddress function.
When using the environment type "Single instance", you always get an EIP.
From Beanstalk developer guide, Environment Types:
Disabling the "Associate Public IP Address" option does not have any effect.
Switch to "Load-balancing, Autoscaling" Environment to get by without an EIP.
If you're in a VPC's public subnet (which is likely), one is required for that instance to be able to communicate with the Internet. Per http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Internet_Gateway.html:
The automatically-assigned EIPs that come with a new instance don't cost anything, and they automatically go away when the instance is decommissioned.
There is an elastic beanstalk environment option that might be what you are after.
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general-elbloadbalancer
Namespace: aws:ec2:vpc AssociatePublicIpAddress : false
If you set it then all the nodes created by this environment will not have a public IP. Inbound traffic will have to use a load balancer. The VPC and subnets will need to be accociated with a NAT gateway or an internet gateway to get outbound internet access. If you do not have outbound internet access then the Elastic Beanstalk build will fail (It won't be able to reach AWS services).
After you Disassociate the Elastic IP Address, you have about 10 seconds to 'release' it. If you release it, it will not come back.