Example 1
$params = @{
"ResourceUri"="http://xyz.cloudfront.net/image1.jpeg"
"KeyPairId"="AKIAIOSFODNN7EXAMPLE"
"PrivateKeyFile"="C:\pk-AKIAIOSFODNN7EXAMPLE.pem"
"ExpiresOn"=(Get-Date).AddYears(1)
}
New-CFSignedCookie @params
Expires
-------
[CloudFront-Expires, 1472227284]
Creates a signed cookie to the specified resource using a canned policy. The cookie will be valid for one year.
Example 2
$start = (Get-Date).AddHours(24)
$params = @{
"ResourceUri"="http://xyz.cloudfront.net/content/*.jpeg"
"KeyPairId"="AKIAIOSFODNN7EXAMPLE"
"PrivateKeyFile"="C:\pk-AKIAIOSFODNN7EXAMPLE.pem"
"ExpiresOn"=$start.AddDays(7)
"ActiveFrom"=$start
}
New-CFSignedCookie @params
Policy
------
[CloudFront-Policy, eyJTd...wIjo...
Creates a signed cookie to the specified resources using a custom policy. The cookie will be valid in 24 hours and will expire one week afterward.
Example 3
$start = (Get-Date).AddHours(24)
$params = @{
"ResourceUri"="http://xyz.cloudfront.net/content/*.jpeg"
"KeyPairId"="AKIAIOSFODNN7EXAMPLE"
"PrivateKeyFile"="C:\pk-AKIAIOSFODNN7EXAMPLE.pem"
"ExpiresOn"=$start.AddDays(7)
"ActiveFrom"=$start
"IpRange"="192.0.2.0/24"
}
New-CFSignedCookie @params
Policy ------ [CloudFront-Policy, eyJTd...wIjo...
Creates a signed cookie to the specified resources using a custom policy. The cookie will be valid in 24 hours and will expire one week afterward. Access to the resources is restricted to the specified ip range.