GithubHelp home page GithubHelp logo

faizanbashir / python-ses-dynamodb-contactform Goto Github PK

View Code? Open in Web Editor NEW
35.0 4.0 16.0 138 KB

Serverless Framework SES and DynamoDB Contact Form

License: MIT License

Python 31.57% CSS 14.84% HTML 36.19% JavaScript 17.40%
aws aws-lambda aws-ses aws-dynamodb python serverless serverless-framework

python-ses-dynamodb-contactform's Introduction

Python SES DynamoDB Contact Form

serverless license

AWS SES DYNAMODB tutorial using Serverless Framework written in Python

Application Architecture

Serverless Application Architecture

Serverless Framework Setup

Command Description
npm install -g serverless Install Serverless CLI
npm install Install Serverless dependencies
npm install serverless-domain-manager --save-dev Install plugin to use custom domains
Set up an AWS account with admin permissions Documentation

How to Deploy

$ git clone https://github.com/faizanbashir/python-ses-dynamodb-contactform.git
$ cd python-ses-dynamodb-contactform
$ npm install
$ sls deploy -v

Creating Route53 records for custom domain

$ sls create_domain

Service Endpoints

The service exposes 2 REST API endpoints:

Endpoint Description Parameters
POST /sendMail Submit the data from contact form {"firstname": "John Doe", "email": "[email protected]", "message": "Hi there"}
GET /list Retrieves all the contact form submissions -

Invocation

curl --header "Content-Type: application/json" \
    --request POST \
    --data '{"fullname": "John Doe", "email": "[email protected]", "message": "Hi there"}'\
    <host>/sendMail -H 'x-api-key: <API_KEY>'
curl <host>/list -H 'x-api-key: <API_KEY>'

sls or serverless CLI Usage

deploy function command

Deploy only one function:

sls deploy function -f <function-name> -v

invoke command

Run a specific function with a provided input and get the logs

sls invoke -f <function-name> -p event.json -l

Run a specific function without input and get the logs

sls invoke -f <function-name> -l

logs command

Tail the logs of a function:

sls logs -f <function-name> -t

info command

Information about the service (stage, region, endpoints, functions):

sls info

help command

Just use it on anything:

sls  help

or

sls <command> --help

python-ses-dynamodb-contactform's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-ses-dynamodb-contactform's Issues

serverless.yml update

Had to add in serverless.yml file after runtime: python2.7 the
environment:
DYNAMODB_TABLE: ${self:service}-${opt:stage, self:provider.stage}
to deploy it sucessfully

Add ReCAPTCHA support?

It would be great to have Google ReCAPTCHA support added to this form. I can't find any examples of a Lambda Python implementation.

IamRoleLambdaExecution Fails

The full message is

An error occurred: IamRoleLambdaExecution - 1 validation error detected: Value 'python-sesdynamodb-contactform-development-eu-central-1-lambdaRole' at 'roleName' failed to satisfy constraint: Member must have length less than or equal to 64

where is the Rolename generated?

Ajax hangs on "Sending Mail..." when Lambda error

My lambda instance returned: {errorMessage: "Syntax error in module 'handler'"} but the javascript code didn't report it as an error to the user, it just hung on "Sending Mail...". It would be nice for the javascript to handle all types of errors and report them to the user visually.

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.