Coder Social home page Coder Social logo

aws-sms-lambda's Introduction

AWS SMS Lambda

A simple Node.js application illustrating usage of the AWS SDK for sending SMS.

Requirements

The only requirement of this application is the Node Package Manager. All other dependencies (including the AWS SDK for Node.js) can be installed with:

npm install

Basic Configuration

You need to set up your AWS security credentials before the sample code is able to connect to AWS. You can do this by editing the config.json file. Ultimately, it would be better to use Environment Variables inside Lambda.

Although you dont need to set anything up in the AWS SNS console specifically, you will need a user with the proper IAM roles for SNS. Notably, AmazonSNSFullAccess

{ 
    "accessKeyId": "{Your Key}", 
    "secretAccessKey": "{Your Secret}", 
    "region": "us-west-2" 
}

Running the Sample Locally

First, install lambda-local here : https://www.npmjs.com/package/lambda-local

npm install -g lambda-local

After installation, you can use this command to test locally. be sure to edit the event-samples/event.js file first.

// Sample event data 
module.exports = {
    	subject: "hello",
		message: "hello from AWS",
		phonenumber: "+15551234567"
};

Now use lambda-local to trigger the function, and hopefully you will get a text message.

lambda-local -l index.js -h handler -e event-sample/event.js

Deployment

Automating Lambda deploys from the CLI will definitely save you time.

Here's a sample script that zips up the aws-sms-lambda folder and uploads it to AWS.

You will have to create the function in the AWS console first, then use this script.

rm aws-sms-lambda.zip 
7za a -r aws-sms-lambda.zip ../aws-sms-lambda/*
aws lambda update-function-code --function-name aws-sms-lambda --zip-file fileb://aws-sms-lambda.zip

License

This sample application is distributed under the Apache License, Version 2.0.

aws-sms-lambda's People

Watchers

James Cloos avatar Shuvo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.