I'm trying to capture AWS Instance screenshot using this command aws ec2 get-console-screenshot --instance-id <i-0922..>
The command gives me some json output with InstanceId
and ImageData
fields.
The ImageData
field contains image in base64 encoded form as per their official documentation http://docs.aws.amazon.com/cli/latest/reference/ec2/get-console-screenshot.html
But I want the command to give image as a file, how do I achieve this?
For now I tried some hack by decoding the ImageData
base64 contents and putting it in a file with .jpg extension, it worked!
cat /tmp/myimage.jpg | base64 --decode > /tmp/myimagedecode.jpg # here file /tmp/myimage.jpg contains the content of ImageData field
Can AWS provide some simple way to do this?