Managing the AMI
Other commands and options are available with the genvid-ami script. There are some which are particularly helpful for managing the AMI:
Note
In most of those commands, the AMI ID (in the form
ami-1234abcd
) is used instead of the AMI name to allow
manipulating different versions of the AMI. Use the list command
to find it based on the AMI prefix and type.
rename
genvid-ami rename [ami-id] [new-prefix]
Use this command to copy the saved AMI and save it with a new prefix. Your team can use the AMI with the new prefix to launch preconfigured clusters.
copy
genvid-ami copy [ami-id] [region1] [region2] ...
This command copies the AMI to different regions. To see the name of the valid regions, you can run:
aws ec2 describe-regions --query "Regions[].RegionName" --output text
list
This command lists all AMI IDs and the AMI names of all the
wingame
AMIs of the current version that have the prefix
myprefix
:
genvid-ami list --prefix myprefix --output "{ami.id} {ami.name}" wingame
You can use this to find your AMI ID if you forget it.
delete
This command allows you to delete both the AMIs and their snapshots. The following examples show how to delete all AMIs from a previous version of the SDK.
REM Under Command Prompt
genvid-ami list --prefix '*' --version 1.12.0 --output "{ami.id}" wingame > todelete.txt
genvid-ami --loglevel INFO delete @todelete.txt --dryrun
# Under powershell
genvid-ami list --prefix '*' --version 1.12.0 --output "{ami.id}" wingame | out-file -encoding ascii todelete.txt
genvid-ami --loglevel INFO delete '@todelete.txt' --dryrun
Important
Use the --dryrun
option to test your command without actually deleting
any AMIs. When you’ve confirmed you’re deleting only the AMIs you
want to, remove the --dryrun
option.
managing permissions
You can manage the launch permission of the AMI using the
describe-permissions
and modify-permissions
commands.
The following example show how to give another account the permission to
use an AMI.
genvid-ami modify-permissions {ami_id} {account_id}
See also
game_ami_owners
variable in the Terraform Modules.