Giter Site home page Giter Site logo

s3-unzipper-go's Introduction

s3-unzipper-go

Description

unzip uploaded zip file to another S3 bucket via AWS Lambda in Go

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.
    • ZIPPED_ARTIFACT_BUCKET is S3 bucket name. It's S3① in the sequence and should be unique globally.
    • UNZIPPED_ARTIFACT_BUCKET is S3 bucket name. It's S3② in the sequence and should 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

behavior

Deploy is required before checking behavior.

$ saw groups
/aws/lambda/stack-unzipper-lambda-Unzipper-XXXXXXXXXXXX

$ saw watch /aws/lambda/stack-unzipper-lambda-Unzipper-XXXXXXXXXXXX

# open another window
$ aws s3 cp testdata/sample.zip "s3://${ZIPPED_ARTIFACT_BUCKET}"

Local

You can test a behavior on test (main_test.go).

In the test, setup prepares 2 real S3 buckets because SAM local doesn't support local emulation of an S3.

One is for an even source that triggers an AWS Lambda and another is for a destination of unzipped artifacts.

Because S3 buckets created at the test are deleted on every test execution, idempotency is guaranteed.

Articles (Japanese)

s3-unzipper-go's People

Contributors

toshi0607 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.