@@ -192,6 +192,50 @@ func GetUbuntu1604AmiE(t testing.TestingT, region string) (string, error) {
192
192
return GetMostRecentAmiIdE (t , region , CanonicalAccountId , filters )
193
193
}
194
194
195
+ // GetUbuntu2004Ami gets the ID of the most recent Ubuntu 20.04 HVM x86_64 EBS GP2 AMI in the given region.
196
+ func GetUbuntu2004Ami (t testing.TestingT , region string ) string {
197
+ amiID , err := GetUbuntu2004AmiE (t , region )
198
+ if err != nil {
199
+ t .Fatal (err )
200
+ }
201
+ return amiID
202
+ }
203
+
204
+ // GetUbuntu2004AmiE gets the ID of the most recent Ubuntu 20.04 HVM x86_64 EBS GP2 AMI in the given region.
205
+ func GetUbuntu2004AmiE (t testing.TestingT , region string ) (string , error ) {
206
+ filters := map [string ][]string {
207
+ "name" : {"*ubuntu-focal-20.04-amd64-server-*" },
208
+ "virtualization-type" : {"hvm" },
209
+ "architecture" : {"x86_64" },
210
+ "root-device-type" : {"ebs" },
211
+ "block-device-mapping.volume-type" : {"gp2" },
212
+ }
213
+
214
+ return GetMostRecentAmiIdE (t , region , CanonicalAccountId , filters )
215
+ }
216
+
217
+ // GetUbuntu2204Ami gets the ID of the most recent Ubuntu 22.04 HVM x86_64 EBS GP2 AMI in the given region.
218
+ func GetUbuntu2204Ami (t testing.TestingT , region string ) string {
219
+ amiID , err := GetUbuntu2204AmiE (t , region )
220
+ if err != nil {
221
+ t .Fatal (err )
222
+ }
223
+ return amiID
224
+ }
225
+
226
+ // GetUbuntu2204AmiE gets the ID of the most recent Ubuntu 22.04 HVM x86_64 EBS GP2 AMI in the given region.
227
+ func GetUbuntu2204AmiE (t testing.TestingT , region string ) (string , error ) {
228
+ filters := map [string ][]string {
229
+ "name" : {"*ubuntu-jammy-22.04-amd64-server-*" },
230
+ "virtualization-type" : {"hvm" },
231
+ "architecture" : {"x86_64" },
232
+ "root-device-type" : {"ebs" },
233
+ "block-device-mapping.volume-type" : {"gp2" },
234
+ }
235
+
236
+ return GetMostRecentAmiIdE (t , region , CanonicalAccountId , filters )
237
+ }
238
+
195
239
// GetCentos7Ami returns a CentOS 7 public AMI from the given region.
196
240
// WARNING: you may have to accept the terms & conditions of this AMI in AWS MarketPlace for your AWS Account before
197
241
// you can successfully launch the AMI.
0 commit comments