Search code examples
amazon-web-servicesamazon-ec2ec2-api-tools

How to use AWS(Amazon Web Services) EC2 DescribeInstanceStatus API Request in RestClient (Chrome Extention)


I am new to AWS and working on an application in which I have to display different Metrics about my AWS EC2 instance Health Like CPU usage and Memory and Running Processes info. I am trying to perform the Get Request from a REST client (Chrome Extention) for clarity of the function of this API exposed by AWS.

https://dns.regionxx.ec2.amazonaws.com/?
Action=DescribeInstanceStatus
&AWSAccessKeyId=0GS7553JW74RRM612K02EXAMPLE
&Timestamp=1397109362
&Signature=lBP67vCvGlDMBQ1dofZxg8E8SUEXAMPLE
&SignatureVersion=2
&SignatureMethod=HMAC-SHA1

REST Client Support OAuth 1.0 is this an issue because AWS is supporting Signature Version 2 and 4.

Any Help?


Solution

  • You can do it the straight way with Signatures but why not use one of the existing SDKs like boto (Python), Ruby AWS SDK or the Java AWS SDK. These SDKs take care all of the authentication/authorization mechanism and you just need provide your aws_access_key_id and your aws_secret_access_key

    For example with boto you can do something like this:

    import boto.ec2
    conn = boto.ec2.connect_to_region("us-east-1",
       aws_access_key_id='<key>',
       aws_secret_access_key='<secret>')
    
    reservations = conn.get_all_instances
    
    for reservation in reservations:
        for instance in reservation:
            print instance.status
    

    Or you can use the EC2 command line API http://aws.amazon.com/developertools/351 :

     ec2-describe-instance-status <instances->
    

    Or you can use the AWS CLI:

     aws ec2 describe-instance-status <instance id>