Apply tags to registered AMI
Adding the tag called `Name` to the AMI ensures that the name appears in the *Name* column inside AWS' web console. Fixes #1171. Signed-off-by: Major Hayden <major@redhat.com>
This commit is contained in:
parent
15969e0adc
commit
2618e11bfe
2 changed files with 23 additions and 0 deletions
|
|
@ -243,6 +243,23 @@ func (a *AWS) Register(name, bucket, key string, shareWith []string, rpmArch str
|
|||
|
||||
log.Printf("[AWS] 🎉 AMI registered: %s", *registerOutput.ImageId)
|
||||
|
||||
// Tag the image with the image name.
|
||||
req, _ = a.ec2.CreateTagsRequest(
|
||||
&ec2.CreateTagsInput{
|
||||
Resources: []*string{registerOutput.ImageId},
|
||||
Tags: []*ec2.Tag{
|
||||
{
|
||||
Key: aws.String("Name"),
|
||||
Value: aws.String(name),
|
||||
},
|
||||
},
|
||||
},
|
||||
)
|
||||
err = req.Send()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if len(shareWith) > 0 {
|
||||
log.Println("[AWS] 💿 Sharing ec2 AMI")
|
||||
var launchPerms []*ec2.LaunchPermission
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue