CURL.SetupAWS
-------------

Setup CURL to transfer to Amazon Webservices.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [7.2](newinversion72.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetupAWS"; curl; AWSAccessKeyId; AWSSecretAccessKey; Region; Service; Path; Domain; Verb { ; HashedPayload; Headers; QueryParameters } ) 

**MBS**( **"CURL.SetupAWS";** /\* Setup CURL to transfer to Amazon Webservices. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$AWSAccessKeyId**; /\* Your access key for AWS. \*/   
**$AWSSecretAccessKey**; /\* Your secret. \*/   
**$Region**; /\* The region to use.e.g. "eu-central-1" \*/   
**$Service**; /\* The service to use.e.g. "s3" \*/   
**$Path**; /\* The path for the URL.  
Should always start with "/".e.g. "/bucketname/test.jpg" \*/   
**$Domain**; /\* Optional the domain to use.  
By default we just build it from region and service.e.g. "s3.eu-central-1.amazonaws.com" or "s3-ap-southeast-2.amazonaws.com" \*/   
**$Verb**; /\* The HTTP Operation to do.  
Can be POST, PUT, GET, PATCH, HEAD or DELETE.  
  
Added COPY and MOVE for v15.4.e.g. "PUT" \*/   
**$HashedPayload**; /\* Optional; The hashed payload.  
If empty, we calculate it automatically from input data or postfields.  
This is a lowercase hex SHA256. \*/   
**$Headers**; /\* Optional; Extra HTTP headers to include.  
Here you can specify various headers to include in signature and request.e.g. "x-amz-acl: public-read" \*/   
**$QueryParameters**) /\* Optional; List of query parameters to include.  
Keys and values must be URL encoded using [Text.EncodeURLComponent](TextEncodeURLComponent.md).  
Keys may need to be lowercase.e.g. "id=123¶test=abc" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| curl | The CURL session handle. | $curl |  |
| AWSAccessKeyId | Your access key for AWS. |  |  |
| AWSSecretAccessKey | Your secret. |  |  |
| Region | The region to use. | "eu-central-1" |  |
| Service | The service to use. | "s3" |  |
| Path | The path for the URL.   Should always start with "/". | "/bucketname/test.jpg" |  |
| Domain | Optional the domain to use.   By default we just build it from region and service. | "s3.eu-central-1.amazonaws.com" or "s3-ap-southeast-2.amazonaws.com" |  |
| Verb | The HTTP Operation to do.   Can be POST, PUT, GET, PATCH, HEAD or DELETE.      Added COPY and MOVE for v15.4. | "PUT" |  |
| HashedPayload | The hashed payload.   If empty, we calculate it automatically from input data or postfields.   This is a lowercase hex SHA256. |  | Optional |
| Headers | Extra HTTP headers to include.   Here you can specify various headers to include in signature and request. | "x-amz-acl: public-read" | Optional |
| QueryParameters | List of query parameters to include.   Keys and values must be URL encoded using [Text.EncodeURLComponent](TextEncodeURLComponent.md).   Keys may need to be lowercase. | "id=123¶test=abc" | Optional      Added in version **8.4**. |

### Result

Returns OK or error.

### Description

Setup CURL to transfer to Amazon Webservices.  
This implements AWS4-HMAC-SHA256 signature for credentials, sets authentication, URL, HTTP Headers and other parameters.  
For upload or post, please set input parameters first.  
  
When using [CURL.OpenInputFile](CURLOpenInputFile.md) to stream data, you need to calculate the payload hash yourself (with [Hash.Digest](HashDigest.md)) and pass it here as parameter.  
  
Works also for other compatible S3 services beside Amazon's like the one from Wasabi or Dell ECS.  
  
Please be aware that this function depends on a correct time and date set on the computer. If the time is not set correct, the authentication will fail.  
  
See also [CURL.SetOptionAWSSigV4](CURLSetOptionAWSSigV4.md) function to enable CURL’s built-in AWS signature calculation.  
### Examples

Download via S3:

 Set Variable \[$AWSAccessKeyId ; Value:"xxx"\]  
Set Variable \[$AWSSecretAccessKey ; Value:"yyy"\]  
Set Variable \[$Region ; Value:"eu-central-1"\]  
Set Variable \[$Bucketname ; Value:"zzz"\]  
Set Variable \[$Filename ; Value:"test.jpg"\]  
Set Variable \[$Verb ; Value:"GET"\]  
Set Variable \[$Service ; Value:"s3"\]  
\#Keep those empty for default   
Set Variable \[$Domain ; Value:""\]  
Set Variable \[$HashedPayload ; Value:""\]  
\#Build a path   
Set Variable \[$Path ; Value:"/" &amp; $BucketName &amp; "/" &amp; $Filename \]  
\#   
Set Variable \[$curl ; Value:MBS ("[CURL.New](CURLNew.md)")\]  
Set Variable \[$result ; Value:MBS ("CURL.SetupAWS"; $curl ; $AWSAccessKeyId ; $AWSSecretAccessKey ; $Region ; $Service ; $Path ; $Domain ; $Verb )\]  
Set Variable \[$result ; Value:MBS ("[CURL.SetDebugWithData](CURLSetDebugWithData.md)"; $curl ; 1)\]  
Set Field \[CURL Test::Result ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl )\]  
Set Field \[CURL Test::Image ; MBS ("[CURL.GetResultAsJPEG](CURLGetResultAsJPEG.md)"; $curl )\]  
Set Field \[CURL Test::debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
Set Variable \[$result ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
Upload to S3:

 Set Variable \[$AWSAccessKeyId ; Value:"xxx"\]  
Set Variable \[$AWSSecretAccessKey ; Value:"xxx"\]  
Set Variable \[$Region ; Value:"us-east-1"\]  
Set Variable \[$Bucketname ; Value:"xxx"\]  
Set Variable \[$Filename ; Value:"test.jpg"\]  
Set Variable \[$Service ; Value:"s3"\]  
\# do upload   
Set Variable \[$Verb ; Value:"PUT"\]  
\# make file available to public   
Set Variable \[ $Headers ; Value: "Content-Type: image/jpeg¶x-amz-acl: public-read" \]   
\#Keep those empty for default   
Set Variable \[$Domain ; Value:""\]  
Set Variable \[$HashedPayload ; Value:""\]  
\#Build a path   
Set Variable \[$Path ; Value:"/" &amp; $BucketName &amp; "/" &amp; $Filename \]  
\#   
Set Variable \[$curl ; Value:MBS ("[CURL.New](CURLNew.md)")\]  
\# pass in container   
Set Variable \[$result ; Value:MBS ("[CURL.SetInputFile](CURLSetInputFile.md)"; $curl ; CURL Test::Image )\]  
\#   
Set Variable \[$result ; Value:MBS ("CURL.SetupAWS"; $curl ; $AWSAccessKeyId ; $AWSSecretAccessKey ; $Region ; $Service ; $Path ; $Domain ; $Verb ; ""; $Headers )\]  
Set Field \[CURL Test::Result ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl )\]  
Set Field \[CURL Test::debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
Set Field \[CURL Test::resultText ; MBS ("[CURL.GetResultAsText](CURLGetResultAsText.md)"; $curl )\]  
Set Variable \[$result ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
Upload PDF from container:

 Set Variable \[ $curl ; Value: MBS ("[CURL.New](CURLNew.md)") \]   
Set Variable \[ $result ; Value: MBS ("[CURL.SetInputPDF](CURLSetInputPDF.md)"; $curl ; Documents::PDFContainer ) \]   
Set Variable \[ $result ; Value: MBS ("CURL.SetupAWS"; $curl ; $AWSAccessKeyId ; $AWSSecretAccessKey ; $Region ; $Service ; $Path ; $Domain ; $Verb ; ""; $headers ) \]   
Set Field \[ CURL Test::Result ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl ) \]   
Set Field \[ CURL Test::debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl ) \]   
Set Variable \[ $result ; Value: MBS ("[CURL.Release](CURLRelease.md)"; $curl ) \]  
Upload file from disk and calculate hash ourselves:

 # Build a path to file (local) and in AWS   
Set Variable \[ $Filename ; Value: "test.pdf" \]   
Set Variable \[ $Path ; Value: "/" &amp; $BucketName &amp; "/PDF/" &amp; $Filename \]   
Set Variable \[ $localPath ; Value: "/Users/cs/Desktop/license.pdf" \]   
\# calculate hash for file to upload   
Set Variable \[ $HashedPayload ; Value: Lower(MBS ( "[Hash.Digest](HashDigest.md)"; "sha256"; "path"; $localPath ; ""; "hex" )) \]   
\# upload   
Set Variable \[ $curl ; Value: MBS ("[CURL.New](CURLNew.md)") \]   
\# file content is streamed   
Set Variable \[ $result ; Value: MBS ("[CURL.OpenInputFile](CURLOpenInputFile.md)"; $curl ; $localPath ) \]   
\# setup AWS   
Set Variable \[ $result ; Value: MBS ("CURL.SetupAWS"; $curl ; $AWSAccessKeyId ; $AWSSecretAccessKey ; $Region ; $Service ; $Path ; $Domain ; $Verb ; $HashedPayload ; $headers ) \]   
Set Field \[ CURL Test::Result ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl ) \]   
Set Field \[ CURL Test::debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl ) \]   
Set Variable \[ $result ; Value: MBS ("[CURL.Release](CURLRelease.md)"; $curl ) \]  
Upload to S3 with transfer acceleration:

 # transfer acceleration must be enabled for the bucket.   
\# while region is not needed for the URL, it is still going into security checksums.   
  
Set Variable \[$AWSAccessKeyId ; Value:"xxx"\]  
Set Variable \[$AWSSecretAccessKey ; Value:"xxx"\]  
Set Variable \[$Region ; Value:"us-east-1"\]  
Set Variable \[$Bucketname ; Value:"xxx"\]  
Set Variable \[$Filename ; Value:"test.jpg"\]  
Set Variable \[$Service ; Value:"s3"\]  
\# do upload   
Set Variable \[$Verb ; Value:"PUT"\]  
\# make file available to public   
Set Variable \[ $Headers ; Value: "Content-Type: image/jpeg¶x-amz-acl: public-read" \]   
\#Keep those empty for default   
Set Variable \[$Domain ; Value: $BucketName &amp; ".s3-accelerate.amazonaws.com"\]  
Set Variable \[$HashedPayload ; Value:""\]  
\#Build a path   
Set Variable \[$Path ; Value:"/" &amp; $Filename \]  
\#   
Set Variable \[$curl ; Value:MBS ("[CURL.New](CURLNew.md)")\]  
\# pass in container   
Set Variable \[$result ; Value:MBS ("[CURL.SetInputFile](CURLSetInputFile.md)"; $curl ; CURL Test::Image )\]  
\#   
Set Variable \[$result ; Value:MBS ("CURL.SetupAWS"; $curl ; $AWSAccessKeyId ; $AWSSecretAccessKey ; $Region ; $Service ; $Path ; $Domain ; $Verb ; ""; $Headers )\]  
Set Field \[CURL Test::Result ; MBS ("[CURL.Perform](CURLPerform.md)"; $curl )\]  
Set Field \[CURL Test::debug ; MBS ("[CURL.GetDebugMessages](CURLGetDebugMessages.md)"; $curl )\]  
Set Field \[CURL Test::resultText ; MBS ("[CURL.GetResultAsText](CURLGetResultAsText.md)"; $curl )\]  
Set Variable \[$result ; Value:MBS ("[CURL.Release](CURLRelease.md)"; $curl )\]  
### See also

- [CURL.GetDebugMessages](CURLGetDebugMessages.md)
- [CURL.GetResultAsJPEG](CURLGetResultAsJPEG.md)
- [CURL.New](CURLNew.md)
- [CURL.OpenInputFile](CURLOpenInputFile.md)
- [CURL.Perform](CURLPerform.md)
- [CURL.Release](CURLRelease.md)
- [CURL.SetDebugWithData](CURLSetDebugWithData.md)
- [CURL.SetInputFile](CURLSetInputFile.md)
- [CURL.SetOptionAWSSigV4](CURLSetOptionAWSSigV4.md)
- [Text.EncodeURLComponent](TextEncodeURLComponent.md)

### Release notes

- **Version 15.4**
    - Added COPY and MOVE verbs for [CURL.SetupAWS](https://www.mbsplugins.eu/CURLSetupAWS.shtml) function.
- **Version 14.0**
    - Fixed [CURL.SetupAWS](https://www.mbsplugins.eu/CURLSetupAWS.shtml) and [CURL.SetupOAuth](https://www.mbsplugins.eu/CURLSetupOAuth.shtml) to reset NoBody flag if new transfer is not head.
- **Version 13.0**
    - Add PATCH support for [CURL.SetupAWS](https://www.mbsplugins.eu/CURLSetupAWS.shtml) function.
- **Version 11.4**
    - Added HEAD as verb for [CURL.SetupAWS](https://www.mbsplugins.eu/CURLSetupAWS.shtml) and [CURL.SetupOAuth](https://www.mbsplugins.eu/CURLSetupOAuth.shtml) functions.
    - Fixed an issue with [CURL.SetupAWS](https://www.mbsplugins.eu/CURLSetupAWS.shtml) doing an unneeded lower case for the query parameter name.
- **Version 8.4**
    - Added new query parameter for [CURL.SetupAWS](http://www.mbsplugins.eu/CURLSetupAWS.shtml) function.
- **Version 8.2**
    - Changed [CURL.SetupAWS](http://www.mbsplugins.eu/CURLSetupAWS.shtml) to no longer complain for empty path string as this is needed for AWS Translate.
- **Version 8.1**
    - Improved [CURL.SetupAWS](http://www.mbsplugins.eu/CURLSetupAWS.shtml) method to work better with Amazon S3 and also with Dell ECS.
- **Version 8.0**
    - Fixed bug in [CURL.SetupAWS](http://www.mbsplugins.eu/CURLSetupAWS.shtml) when wrong date was used.

### Example Databases

- [CURL/Amazon S3/Amazon S3 Buckets](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Buckets.shtml#1ScriptAnchor_)
- [CURL/Amazon S3/Amazon S3 Download Picture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Download%20Picture.shtml#1ScriptAnchor_)
- [CURL/Amazon S3/Amazon S3 Upload File](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Upload%20File.shtml#3ScriptAnchor_)
- [CURL/Amazon S3/Amazon S3 Upload Picture](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Amazon%20S3%20Upload%20Picture.shtml#3ScriptAnchor_)
- [CURL/Amazon S3/Containers in S3](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/Amazon%20S3/Containers%20in%20S3.shtml#2ScriptAnchor_)

### Blog Entries

- [MBS Plugin 15.4 for Claris FileMaker](https://www.mbsplugins.de/archive/2025-09-09/MBS_Plugin_154_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 15.4pr2](https://www.mbsplugins.de/archive/2025-08-12/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Send SMS with Amazon web service](https://www.mbsplugins.de/archive/2025-01-20/Send_SMS_with_Amazon_web_servi/monkeybreadsoftware_blog_filemaker)
- [MBS Plugin 13.0 for Claris FileMaker](https://www.mbsplugins.de/archive/2023-01-17/MBS_Plugin_130_for_Claris_File/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 11.4 - More than 6500 Functions In One Plugin](https://www.mbsplugins.de/archive/2021-09-07/MBS_FileMaker_Plugin_114_-_Mor/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 11.1](https://www.mbsplugins.de/archive/2021-03-16/MBS_FileMaker_Plugin_111/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin v8.1 with 5100 Functions In One Plugin](https://www.mbsplugins.de/archive/2018-03-06/MBS_FileMaker_Plugin_v81_with_/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 8.1](https://www.mbsplugins.de/archive/2018-03-06/MBS_FileMaker_Plugin_81/monkeybreadsoftware_blog_filemaker)
- [Amazon S3 Upload with Mime Type and Permissions](https://www.mbsplugins.de/archive/2017-11-30/Amazon_S3_Upload_with_Mime_Typ/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin 7.2](https://www.mbsplugins.de/archive/2017-05-15/MBS_FileMaker_Plugin_72/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 22nd March 2017 , last changed 25th February 2026

  
[CURL.SetUpdateProgressDialog](CURLSetUpdateProgressDialog.md) - [CURL.SetupOAuth](CURLSetupOAuth.md)

[HTML Version](CURLSetupAWS.shtml)