Sample code for 30+ languages & platforms
C

Generate S3 Signed URL

See more Amazon S3 Examples

Demonstrates how to generate a pre-signed S3 URL.

Chilkat C Downloads

C
#include <C_CkHttp.h>

void ChilkatSample(void)
    {
    HCkHttp http;
    const char *bucketName;
    const char *path;
    const char *signedUrl;

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

    http = CkHttp_Create();

    // Insert your access key here:
    CkHttp_putAwsAccessKey(http,"AWS_ACCESS_KEY");

    // Insert your secret key here:
    CkHttp_putAwsSecretKey(http,"AWS_SECRET_KEY");

    CkHttp_putAwsRegion(http,"us-west-2");
    CkHttp_putAwsEndpoint(http,"s3-us-west-2.amazonaws.com");

    bucketName = "chilkattest";
    path = "starfish.jpg";

    signedUrl = CkHttp_s3_GenPresignedUrl(http,"GET",TRUE,bucketName,path,3600,"s3");
    if (CkHttp_getLastMethodSuccess(http) == FALSE) {
        printf("%s\n",CkHttp_lastErrorText(http));
        CkHttp_Dispose(http);
        return;
    }

    printf("%s\n",signedUrl);


    CkHttp_Dispose(http);

    }