superagent-aws-signed-request
Superagent plugin that intercepts and signs the request with AWS Signature V4
Usage
Params
- service - { String, required } a string specifying the AWS service you wish to make a request to. Supported Services.
- options - { Object, optional } config object that contains optional params that have defaults
- key - { String } override for default of AWS_ACCESS_KEY_ID environment variable
- secret - { String } override for default of AWS_SECRET_ACCESS_KEY environment variable
- region - { String } override for default of AWS_REGION environment variable
- sessionToken - { String } required if you are using temporary credentials from AWS STS
Supported Aws Services
To find the appropriate service name to use, a helpful resource is the Amazon Resource Names (ARNs) and AWS Service Namespaces page.
Note: Some services like API Gateway while having a namespace of apigateway
, actually require you to pass execute-api
if you are trying to make a request to the api hosted there. If you choose the wrong service name, an error should be returned with the service name you need, based on the service you are making a request to.
Example
const request = ;const signRequest = ; const awsService = 'execute-api'; // using api gateway as an example, look above for other services you can make requests toreturn request ;
Install
It's available on npm so you can simply install it with:
npm install --save superagent-aws-signed-request