1

If we want to use AWS Signature Version 4 IAM authorization to add some security controls to some functions in our AWS API,

so only a salesforce user can use these particular functions.

Do salesforce support AWS Signature Version 4 IAM authorization when calling out to REST API services?

6

Salesforce now has native support for AWS v4 signature generation.

Create a new Named Credential for the service endpoint, for example:

  • Name: S3
  • URL: https://s3.us-east-1.amazonaws.com
  • Identity Type: Named Principal
  • Auth Protocol: AWS Signature V4
  • AWS Access Key ID: [your key here]
  • AWS Secret Access Key: [your secret here]
  • AWS Region: us-east-1
  • AWS Service: s3

Then send an HTTP request according to the API docs, eg:

String url = 'callout:S3/bucket/file.ext';

HttpRequest request = new HttpRequest();
request.setMethod('GET');
request.setEndpoint(url);
HttpResponse response = new Http().send(request);

Keys are generated from AWS Console > Security Credentials > Access Keys

enter image description here

1
  • where are the definitions for canonicalMethodFor, canonicalUriFor, canonicalQueryStringFor, canonicalHeadersFor, signedHeadersFor, hexEncodedHash ? also could you probide a sample of the params map? for instance to list bucket
    – manza
    Jun 22 '19 at 22:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.