forked from benpiper/aws-powershell
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelpers.ps1
More file actions
27 lines (23 loc) · 686 Bytes
/
Copy pathhelpers.ps1
File metadata and controls
27 lines (23 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
### New-NameTag
# Example variables
# $name = "Webtier VPC"
# $resourceID = "vpc-12345678"
function New-NameTag {
param (
[Parameter(Mandatory)] [string]$name,
[Parameter(Mandatory)] [string]$resourceID
)
# Create a tag object with the key "Name" and specified value
$tag = New-Object Amazon.EC2.Model.Tag
$tag.Key = "Name"
$tag.Value = $name
# Attach the tag to the subnet
New-EC2Tag -Tag $tag -Resource $resourceID
}
function Get-ResourceByTagValue {
param (
[string]$keyvalue="*"
)
$tag = Get-EC2Tag -Filter @( @{name="value";value=$keyvalue}) | Sort-Object -Property Value,ResourceType
return $tag
}