Does Automise support getting instance tags


(David Novo) #1

Hello,
I am looking to use automise to setup amazon EC2 instances. It seems it can do most of what we need. However, it is common practice to setup an EC2 instance with tags. Those tags control properties of the instance. For instance, we have a tag called “Staging” whose values can either be “Production” or “Development”. If its production, certain things have to happen that do not happen in development. Is there an action for reading the instance tags?
Here is some info about it
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html


(Vincent Parrett) #2

Hi David

We don’t have any tagging actions or tags support at this stage. I had a look at the documentation, and it doesn’t look to be too difficult. I have made a start on this, hopefully we should have something in a week or so (juggling many tasks).

Vincent.


(David Novo) #3

Hi Vincent,

Cool. What we would need is the ability to request the value of a tag for the currently running instance, and store that value in a variable.

As an aside, how would I get the instance ID of the instance I am currently running on?
I can always do it via executing an HTTP call as described in
https://stackoverflow.com/questions/625644/how-to-get-the-instance-id-from-within-an-ec2-instance

but do you have something built in already?


(Vincent Parrett) #4

You should be able to get the instance id through the instance identity document

https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/instance-identity-documents.html

I’ll see if we can wrap this in an action to make it easier to use.


(David Novo) #5

Ya, I know I can do it via an HTTP Powershell call. But if I wanted to use powershell I would not be using automise :slight_smile:


(Vincent Parrett) #6

Just bear in mind that it is impossible for us to wrap every amazon endpoint in an action, there will be times where you need to fallback to powershell (which can be done inside Automise using the Run script action, or script events on other actions).


(David Novo) #7

Understood. I dont want every endpoint action, just the useful ones :astonished:


(Vincent Parrett) #8

Hi David

I have added 2 new actions

EC2 Tag Resources
and
EC2 Get Resource Tags

The HTTP Get File action that should allow you to get the instance-id inside the instance

https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-instance-metadata.html

http://downloads.finalbuilder.com/downloads/automise/500/AT500_1030.exe
http://downloads.finalbuilder.com/downloads/automise/500/ATCMD500_1030.exe


(David Novo) #9

Hi Vincent,
Thank you. We will give them a try ASAP.