File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
upload-ami/src/upload_ami Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -298,6 +298,7 @@ def upload_ami(
298
298
prefix : str ,
299
299
run_id : str ,
300
300
public : bool ,
301
+ dest_regions : list [str ],
301
302
) -> dict [str , str ]:
302
303
"""
303
304
Upload NixOS AMI to AWS and return the image ids for each region
@@ -323,7 +324,8 @@ def upload_ami(
323
324
)
324
325
325
326
regions = filter (
326
- lambda x : x .get ("RegionName" ) != ec2 .meta .region_name ,
327
+ lambda x : x .get ("RegionName" ) != ec2 .meta .region_name
328
+ and (True if dest_regions == [] else x .get ("RegionName" ) in dest_regions ),
327
329
ec2 .describe_regions ()["Regions" ],
328
330
)
329
331
@@ -354,6 +356,13 @@ def main() -> None:
354
356
"--prefix" , required = True , help = "Prefix to prepend to image name"
355
357
)
356
358
parser .add_argument ("--run-id" , help = "Run id to append to image name" )
359
+ parser .add_argument (
360
+ "--dest-region" ,
361
+ help = "Regions to copy to if copy-to-regions is enabled" ,
362
+ action = "append" ,
363
+ default = [],
364
+ )
365
+
357
366
args = parser .parse_args ()
358
367
359
368
level = logging .DEBUG if args .debug else logging .INFO
@@ -370,6 +379,7 @@ def main() -> None:
370
379
args .prefix ,
371
380
args .run_id ,
372
381
args .public ,
382
+ args .dest_region ,
373
383
)
374
384
print (json .dumps (image_ids ))
375
385
You can’t perform that action at this time.
0 commit comments