Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Add deno-hello-world SAR application
Browse files Browse the repository at this point in the history
Set RetentionPolicy=Retain for layer.
  • Loading branch information
hayd committed Jan 18, 2020
1 parent 977a1f3 commit a6cf6cd
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 11 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,22 @@ jobs:
export DEBIAN_FRONTEND=noninteractive
sudo apt -qq update &> /dev/null
sudo apt -qq install -y awscli python3-setuptools &> /dev/null
aws s3 cp --quiet deno-lambda-layer.zip s3://$DENO_LAMBDA_BUCKET/deno-lambda-layer_$DENO_LAMBDA_VERSION.zip --acl public-read
cd sar
sed -i -e s/DENO_LAMBDA_BUCKET/$DENO_LAMBDA_BUCKET/g template.yml
sed -i -e s/DENO_LAMBDA_VERSION/$DENO_LAMBDA_VERSION/g template.yml
pip3 -q install -U --force pip
export PATH=/home/runner/.local/bin:$PATH
export SAM_CLI_TELEMETRY=1
python3 -m pip -q install --user aws-sam-cli
aws s3 cp --quiet deno-lambda-layer.zip s3://$DENO_LAMBDA_BUCKET/deno-lambda-layer_$DENO_LAMBDA_VERSION.zip --acl public-read
aws s3 cp --quiet deno-lambda-example.zip s3://$DENO_LAMBDA_BUCKET/deno-lambda-example_$DENO_LAMBDA_VERSION.zip --acl public-read
echo ---
cd SAR
sed -i -e s/DENO_LAMBDA_BUCKET/$DENO_LAMBDA_BUCKET/g template.yml
sed -i -e s/DENO_LAMBDA_VERSION/$DENO_LAMBDA_VERSION/g template.yml
cat template.yml
sam publish --region us-east-1
echo ---
cd blueprint
sed -i -e s/DENO_LAMBDA_BUCKET/$DENO_LAMBDA_BUCKET/g template.yml
sed -i -e s/DENO_LAMBDA_VERSION/$DENO_LAMBDA_VERSION/g template.yml
cat template.yml
sam publish --region us-east-1
echo ---
19 changes: 19 additions & 0 deletions SAR/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,25 @@

A custom runtime for [deno](https://github.com/denoland/deno) applications.

```ts
import {
APIGatewayProxyEvent,
APIGatewayProxyResult,
Context
} from "https://deno.land/x/lambda/mod.ts";

export async function handler(
event: APIGatewayProxyEvent,
context: Context
): Promise<APIGatewayProxyResult> {
return {
statusCode: 200,
headers: { "content-type": "text/html;charset=utf8" },
body: `Hello World! Sent from deno ${Deno.version.deno} 🦕`
};
}
```

See the [README on github](https://github.com/hayd/deno-lambda) for more information.

---
Expand Down
34 changes: 34 additions & 0 deletions SAR/blueprint/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Deno Hello World

An example [deno](https://github.com/denoland/deno) lambda function on top of the
[deno SAR application](https://serverlessrepo.aws.amazon.com/applications/arn:aws:serverlessrepo:us-east-1:390065572566:applications~deno).

```ts
import {
APIGatewayProxyEvent,
APIGatewayProxyResult,
Context
} from "https://deno.land/x/lambda/mod.ts";

export async function handler(
event: APIGatewayProxyEvent,
context: Context
): Promise<APIGatewayProxyResult> {
return {
statusCode: 200,
headers: { "content-type": "text/html;charset=utf8" },
body: `Hello World! Sent from deno ${Deno.version.deno} 🦕`
};
}
```

See the [README on github](https://github.com/hayd/deno-lambda) for more information.

---

Made with ❤️ by Andy Hayden.
Available on the [AWS Serverless Application Repository](https://aws.amazon.com/serverless).

## License

MIT
47 changes: 47 additions & 0 deletions SAR/blueprint/template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
Deno example function blueprint for AWS Lambda
Resources:
Deno:
Type: AWS::Serverless::Application
Properties:
Location:
ApplicationId: arn:aws:serverlessrepo:us-east-1:390065572566:applications/deno
SemanticVersion: DENO_LAMBDA_VERSION

DenoHelloWorldFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri:
Bucket: DENO_LAMBDA_BUCKET
Key: deno-lambda-example_DENO_LAMBDA_VERSION.zip
MemorySize: 128
Handler: hello.handler
Runtime: provided
Layers:
- !GetAtt Deno.Outputs.LayerArn
Events:
ApiEvent:
Type: HttpApi

Outputs:
LayerArn:
Value: !GetAtt Deno.Outputs.LayerArn

Metadata:
AWS::ServerlessRepo::Application:
Name: deno-hello-world
Description: |
Deno example function blueprint for AWS Lambda
Author: Andy Hayden
SpdxLicenseId: MIT
Labels:
- deno
- lambda
- typescript
- blueprint
HomePageUrl: https://github.com/hayd/deno-lambda
SemanticVersion: DENO_LAMBDA_VERSION
SourceCodeUrl: https://github.com/hayd/deno-lambda/releases/tag/DENO_LAMBDA_VERSION
16 changes: 9 additions & 7 deletions SAR/template.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: >
A deno runtime for AWS Lambda
Deno runtime for AWS Lambda
Resources:
DenoLambdaLayer:
Type: AWS::Lambda::LayerVersion
Type: AWS::Serverless::LayerVersion
Properties:
LayerName: deno
Description: deno-lambda DENO_LAMBDA_VERSION
Content:
S3Bucket: DENO_LAMBDA_BUCKET
S3Key: deno-lambda-layer_DENO_LAMBDA_VERSION.zip
ContentUri:
Bucket: DENO_LAMBDA_BUCKET
Key: deno-lambda-layer_DENO_LAMBDA_VERSION.zip
Description: deno runtime (deno-lambda@DENO_LAMBDA_VERSION)
LicenseInfo: MIT
RetentionPolicy: Retain

Outputs:
LayerArn:
Expand All @@ -21,7 +23,7 @@ Metadata:
AWS::ServerlessRepo::Application:
Name: deno
Description: |
A deno runtime for AWS Lambda
Deno runtime for AWS Lambda
Author: Andy Hayden
SpdxLicenseId: MIT
Labels:
Expand Down

0 comments on commit a6cf6cd

Please sign in to comment.