MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / latestAmi

Function latestAmi

e2e/src/vm/ec2.ts:88–119  ·  view source on GitHub ↗
(os: VmOs)

Source from the content-addressed store, hash-verified

86
87/** Latest AWS-published base AMI for the guest OS (resolve dynamically — ids rotate). */
88const latestAmi = async (os: VmOs): Promise<string> => {
89 if (os === "windows") {
90 const viaSsm = await aws([
91 "ssm",
92 "get-parameters",
93 "--names",
94 "/aws/service/ami-windows-latest/Windows_Server-2022-English-Full-Base",
95 "--query",
96 "Parameters[0].Value",
97 ]).catch(() => "");
98 if (viaSsm && viaSsm !== "None") return viaSsm;
99 return aws([
100 "ec2",
101 "describe-images",
102 "--owners",
103 "amazon",
104 "--filters",
105 "Name=name,Values=Windows_Server-2022-English-Full-Base-*",
106 "Name=state,Values=available",
107 "--query",
108 "reverse(sort_by(Images,&CreationDate))[0].ImageId",
109 ]);
110 }
111 return aws([
112 "ssm",
113 "get-parameters",
114 "--names",
115 "/aws/service/canonical/ubuntu/server/22.04/stable/current/amd64/hvm/ebs-gp2/ami-id",
116 "--query",
117 "Parameters[0].Value",
118 ]);
119};
120
121const defaultSubnet = async (): Promise<string> => {
122 const vpc = await aws([

Callers 1

ec2VmFunction · 0.85

Calls 1

awsFunction · 0.85

Tested by

no test coverage detected