wallix / awless

A Mighty CLI for AWS
http://awless.io/
Apache License 2.0
4.98k stars 263 forks source link

Is it possible to tag instances and Associate Public IP? #112

Closed jseiser closed 7 years ago

jseiser commented 7 years ago

Im attempting to convert some of my cli scripts, to awless templates and I do not seem to find anything in the documentation on tagging an instance or associating a public IP. Specifically, trying to replicate the following options when creating a new instance.

--tag-specifications 'ResourceType=instance,Tags=[{Key=keyname,Value=value}, {Key=keyname,Value=value}, {Key=keyname,Value=value}, ]'

and

--associate-public-ip-address

simcap commented 7 years ago

We have a github repo for our templates that is in progress, but it is not yet the clearest of documentation, and looking at it I did not documented creating instance with an elastic ip and then tagging it.

Tags on instance (or any EC2 resources)

Here is an example of such a template to run with awless run:

inst = create instance subnet=mysubnet image=myimage type=t2.micro keypair=awskeyname name=myinstance securitygroup=mysecgroup
create tag resource=$inst key=Env value=Staging
create tag resource=$int key=Type value=Broker

If you want to add a tag to an existing instance named myinstance, on the command line you can do:

awless create tag resource=@myinstance key=Env value=Production

Elastic IP (i.e. public IP) on instances

First quick reminder on how you can manage your public IPs:

awless ls elasticips (list) awless create elasticip domain=vpc aw delete elasticip id=ID

Here is an example on how to attach an existing IP to an instance:

attach elasticip id=eipalloc-ddfbf3e7 instance=@my-instance-name

@jseiser If that does not answer your question let me know.

simcap commented 7 years ago

I added a full template on our repo