Giter Site home page Giter Site logo

hncuong1978 / aws-lambda-static-page Goto Github PK

View Code? Open in Web Editor NEW

This project forked from softwarebrothers/aws-lambda-static-page

0.0 1.0 0.0 46 KB

AWS Lambda - single, static page generator using PUG and SCSS

License: MIT License

JavaScript 65.58% CSS 25.43% HTML 8.99%

aws-lambda-static-page's Introduction

AWS Lambda + PUG + SCSS

This is a Boilerplate project deployable on AWS Lambda. It renders a simple HTML page using PUG templates and SCSS/SASS preprocessors.

All styles are embedded into one single HTML file. This makes them easy to deploy and share with others.

Applications for Business Intelligence processes

The most obvious application for this way of rendering files is to compute and print various reports for (business intelligence)[https://en.wikipedia.org/wiki/Business_intelligence]: sales, production. Those reports can be easily shared among all team members.

Running it

npm install
npm bin/render.js > out.html

Tests

To run automated tests simply run:

npm test

Deployment on AWS Lambda

If you work in an OSX environment, before deployment, you have to install npm packages using docker. This is due to the fact, that the node-sass package has to be build on the same environment as environemnt on which it will be run.

docker run --name node_bash --rm -i -t -v "$PWD":/usr/src/myapp -w /usr/src/myapp node:8.10 npm install

To deploy on aws lambda you have to use AWS-CLI:

zip -r lambda.zip ./*
aws lambda update-function-code --function-name FUNCTION_NAME --zip-file fileb://lambda.zip
rm lambda.zip

Make sure your aws user has correct rights. Here is an IAM policy which you can use:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "lambda:UpdateFunctionCode",
                "lambda:UpdateFunctionConfiguration", 
                "lambda:InvokeFunction",
                "lambda:GetFunction"
            ],
            "Resource": ["ARN_ADDRESS_OF_YOUR_LAMBDA_FUNCTION"]
        }
    ]
}

To test uploaded function run:

aws lambda invoke --function-name FUNCTION_NAME out.html
cat out.html

License

asw-lambda-statc-page is Copyright © 2018 SoftwareBrothers.co. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About SoftwareBrothers.co

We are a software company who provides web and mobile development and UX/UI services, friendly team that helps clients from all over the world to transform their businesses and create astonishing products.

  • We are available to hire.
  • If you want to work for us - checkout the career page.

aws-lambda-static-page's People

Contributors

wojtek-krysiak avatar

Watchers

James Cloos 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.