Search code examples
javascriptbrowserifyaws-sdk

require only SQS from aws-sdk in the browser


I'm implementing an API on top of AWS's SQS.
I want to make a browser implementation and, in order for the build not to become to big, i only want to require the SQS part, something like:

var SQS = require('aws-sdk/sqs')

would this be possible?


Solution

  • Yes, go to this page and follow the instructions for building your own version of the SDK. The section of that page titled Building Specific Services and API Versions tells you exactly how to build a version of the API that includes only the services you are interested in. Once you download the source, the command to build the SDK and include only the SQS service would be:

    node dist-tools/browser-builder.js sqs > aws-sdk-sqs.js
    

    Edit with new info:

    Amazon now provides an online service to make it even easier to create your own SDK build: https://sdk.amazonaws.com/builder/js/