1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
0
Hi, yes, it is possible to run a CLI command like the one below to obtain the latest image matching a given name:
aws ec2 describe-images --owners amazon --filters Name=platform,Values=windows --filters "Name=name,Values=Windows_Server*" | jq "[.Images[] | {ImageId: .ImageId ,Name: .Name, CreationDate: .CreationDate}] | sort_by(.CreationDate) | .[-1]"
{
"ImageId": "ami-06277c3639439d32c",
"Name": "Windows_Server-2022-English-Full-ECS_Optimized-2023.07.11",
"CreationDate": "2023-07-17T16:58:12.000Z"
}
If you use an SDK instead of CLI, use same parameters as above adapted to your programming language of choice.
Best,
Didier
관련 콘텐츠
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 일 년 전
Thanks I will try this out
When I try this, the output is null - aws ec2 describe-images --owners amazon --filters Name=platform,Values=windows --filters "Name=name,Values=CIS Microsoft Windows Server 2022*" | jq "[.Images[] | {ImageId: .ImageId ,Name: .Name, CreationDate: .CreationDate}] | sort_by(.CreationDate) | .[-1]"
Actually this one helped aws ec2 describe-images --owners aws-marketplace --filters Name=platform,Values=windows --filters "Name=name,Values=CIS Microsoft Windows Server 2022*" | jq "[.Images[] | {ImageId: .ImageId ,Name: .Name, CreationDate: .CreationDate}] | sort_by(.CreationDate) | .[-1]" I will check if I can convert it to boto3 SDK