Skip to content

Instantly share code, notes, and snippets.

@bushong1
Last active October 21, 2020 13:50
Show Gist options
  • Save bushong1/d2ca9cee23ac42201d87fbbc3a0edcc4 to your computer and use it in GitHub Desktop.
Save bushong1/d2ca9cee23ac42201d87fbbc3a0edcc4 to your computer and use it in GitHub Desktop.
Serverless Hello Bash
hello () {
set -e
echo "{\"statusCode\": 200, \"body\": \"Hello, from Bash\"}" >&2
}
require 'json'
def hello(event:, context:)
{
statusCode: 200,
body: {
message: 'Go Serverless v1.0! Your function executed successfully!',
input: event
}.to_json
}
end
def world(event:, context:)
{
statusCode: 200,
body: {
message: 'Go, World!'
}.to_json
}
end
frameworkVersion: '1'
service: charles-bifrost-test-sls
enableLocalInstallationFallback: true
provider:
name: aws
runtime: ruby2.7
stage: ${opt:stage, 'mint'} # Set the default stage used. Default is mint
region: ${opt:region, 'us-east-1'}
apiGateway:
restApiId: ${ssm:/${self:provider.stage}/katana/apigw_id}
restApiRootResourceId: ${ssm:/${self:provider.stage}/katana/apigw_root_resource_id}
vpc:
subnetIds: ${ssm:/${self:provider.stage}/network/private_subnet_ids}
role: ${ssm:/${self:provider.stage}/katana/lambda_role_arn}
environment: # Service-wide environment variables
ENVIRONMENT: ${self:provider.stage}
functions:
hello-ruby:
handler: handler-ruby.hello
runtime: ruby2.7
events:
- http: "GET hello-ruby"
hello-bash:
handler: handler-bash.hello
runtime: provided
layers:
- arn:aws:lambda:${self:provider.region}:744348701589:layer:bash:8
events:
- http: "ANY hello-bash"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment