How to create EC2 instance with public IP enabled #1190
Labels
bug
This issue is a bug.
service-api
This issue is due to a problem in a service API, not the SDK implementation.
Confirm by changing [ ] to [x] below:
Describe the question
Since the
ec2.RunInstancesInput
has not argument to enable the public IP, so I think one (1*) way is to 1) create an interface explicitly and 2) set theInstanceNetworkInterfaceSpecification.AssociatePublicIpAddress
but I met following error:Below is the code snippet used (error check and other parts are removed for brevity. )
Not sure what is missing here and the error message doesn't quite help. Appreciate your help!
1* According to the doc, the other way is to enable the subnet attribute to let all the instance created in that subnet have an public IP automatically. I didn't do this way since 1) I don't want all the instance in that subnet to have an public IP and 2) I didn't see the option to have that attribute enabled when creating the subnet but I do see that attribute in the output of the subnet creating.
The text was updated successfully, but these errors were encountered: