If I understand things correctly, there is no way to set the property " Auto-Assign Public IP" for subnets from cloud formation templates.
This can be done from Launch configurations in Auto Scaling, making Ec2 Instances start up with public IPs.
However, this option is, AFAIK, not available for Launch Configurations configured through Elastic Beanstalk when scripted with Cloud Formation.
The AWS::ElasticBeanstalk::Environment element has 'OptionSettings', but only a subset of the namespace 'aws:autoscaling:launchconfiguration' is passed through. See this example
someEnvironment:
Type: AWS::ElasticBeanstalk::Environment
Properties:
ApplicationName:
Ref: someApp
Description: AWS Environment for my App
TemplateName:
Ref: myTemplate
OptionSettings:
- Namespace: 'aws:autoscaling:launchconfiguration'
OptionName: IamInstanceProfile
Value: 'arn:aws:iam::xxx:instance-profile/aws-elasticbeanstalk-ec2-role'
- Namespace: 'aws:elasticbeanstalk:environment'
OptionName: ServiceRole
Value: 'aws-elasticbeanstalk-service-role'
I tried to add 'aws:autoscaling:launchconfiguration'> AssociatePublicIpAddress / true, but the template fails because the property is unknown.
The servers created in the EB auto scaling group can't signal OK back to the Elastic Beanstalk Service to say that they've started, and the whole CF stack times out and rolls back after 15 minutes.
A work around is to modify the VPC after created. I can do this because I have layered my CF scripts with export and import values. I have to manually enable the Auto Assign IP on my public Subnets. That feels hacky.
Am I missing something here?