(Classic ASP) Generate S3 Signed URL
Demonstrates how to generate a pre-signed S3 URL. Note: This example requires Chilkat v11.0.0 or greater.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<%
' This example assumes the Chilkat API to have been previously unlocked.
' See Global Unlock Sample for sample code.
set http = Server.CreateObject("Chilkat.Http")
' Insert your access key here:
http.AwsAccessKey = "AWS_ACCESS_KEY"
' Insert your secret key here:
http.AwsSecretKey = "AWS_SECRET_KEY"
http.AwsRegion = "us-west-2"
http.AwsEndpoint = "s3-us-west-2.amazonaws.com"
bucketName = "chilkattest"
path = "starfish.jpg"
signedUrl = http.S3_GenPresignedUrl("GET",1,bucketName,path,3600,"s3")
If (http.LastMethodSuccess = 0) Then
Response.Write "<pre>" & Server.HTMLEncode( http.LastErrorText) & "</pre>"
Response.End
End If
Response.Write "<pre>" & Server.HTMLEncode( signedUrl) & "</pre>"
%>
</body>
</html>
|