Skip to content

scientist-softserv/space_stone

Repository files navigation

SpaceStone

Lamby: Simple Rails & AWS Lambda Integration using Rack.

Welcome to your new Lambda project! This was created by Custom Ink's demo AWS SAM Cookiecutter project template for Ruby. See the full article here on Custom Ink's technology blog.

Lamby: Simple Rails & AWS Lambda Integration using Rack.

Setup

Follow these steps to get started:

$ ./bin/bootstrap
$ ./bin/setup
$ ./bin/test

To deploy your Lambda do the following. This command assumes you have the AWS CLI configured with credentials located within your ~/.aws directory.

$ STAGE_ENV=production ./bin/deploy

To test it works within the AWS Console, you can either send it a test event (Services -> Lambda -> MYLAMBDA -> Test) or if you opted for a basic HTTP API, you can see your Invoke URL by navigating to (Services -> API Gateway -> MYAPI -> Invoke URL) page.

CI/CD with GitHub Actions

In order for GitHub to deploy your Lambda, it will need permission to do so. An admin should do the first deploy, however afterward GitHub Actions can do updates for you.

Create a Deploy User

In the AWS Console -> IAM -> Users -> Add User.

  • Check "Programmatic access" option.
  • Select "Attach existing policies directly" option.
  • Select "AWSLambdaFullAccess" policy.
  • Copy the "Access key ID" and "Secret access key"

AWS Credentials

In your GitHub repo page. Click Settings -> Secrets -> Add a new secret

  • Name AWS_ACCESS_KEY_ID value (from step above)
  • Name AWS_SECRET_ACCESS_KEY value (from step above)