Last active
October 21, 2020 13:50
-
-
Save bushong1/d2ca9cee23ac42201d87fbbc3a0edcc4 to your computer and use it in GitHub Desktop.
Serverless Hello Bash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello () { | |
set -e | |
echo "{\"statusCode\": 200, \"body\": \"Hello, from Bash\"}" >&2 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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