如何使用开发工具包删除 AWS EC2 中的映像 (AMI)?
我正在使用 CreateImage()
从现有实例创建一个新的 AMI,我希望有一个 DeleteImage()
可以以相反的方式工作。不幸的是,EC2Client 上不存在此方法。
使用 C# 通过 SDK 删除 AMI 的正确方法是什么?
I am using CreateImage()
to create a new AMI from an existing Instance and I was hoping there was a DeleteImage()
which would work in the converse fashion. Unfortunately this method does not exist on the EC2Client.
What is the proper way to delete an AMI through the SDK using C#?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个快速片段:
记住处理异常并删除快照。
但是,删除关联的快照存在问题。
如果您尝试使用DescribeImageAttributeRequest查找块设备映射,则会发生异常 - “未经授权尝试访问受限资源”:
请参阅帖子:
https://forums.aws.amazon.com/message.jspa?messageID=231972
Here is a quick snippet:
Remember to handle exceptions and remove the snapshots..
However there is an issue with deleting the associated snapshots.
If you try to find out the blockdevice mapping using DescribeImageAttributeRequest an exception occurs - "Unauthorized attempt to access restricted resource" :
See post:
https://forums.aws.amazon.com/message.jspa?messageID=231972
有一个
DeregisterImage()
那应该做你想做的事。请注意,您可以自行决定是否删除该映像随后可能基于的任何快照。There is a
DeregisterImage()
that should do what you want. Note that it's up to you to delete any snapshots the image may be based upon afterward.