Giter Site home page Giter Site logo

s3-sns-sqs-lambda-slack-go-sample's Introduction

s3-sns-sqs-lambda-slack-go-sample

Description

s3-sns-sqs-lambda-slack-go-sample is a sample implementation of a Fanout Pattern of a cloud design pattern

sequence

Production

prerequisites

You have to prepare credentials with proper policies.

And,

  • install aws-cli
  • install aws-sam-cli. Docker is also required. Follow the instruction here.
  • install direnv
  • install saw
    • you can watch CloudWatch logs on your terminal
  • set environment variables to .envrc.sample and remove .sample.
    • WEBHOOK_URL Incoming Webhook URL of Slack. You can get URL at this page.
    • CHANNEL where the Lambda③'ll post message in Slack
    • USER_NAME by whom the message is posted in Slack
    • ICON message sender's icon like :piggy:
    • FILE_BUCKET S3 bucket where you upload your file. It's S3 in sequence and hould be unique globally.
    • STACK_BUCKET is S3 bucket name for artifacts of SAM and should be unique globally.

deploy

$ dep ensure                       # to resolve dependency
$ aws s3 mb "s3://${STACK_BUCKET}" # for artifacts of SAM
$ make deploy

Now, you can check a behavior of this architecture by uploading file to S3.

$ saw groups
/aws/lambda/stack-s3-sns-sqs-lambda-slack-go-sa-WriteExtLambda-XXXXXXXXXXXX
/aws/lambda/stack-s3-sns-sqs-lambda-slack-WriteFileNameLambda-XXXXXXXXXXXX
/aws/lambda/stack-s3-sns-sqs-lambda-slack-go-sa-NotifierLambda-XXXXXXXXXXXX

$ saw watch /aws/lambda/stack-s3-sns-sqs-lambda-slack-go-sa-WriteExtLambda-XXXXXXXXXXXX &
$ saw watch /aws/lambda/stack-s3-sns-sqs-lambda-slack-WriteFileNameLambda-XXXXXXXXXXXX &
$ saw watch /aws/lambda/stack-s3-sns-sqs-lambda-slack-go-sa-NotifierLambda-XXXXXXXXXXXX &

# open another window
$ aws s3 cp ./README.md "s3://${FILE_BUCKET}"

delete

In this architecture, Lambdas execute long polling to SQS and it's billable. So you should delete your stack by executing the command below after trying deploy.

$ make delete

Articles (Japanese)

s3-sns-sqs-lambda-slack-go-sample's People

Watchers

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