我正在尝试使用此命令aws ec2 get-console-screenshot --instance-id <i-0922..>
捕获AWS实例屏幕截图
该命令给出了一些带有InstanceId
和ImageData
字段的json输出。
根据官方文档http://docs.aws.amazon.com/cli/latest/reference/ec2/get-console-screenshot.html,ImageData
字段包含base64编码格式的图像
但我希望命令将图像作为文件提供,我如何实现这一点?
现在,我尝试了一些技巧,解码ImageData
base64内容,并将其放入一个扩展名为.jpg的文件中,它起作用了!
cat /tmp/myimage.jpg | base64 --decode > /tmp/myimagedecode.jpg # here file /tmp/myimage.jpg contains the content of ImageData field
AWS能提供一些简单的方法来做到这一点吗?
发布于 2020-04-07 16:45:24
这对我来说很有效:
aws ec2 get-console-screenshot --instance-id i-XXXXXXX --query "ImageData" --output text | base64 --decode > out.jpg
https://stackoverflow.com/questions/45590999
复制相似问题