Skip to content

ar4mirez/hapi-aws

Repository files navigation

hapi-aws

AWS plugin for HapiJS.

travis build codecov coverage version downloads semantic-release

Dependency Status devDependency Status Build Status

Install

$ npm install hapi-aws

Usage

// Using server register.

server.register({
    register: require('hapi-aws'),
    options: {
        global: {
            accessKeyId: 'accessKeyId',
            secretAccessKey: 'secretAccessKey',
            region: 'us-east-1'
        },
        services: [{
            name: 'ec2Identification',
            service: 'EC2',
            options: {
                accessKeyId: 'anotherAccessKeyId',
                secretAccessKey: 'anotherSecretAccessKey',
            }
        }, {
            name: 's3Identification',
            service: 'S3',
            options: {
                region: 'us-west-2'
            }
        }]
    }
})

// Using manifest.
{
    ...
    registration: [{
        plugin: 'hapi-aws',
        options: {
            global: {
                accessKeyId: 'accessKeyId',
                secretAccessKey: 'secretAccessKey',
                region: 'us-east-1'
            },
            services: [{
                name: 's3Identification',
                service: 'S3',
                options: {
                    region: 'us-west-2'
                }
            }]
        }
    }]
}

AWS Supported services

Check the following services here: AWS Services

When passing a service please drop the AWS namespace example:

service.name: [string] used later to access the service like: server.plugins['hapi-aws'].aws.ec2Identification

service.service: [string] from the previous list exmple: EC2