如何以编程方式确定给定区域的 AWS 优化的 ECS 映像?

How to programmatically determine the AWS-optimized ECS image for a given region?

我想编写将加入给定 ECS 集群的 EC2 创建脚本,但需要指定 AMI。我可以看到我可以在 AWS 文档中找到一个 AMI,但是 URL 需要登录到控制台,因此不便于屏幕抓取。是否有任何其他推荐资源来确定建议的 AMI?

你可以retrieve the recommended AMI from the Systems Manager Parameter Store API or subscribe to an SNS topic for notifications when new AMIs are released.