Sample code for 30+ languages & platforms
Dart Requires Chilkat v11.0.0+

Generate S3 Signed URL

See more Amazon S3 Examples

Demonstrates how to generate a pre-signed S3 URL.

Chilkat Dart Downloads

Dart
import 'package:chilkat/chilkat.dart';

void main() {
  // This example assumes the Chilkat API to have been previously unlocked.
  // See Global Unlock Sample for sample code.

  final http = CkHttp();

  // 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';

  final bucketName = 'chilkattest';
  final path = 'starfish.jpg';

  final String signedUrl;
  try {
    signedUrl = http.s3GenPresignedUrl('GET', true, bucketName, path, 3600, 's3');
  } on ChilkatException catch (e) {
    print(e.lastErrorText);
    return;
  }

  print(signedUrl);
}