Skip to content

Commit 29a42e7

Browse files
committed
use layers
1 parent 69e5a12 commit 29a42e7

File tree

7 files changed

+19
-3
lines changed

7 files changed

+19
-3
lines changed

sample-apps/blank/2-build-layer.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -eo pipefail
3+
mkdir -p lib/nodejs
4+
rm -rf lib/nodejs/node_modules
5+
npm install
6+
mv node_modules lib/nodejs/
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#!/bin/bash
22
set -eo pipefail
33
ARTIFACT_BUCKET=$(cat bucket-name.txt)
4-
cd function
5-
npm install --production
6-
cd ../
74
aws cloudformation package --template-file template.yml --s3-bucket $ARTIFACT_BUCKET --output-template-file out.yml
85
aws cloudformation deploy --template-file out.yml --stack-name blank --capabilities CAPABILITY_NAMED_IAM
File renamed without changes.
File renamed without changes.
-11.5 KB
Loading

sample-apps/blank/function/package.json renamed to sample-apps/blank/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
"devDependencies": {
66
"aws-sdk": "2.585.0"
77
},
8+
"dependencies": {
9+
"aws-xray-sdk-core": "1.1.2"
10+
},
811
"scripts": {
912
"start": "node app.js"
1013
}

sample-apps/blank/template.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,13 @@ Resources:
1616
- AWSLambdaReadOnlyAccess
1717
- AWSXrayWriteOnlyAccess
1818
Tracing: Active
19+
Layers:
20+
- !Ref libs
21+
libs:
22+
Type: AWS::Serverless::LayerVersion
23+
Properties:
24+
LayerName: blank-lib
25+
Description: Dependencies for the blank sample app.
26+
ContentUri: lib/.
27+
CompatibleRuntimes:
28+
- nodejs12.x

0 commit comments

Comments
 (0)