Created
September 23, 2014 07:57
-
-
Save lantrix/98dc0989481449918e87 to your computer and use it in GitHub Desktop.
Tag a bunch of new volumes in AWS EC2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $newvols = ("vol-7f273b7b","vol-b5273bb1","vol-b6273bb2","vol-c6273bc2","vol-b1273bb5") | |
| $tags = @() | |
| $tag = New-Object Amazon.EC2.Model.Tag | |
| $tag.Key = "Attached" | |
| $tag.Value = "i-d7a706e9" | |
| $tags += $tag | |
| $tag = New-Object Amazon.EC2.Model.Tag | |
| $tag.Key = "Environment Name" | |
| $tag.Value = "My Env" | |
| $tags += $tag | |
| $tag = New-Object Amazon.EC2.Model.Tag | |
| $tag.Key = "Owner" | |
| $tag.Value = "My Owner" | |
| $tags += $tag | |
| $tag = New-Object Amazon.EC2.Model.Tag | |
| $tag.Key = "Project" | |
| $tag.Value = "My Project" | |
| $tags += $tag | |
| $tag = New-Object Amazon.EC2.Model.Tag | |
| $tag.Key = "Name" | |
| $tag.Value = "myServerName" | |
| $tags += $tag | |
| foreach ($this in $newvols) { | |
| New-EC2Tag -ResourceId $this -Tags $tags | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment