Option to associate public ip address in ec2 run-instance #479

Closed
bluskool opened this Issue Nov 9, 2013 · 4 comments

Comments

Projects
None yet
4 participants

bluskool commented Nov 9, 2013

There doesn't seem to be any way to associate a public ip address without also adding a network interface with the --network-interfaces parameter. Is it possible for this to be a top level parameter?

garnaat was assigned Nov 9, 2013

Contributor

garnaat commented Nov 9, 2013

Yes, I agree that would be useful.

garnaat closed this in e331f98 Nov 13, 2013

@jamesls jamesls added a commit that referenced this issue Nov 13, 2013

@jamesls jamesls Merge branch 'release-1.2.5'
* release-1.2.5:
  Bumping version to 1.2.5
  Update completer unit tests with new changes
  Update CHANGELOG with latest features
  Add high level operations for cloudtrail
  Add a --associate-public-ip-address boolean option.  Fixes #479.
  Remove debugging code used in BaseAWSCommandParamsTest
  Add a new s3 website command
  Remove unused variables
  Remove trailing whitespace
7f8b88b

Thanks for adding it! I tried it out, but I ran into a problem. It seems that I can't run --associate-public-ip-address and specify a subnet id for some reason.

$ aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type m1.medium --security-group-ids "sg-xxxxxxxx" "sg-xxxxxxxx" "sg-xxxxxxxx" --subnet-id subnet-xxxxxxxx --associate-public-ip-address
A client error (InvalidParameterCombination) occurred: Network interfaces and an instance-level subnet ID may not be specified on the same request

ryuzee commented Nov 18, 2013

Thanks for adding this feature but I got this error too. the command is as follows.

aws ec2 run-instances --output text --debug
--region ap-northeast-1
--image-id ami-b1fe9bb0
--key-name keypair1
--security-group-ids sg-xxxxxxx
--instance-type t1.micro
--subnet-id subnet-xxxxxxxx
--private-ip-address 10.0.0.222
--associate-public-ip-address
--count 1

and the error message is ...

A client error (InvalidParameterCombination) occurred: Network interfaces and an instance-level subnet ID may not be specified on the same request

any comments would be appreciated.

Check this kind page out
http://drewblas.com/2012/08/24/aws-vpc-error-client-invalidparametercombination/
As he states as below:

Luckily, my company has premium AWS support and a quick 10 minute chat got the answer I needed. You must use the --network-attachment param, which takes the place of --group, --private-ip-address, and --subnet

The resulting command looks like this:

ec2-run-instances ami-abc123
--network-attachment :0:subnet-abc123::10.0.1.10:sg-abc123::
.... your other params

Good luck, I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment