AWS Tools for Windows PowerShell
Command Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Synopsis

Creates a signed URL that grants universal access to private content until a given date (using a canned policy) or tailored access to private content based on an access time window and ip range.

Syntax

CannedPolicy (Default)

New-CFSignedUrl
-ResourceUri <Uri>
-KeyPairId <String>
-PrivateKeyFile <String>
-ExpiresOn <DateTime>
-AsString <SwitchParameter>

CustomPolicy

New-CFSignedUrl
-ResourceUri <Uri>
-KeyPairId <String>
-PrivateKeyFile <String>
-ExpiresOn <DateTime>
-ActiveFrom <DateTime>
-IpRange <String>
-AsString <SwitchParameter>

Description

Creates a signed URL that grants universal access to private content until a given date (using a canned policy) or tailored access to private content based on an access time window and ip range.

Parameters

-ActiveFrom <DateTime>
The date from which the URL can be accessed.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-AsString <SwitchParameter>
If set the cmdlet outputs the signed url as a simple string. The default is to wrap and emit the url as a System.Uri object.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-ExpiresOn <DateTime>
The expiration date of the signed URL.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)
-IpRange <String>
The allowed IP address range of the client making the GET request, in CIDR form (e.g. 192.168.0.1/24). If not specified, a CIDR of 0.0.0.0/0 (i.e. no IP restriction) is used.
Required?False
Position?Named
Accept pipeline input?True (ByPropertyName)
-KeyPairId <String>
The key pair id corresponding to the private key file supplied to the PrivateKeyFile parameter.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)
-PrivateKeyFile <String>
The private key file. RSA private key (.pem) files are supported.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)
-ResourceUri <Uri>
The URL or path that uniquely identifies a resource within a distribution. For standard distributions the resource URL will be "http://" + distributionName + "/" + path (may also include URL parameters). For distributions with the HTTPS required protocol, the resource URL must start with "https://". RTMP resources do not take the form of a URL, and instead the resource path is nothing but the stream's name.
Required?True
Position?Named
Accept pipeline input?True (ByPropertyName)

Outputs

System.Uri
This cmdlet returns a signed uri to the private content.
System.String
This cmdlet returns a signed uri to the private content as a string if the -AsString switch is specified.

Examples

Example 1

$params = @{
"ResourceUri"="https://cdn.example.com/index.html"
"KeyPairId"="AKIAIOSFODNN7EXAMPLE"
"PrivateKeyFile"="C:\pk-AKIAIOSFODNN7EXAMPLE.pem"
"ExpiresOn"=(Get-Date).AddHours(1)
}
New-CFSignedUrl @params
Creates a signed url to the specified resource using a canned policy. The url will be valid for one hour. A System.Uri object containing the signed url is emitted to the pipeline.

Example 2

$start = (Get-Date).AddHours(24)
$params = @{
"ResourceUri"="https://cdn.example.com/index.html"
"KeyPairId"="AKIAIOSFODNN7EXAMPLE"
"PrivateKeyFile"="C:\pk-AKIAIOSFODNN7EXAMPLE.pem"
"ExpiresOn"=(Get-Date).AddDays(7)
"ActiveFrom"=$start
}
New-CFSignedUrl @params
Creates a signed url to the specified resource using a custom policy. The url will be valid starting in 24 hours and will expire one week later.

Example 3

$start = (Get-Date).AddHours(24)
$params = @{
"ResourceUri"="https://cdn.example.com/index.html"
"KeyPairId"="AKIAIOSFODNN7EXAMPLE"
"PrivateKeyFile"="C:\pk-AKIAIOSFODNN7EXAMPLE.pem"
"ExpiresOn"=(Get-Date).AddDays(7)
"ActiveFrom"=$start
"IpRange"="192.0.2.0/24"
}
New-CFSignedUrl @params
Creates a signed url to the specified resource using a custom policy. The url will be valid starting in 24 hours and will expire one week later. Access to the resource is restricted to the specified ip range.

Supported Version

AWS Tools for PowerShell: 2.x.y.z