(Objective-C) Generate S3 Signed URL
Demonstrates how to generate a pre-signed S3 URL. Note: This example requires Chilkat v11.0.0 or greater.
#import <CkoHttp.h>
#import <NSString.h>
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkoHttp *http = [[CkoHttp alloc] init];
// 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";
NSString *bucketName = @"chilkattest";
NSString *path = @"starfish.jpg";
NSString *signedUrl = [http S3_GenPresignedUrl: @"GET" useHttps: YES bucketName: bucketName path: path numSecondsValid: [NSNumber numberWithInt: 3600] awsService: @"s3"];
if (http.LastMethodSuccess == NO) {
NSLog(@"%@",http.LastErrorText);
return;
}
NSLog(@"%@",signedUrl);
|