API Connect

API Connect

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  AWS Signature S3 in APIC

    Posted Mon November 13, 2023 10:22 AM

    Hi, 

    We want to create an S3 bucket API (upload file using multipart-form-data) with an AWS signature in IBM API Connect v10. The direct AWS endpoint is working fine in Postman by providing the following details:

    Method: PUT, AWS Endpoint, AccessKey, SecretKey, AWS Region, Service Name

    Anyone know how to achieve this in API Connect?



    ------------------------------
    Suraj Sakpal
    ------------------------------


  • 2.  RE: AWS Signature S3 in APIC

    Posted Tue November 14, 2023 04:02 AM

    Hi,

    After once implementing such a custom AWS signature authentication in APIC/DataPower with XSLT and gateway script, I'd instead suggest perhaps using AWS Lambda in between, providing easier authentication for APIC (e.g. API key), and then using AWS native capabilities between Lambda and S3. Just my two cents :)

    Br, Panu



    ------------------------------
    Panu Tamminen
    Digia
    ------------------------------



  • 3.  RE: AWS Signature S3 in APIC

    Posted Tue November 14, 2023 12:34 PM

    Hi Suraj,

    AWS uses a custom HTTP scheme based on a keyed-HMAC (Hash Message Authentication Code) for authentication. In Postman, when you select AWS Signature, Postman behind the scenes tries to construct this HMAC token from the provided variables (AccessKey, SecretKey, AWS Region, Service Name). You can read more about how HMAC authentication works here. There are two methods to send this token to AWS:

    1. Using Query parameter as documented here.
    2. Using Authorization header as documented here.

    The main complication with preparing this query param or header is computing the request signature. This is mandatory by AWS S3 to ensure the authenticity of the request. I could not find a way to skip this.

    The Authorization header is represented like this:

    Authorization: AWS4-HMAC-SHA256 Credential=<your-access-key-id>/<date>/<aws-region>/<aws-service>/aws4_request, SignedHeaders=host;range;x-amz-date, Signature=fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024

    Here, AWS4-HMAC-SHA256 is the algorithm used for signature calculation and fe5f80f77d5fa3beca038a248ff027d0445342fe2855ddc963176630326f1024 is the signature. IBM has a guide on how to construct this signature here: IBM Cloud: Constructing an HMAC signature

    So, in short, you will have to manually create this Authorization header for API Connect through a script. I hope this helps.



    ------------------------------
    Ruchi Yadav
    ------------------------------



  • 4.  RE: AWS Signature S3 in APIC

    Posted Tue November 14, 2023 01:08 PM

    Hi,

    Thanks for reply.

    Can you please share with me any sample API YAML if it is possible? Or any reference link to create an API in IBM API Connect?



    ------------------------------
    Suraj Sakpal
    ------------------------------



  • 5.  RE: AWS Signature S3 in APIC

    Posted Mon December 18, 2023 12:37 AM

    Hi Ruchi,

    Can you please share with me any sample API YAML if it is possible? Or any reference link to create an API in IBM API Connect?



    ------------------------------
    Suraj Sakpal
    ------------------------------