Tag list on EC2 instance ID’s

This script was reuqired to tag a list of instance ID’s to change/add Service Owner tag. Please remember to confirgure powershell for AWS and also change the $tag.value variable

 

########################################
## Bulk Tag for Multiple Instances ##
## Ben Prudence - 07/09/2016 ##
########################################

##
Import-Module AWSPowershell

## Tag Details
$tag = New-Object Amazon.EC2.Model.Tag
$tag.Key = "ServiceOwner"
$tag.Value = "NAME OF SERVICE OWNER"

## Import List of instance ID's
$Instances = Get-Content C:\Scripts\instances.txt

## Loop Instances to Tag
Foreach ($instance in $Instances) {
New-EC2Tag -Resource $instance -Tag $tag -Region eu-west-1
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.