[ec2-beta] Get security group from within instance?

Andreas Hasenack andreas at canonical.com
Tue Jan 27 18:47:44 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Darren Govoni wrote:
> Hi,
>   Thanks for the links. I did review the EC2 tools documentation before,
> but so far, none of the tools appear to report the security group for
> the instance it is running in, without first knowing the instance id. 
> 
> I need to know the security group from WITHIN the running instance using
> a script/command (e.g. get-my-security-group). I can easily find the
> group from outside the instance _after_ it is running. :)
> 
> The meta-data link you supplied seems to be dead though.

I just fired up an instance and it's working:

root at m:~# curl http://169.254.169.254/2008-02-01/meta-data/security-groups;echo
ssh
root at m:~#

In the example above, the security group is "ssh". The extra echo I placed at
the end is just to get a linefeed so it looks pretty on screen ;)

Maybe I didn't explain myself correctly. That URL should be accessed exactly
from within the instance as you requested.

See
http://docs.amazonwebservices.com/AWSEC2/latest/DeveloperGuide/index.html?AESDG-chapter-instancedata.html

for other examples of the type of information you can get with it. All from
within the instance.

- --
Andreas Hasenack
andreas at canonical.com

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkl/Vs8ACgkQeEJZs/PdwpApegCgwHzC9oUiPtXgNbIQzeObsMho
yVkAnAuRmb6GD8c/G8unarkwdNyxbEew
=Uai9
-----END PGP SIGNATURE-----




More information about the Ec2-beta mailing list