Signs an http(s) request options object with AWS Signature Version 4 headers and returns them
npm install aws-sigv4-ec2metasignAWS function provided by the module to add the appropriate cryptographically secure headers to an http or https request options object. This function accepts an options object as the first parameter and a callback as the second parameter. checkout reponpm install``
let signAWS = require('./aws-sigv4-ec2metadata/index.js');
let https = require('https');
let deleteOpts = {
host: 'exampleapi.execute-api.us-west-2.amazonaws.com',
path: '/api/configs/1',
method: 'DELETE'
};
signAWS(deleteOpts, (signedOpts) => {
let req = https.request(signedOpts, (res) => {
let body = [];
res.on('data', (d) => {
body.push(d);
});
res.on('end', () => console.log(body.join('')));
});
req.on('error', console.error);
req.end();
});
`
1. Boto dependency
1. sudo easy_install pipsudo pip install boto
1. server.conf
1. Clone https://github.com/dump247/aws-mock-metadata.git
1. Configure aws-mock-metadata
1. Create a file in the root of the aws-mock-metadata folder (see server.conf.sample for an example of this)./bin/server-macos
1. Replace the ** values in this file with your AWS user access key and secret key
1. Start the mock metadata server by running
1. Verify the server is running and configured correctly by hitting the metadata url in your local browser
Note that your user account and/or ec2 instance profile role must have the execute-api` policy for a given resource in order to query AWS_IAM protected API methods.