I am trying to create the named credentials for AWS using Metadata API. I am getting the following error:

System.CalloutException: Web service callout failed: WebService returned a SOAP Fault: 'AwsSig4' is not a valid value for the enum 'AuthenticationProtocol'.

As per the document, we need to use the AwsSig4 for the AWS Signature V4:

enter image description here


MetadataService.MetadataPort service = createService();
    MetadataService.NamedCredential credential = new MetadataService.NamedCredential();
    credential.fullName = '********';
    credential.label = '**********';
    credential.endpoint = 'https://amazonaws.com';
    credential.principalType = 'NamedUser';
    credential.generateAuthorizationHeader = true;
    credential.awsRegion = '********';
    credential.awsService = '**';
    credential.awsAccessKey = '********************************';
    credential.awsAccessSecret = '*************************************';
    credential.protocol = 'AwsSig4';
     List<MetadataService.SaveResult> results = service.createMetadata(
            new MetadataService.Metadata[] { credential });
    catch(Exception e){
        System.debug('---Exception if any --- ' +e.getMessage());

2 Answers 2


Salesforce doc is incorrect, at least in version 48. In v48, the value of protocol for AWS signature is AwsSv4


This is a typo in our documentation. Please use "AwsSv4" instead of "AwsSig4". This has been reported to our Platform Integration Engineering team and our document will be updated to reflect the same. Thank you

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .