All Projects → AlisProject → Serverless Application

AlisProject / Serverless Application

🍤 ALIS Media - Serverless Application

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Serverless Application

Awesome Aws
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Stars: ✭ 9,895 (+18928.85%)
Mutual labels:  serverless, lambda, cloudformation
Dawson Cli
A serverless web framework for Node.js on AWS (CloudFormation, CloudFront, API Gateway, Lambda)
Stars: ✭ 721 (+1286.54%)
Mutual labels:  serverless, lambda, cloudformation
Lambstatus
[Maintenance mode] Serverless Status Page System
Stars: ✭ 1,323 (+2444.23%)
Mutual labels:  serverless, lambda, cloudformation
Serverless Domain Manager
Serverless plugin for managing custom domains with API Gateways.
Stars: ✭ 783 (+1405.77%)
Mutual labels:  serverless, lambda, cloudformation
Webiny Js
Enterprise open-source serverless CMS. Includes a headless CMS, page builder, form builder and file manager. Easy to customize and expand. Deploys to AWS.
Stars: ✭ 4,869 (+9263.46%)
Mutual labels:  serverless, lambda, spa
Aws Toolkit Vscode
AWS Toolkit for Visual Studio Code, an extension for working with AWS services including AWS Lambda.
Stars: ✭ 823 (+1482.69%)
Mutual labels:  serverless, lambda, cloudformation
Cloudmagick
CloudMagick is a serverless application which provides a dynamic image transformation like the small light module of apache2
Stars: ✭ 11 (-78.85%)
Mutual labels:  serverless, cloudformation
Aws Auto Terminate Idle Emr
AWS Auto Terminate Idle AWS EMR Clusters Framework is an AWS based solution using AWS CloudWatch and AWS Lambda using a Python script that is using Boto3 to terminate AWS EMR clusters that have been idle for a specified period of time.
Stars: ✭ 21 (-59.62%)
Mutual labels:  serverless, cloudformation
Workshop Donkeytracker
Workshop to build a serverless tracking application for your mobile device with an AWS backend
Stars: ✭ 27 (-48.08%)
Mutual labels:  serverless, lambda
Shorty.sls
Serverless URL shortener written in Python3 using the serverless framework
Stars: ✭ 35 (-32.69%)
Mutual labels:  serverless, cloudformation
Epsagon Go
Automated tracing library for Go 1.x ⚡️
Stars: ✭ 24 (-53.85%)
Mutual labels:  serverless, lambda
Serverless Plugin Stackstorm
Plugin for serverless framework to run ready to use actions from StackStorm Exchange as AWS Lambda.
Stars: ✭ 28 (-46.15%)
Mutual labels:  serverless, lambda
Gcf.cr
gcf.cr provides serverless execution and deployment of crystal language code in Google Cloud Functions
Stars: ✭ 51 (-1.92%)
Mutual labels:  serverless, lambda
Serverless Application Model
AWS Serverless Application Model (SAM) is an open-source framework for building serverless applications
Stars: ✭ 8,305 (+15871.15%)
Mutual labels:  serverless, lambda
Lamb
monitoring tool for better visibility when developing AWS Lambda functions
Stars: ✭ 11 (-78.85%)
Mutual labels:  serverless, lambda
Serverless
This is intended to be a repo containing all of the official AWS Serverless architecture patterns built with CDK for developers to use. All patterns come in Typescript and Python with the exported CloudFormation also included.
Stars: ✭ 1,048 (+1915.38%)
Mutual labels:  serverless, cloudformation
Serverless Contactform
A serverless app to serve the contactform
Stars: ✭ 11 (-78.85%)
Mutual labels:  serverless, lambda
Serverless Geoip
Use MaxMind GeoLite2 database with AWS Lambda
Stars: ✭ 33 (-36.54%)
Mutual labels:  serverless, lambda
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (-1.92%)
Mutual labels:  serverless, lambda
Terraform Nextjs Plugin
A plugin to generate terraform configuration for Nextjs 8 and 9
Stars: ✭ 41 (-21.15%)
Mutual labels:  serverless, lambda

Serverless Application

CircleCI

This is a serverless application using AWS SAM.

Prerequisite

  • pyenv
  • aws-cli
  • docker
  • direnv

Installation

git clone https://github.com/AlisProject/serverless-application.git
cd serverless-application
pyenv install

# libraries
python -m venv venv
. venv/bin/activate
pip install -r requirements.txt
pip install -r requirements_test.txt

Environment valuables

# Create .envrc to suit your environment.
cp -pr .envrc.sample .envrc
vi .envrc # edit

# allow
direnv allow

Test

Set up dynamoDB local

Download and unzip the dynamoDB local zip in any directory

For example

$ curl -O https://s3-ap-northeast-1.amazonaws.com/dynamodb-local-tokyo/dynamodb_local_latest.tar.gz
$ tar xf ./dynamodb_local_latest.tar.gz
$ rm ./dynamodb_local_latest.tar.gz

Execute Test

# Start dynamoDB local
java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

# lunch docker for localstack(for MAC OS)
TMPDIR=/private$TMPDIR docker-compose up -d

# lunch docker for elasticsearch
docker run -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:6.2.0

# exec
python exec_test.py

# single directory
python exec_test.py --target /handlers

# ignore specific directory
python exec_test.py --ignore /handlers

Set SSM valuables

You have to specify SSM valuables as can as possible.

Deployment via AWS Cloud Formation

Create S3 bucket

aws s3api create-bucket --bucket ${ALIS_APP_ID}-serverless-deploy-bucket \
  --create-bucket-configuration LocationConstraint=$AWS_DEFAULT_REGION

Packaging and deployment

Packaging

Pack all resources.

./packaging.sh

You can Pack specify resource if you want.

python make_deploy_zip.py --target 'src/handlers/labo/n/random/handler.py'

DynamoDB

./deploy.sh database

# Show all tables.
aws dynamodb list-tables |grep ${ALIS_APP_ID}database |sort |tr -d ' ",'

And add all of generated table names to SSM.

Master Data

Add master data to DynamoDB.

./add_master_data.sh

Cognito

./deploy.sh cognito

Specify generated Cognito User Pool ARN to SSM.

Lambda & API Gateway

You have to add SNS authentication params to SSM.

./deploy.sh function && ./deploy.sh function02 && ./deploy.sh api

ElasticSearch

./deploy.sh elasticsearch

# show ElasticSearch Endpoint
aws es describe-elasticsearch-domain --domain-name ${ALIS_APP_ID}elasticsearch | jq '.DomainStatus.Endpoint'

# Notice: After this, Elasticsearch is expensive if it is the default setting, so it may be better to reconfigure its performance settings.

And add ElasticSearch Endpoint to SSM.

Add Your local IP to ES access policy.

python elasticsearch-setup.py $(curl https://checkip.amazonaws.com/)

Permissions

You have to add RestApiArn, ApiLambdaRole and ElasticSearchEndpoint to SSM.

./deploy.sh permission 

You have to update Cognito pre authentication trigger.

# Get function name.
aws lambda list-functions | jq -r --arg FUNCTION \
  "${ALIS_APP_ID}api-CognitoTriggerPreAuthentication" '.Functions[] | select(.FunctionName | test($FUNCTION)) | .FunctionName'
  
# Add it to Cognito via Management console

FYI:

Lambda & API Gateway are bunch of CloudFormation stacks. You can use the script from next time.

./deploy_api.sh

Fix API settings via a script

# Show generated Rest API ID
aws apigateway  get-rest-apis | jq '.items[] | if .name == "'${ALIS_APP_ID}'api" then .id else empty end'

# Set SERVERLESS_REST_API_ID to .envrc
direnv edit

# Show generated Rest API with OAuth ID
aws apigateway  get-rest-apis | jq '.items[] | if .name == "'${ALIS_APP_ID}'api-with-oauth" then .id else empty end'

# Set SERVERLESS_REST_API_WITH_OAUTH_ID to .envrc
direnv edit

## Load envs
direnv allow

./fix_api.sh

Single API Lambda Function

You can deploy single function on api-template.yaml with using deploy_api_function.py script. Following example is that ArticlesRecent function is deployed.

python make_deploy_zip.py && ./deploy_api_function.py ArticlesRecent

ALIS Laboratory resources

Experimental features.

npm ci
npx deploy

CloudWatch Alarm

For production and staging, you should enable alarms.

./deploy.sh apialarms

Cloudfront

For development only. You can create Cloudfront and Route53 resources via Cloudformation.

# Show API Gateway IDs
aws apigateway  get-rest-apis | jq -r '.items[] | select( .name | contains("'${ALIS_APP_ID}'")) | .name + " : " + .id'

# Show ACM
aws acm list-certificates --region us-east-1

## Add it to env
direnv edit

# Deployment
./deploy_cloudfront.sh

Resource Groups

You can create Resource Groups if you want.

./create_resource_groups.sh
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].