我没有为beantalk创建“自定义平台”,我只是想根据平台的最新beantalk ami构建自定义ami。这真的很令人沮丧,因为我找不到为此提供好的文档。
我可以这样获得最新的网络信息:
aws elasticbeanstalk describe-platform-version \
--platform-arn "arn:aws:elasticbeanstalk:us-east-2::platform/IIS 10.0 running on 64bit Windows Server 2019/2.5.0" \
--query 'PlatformDescription.CustomAmiList[?VirtualizationType==`hvm`].ImageId'
但是我想在打包程序中这样做:
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "*Windows_Server-2012-R2*English-64Bit-Base*",
"root-device-type": "ebs"
},
"most_recent": true,
"owners": "amazon"
},
为了获取在64位Windows Server 2019上运行的IIS 10.0的最新版本,正确的source_ami_filter是什么?似乎它的调用describe-images方法,但我无法弄清楚如何用它来获得beantalk ami]
例如,这什么也不返回:
aws ec2 describe-images --filters Name=name,Values='IIS 10.0 running on 64bit Windows Server 2019*'
使用aws elasticbeanstalk describe-platform-version我明白了
aws elasticbeanstalk describe-platform-version --region us-east-1 --platform-arn "arn:aws:elasticbeanstalk:us-east-1::platform/IIS 10.0 running on 64bit Windows Server 2019/2.5.0" --query 'PlatformDescription.CustomAmiList[?VirtualizationType==`hvm`].ImageId'
返回:ami-0fd1bbf3adf035706
但是描述图像显示最新图像有所不同。我想针对特定的平台和版本(“在64位Windows Server 2019 / 2.5.0上运行的arn:aws:elasticbeanstalk:us-east-2 :: platform / IIS 10.0”]
在名称字符串上使用描述图像显示出一些不同:
aws ec2 describe-images --owners amazon --filters 'Name=name,Values=aws-elasticbeanstalk-amzn-??????????.x86_64-WindowsServer2019-V2-hvm-*' --region us-east-1 --query 'reverse(sort_by(Images, &CreationDate))[].[CreationDate, Name, ImageId]' --output text
2020-02-21T23:32:24.000Z aws-elasticbeanstalk-amzn-2020.02.12.x86_64-WindowsServer2019-V2-hvm-202002212241 ami-044ff22e194ea0ba3
2020-02-21T19:07:22.000Z aws-elasticbeanstalk-amzn-2020.02.12.x86_64-WindowsServer2019-V2-hvm-202002211814 ami-0fe9d8b6587daca04
2020-01-19T23:02:54.000Z aws-elasticbeanstalk-amzn-2020.01.15.x86_64-WindowsServer2019-V2-hvm-202001192219 ami-0fd1bbf3adf035706
2020-01-19T03:46:03.000Z aws-elasticbeanstalk-amzn-2020.01.15.x86_64-WindowsServer2019-V2-hvm-202001190252 ami-0e70abb9312eb34e5
2020-01-11T01:12:23.000Z aws-elasticbeanstalk-amzn-2019.12.16.x86_64-WindowsServer2019-V2-hvm-202001110020 ami-08df7b236ed19e461
2020-01-10T00:02:51.000Z aws-elasticbeanstalk-amzn-2019.12.16.x86_64-WindowsServer2019-V2-hvm-202001092311 ami-0664773b5a898cc82
尝试使用aws-elasticbeanstalk-amzn-??????????.x86_64-WindowsServer2019-V2-hvm-*
。
例如,以下cli命令将获取在64位Windows Server 2019上运行的IIS 10.0的所有当前可用图像,按反向创建日期排序,并从列表中获取第一个AMI ID,这是您所针对的图像。
aws ec2 describe-images --owners amazon --filters 'Name=name,Values=aws-elasticbeanstalk-amzn-??????????.x86_64-WindowsServer2019-V2-hvm-*' 'Name=state,Values=available' --query 'reverse(sort_by(Images, &CreationDate))[:1].ImageId' --output text --region=us-east-2
输出:
ami-0e76ecdeebe63dc5c