File tree Expand file tree Collapse file tree 8 files changed +207
-70
lines changed Expand file tree Collapse file tree 8 files changed +207
-70
lines changed Original file line number Diff line number Diff line change 1
1
/target
2
+ packaged.yml
3
+ native-packaged.yml
4
+ * .zip
2
5
bootstrap
3
6
/classes
4
7
/checkouts
Original file line number Diff line number Diff line change @@ -2,9 +2,17 @@ SHELL := /bin/bash
2
2
GREEN ='\033[0;32m'
3
3
YELLOW ='\033[1;33m'
4
4
NC ='\033[0m'
5
- DEFAULT_NATIVE_PARAMETERS="ParameterKey=Runtime,ParameterValue =provided ParameterKey=CodeUri,ParameterValue=."
6
5
7
6
.PHONY : install-holy-lambda native-dry-run compile dry-run native-compile
7
+ BUCKET_NAME =holy-lambda--hello-lambda
8
+ STACK_NAME =holy-lambda--hello-lambda
9
+ APP_REGION =eu-central-1
10
+
11
+ make-bucket :
12
+ @aws s3 mb s3://$(BUCKET_NAME )
13
+
14
+ destroy-bucket :
15
+ @aws s3 rb s3://$(BUCKET_NAME ) --force --region $(APP_REGION )
8
16
9
17
install-holy-lambda :
10
18
@bash -c " cd ../../ && lein install"
@@ -17,8 +25,23 @@ dry-api:
17
25
18
26
native-compile :
19
27
@fnative " -jar target/hello-lambda.jar --report-unsupported-elements-at-runtime --no-fallback --enable-url-protocols=http,https --no-server -J-Xmx3G -J-Xms3G"
28
+ @cp -rf hello-lambda bootstrap
29
+ @zip latest bootstrap
20
30
21
31
native-dry-api :
22
- @rm -Rf bootstrap
23
- @mv hello-lambda bootstrap
24
- sam local start-api --parameter-overrides=' $(DEFAULT_NATIVE_PARAMETERS)'
32
+ @sam local start-api --template ./native-template.yml
33
+
34
+ pack :
35
+ @sam package --template-file ./template.yml --output-template-file packaged.yaml --s3-bucket $(BUCKET_NAME ) --s3-prefix " hello-lambda-latest"
36
+
37
+ deploy :
38
+ @sam deploy --template-file ./packaged.yaml --stack-name $(STACK_NAME ) --capabilities CAPABILITY_IAM --region $(APP_REGION )
39
+
40
+ native-pack :
41
+ @sam package --template-file ./native-template.yml --output-template-file native-packaged.yaml --s3-bucket $(BUCKET_NAME ) --s3-prefix " hello-lambda-latest"
42
+
43
+ native-deploy :
44
+ @sam deploy --template-file ./native-packaged.yaml --stack-name $(STACK_NAME ) --capabilities CAPABILITY_IAM --region $(APP_REGION )
45
+
46
+ native-destroy :
47
+ @aws cloudformation delete-stack --stack-name $(STACK_NAME ) --region $(APP_REGION )
Original file line number Diff line number Diff line change
1
+ AWSTemplateFormatVersion : ' 2010-09-09'
2
+ Transform : AWS::Serverless-2016-10-31
3
+ Description : ' Example basic lambda using `holy-lambda` micro library
4
+
5
+ '
6
+ Parameters :
7
+ Runtime :
8
+ Type : String
9
+ Default : provided
10
+ Timeout :
11
+ Type : Number
12
+ Default : 40
13
+ MemorySize :
14
+ Type : Number
15
+ Default : 2000
16
+ CodeUri :
17
+ Type : String
18
+ Default : latest.zip
19
+ Globals :
20
+ Function :
21
+ Runtime :
22
+ Ref : Runtime
23
+ Timeout :
24
+ Ref : Timeout
25
+ MemorySize :
26
+ Ref : MemorySize
27
+ CodeUri :
28
+ Ref : CodeUri
29
+ Resources :
30
+ GetOrderFunction :
31
+ Type : AWS::Serverless::Function
32
+ Properties :
33
+ Handler : hello-lambda.core.HelloLambda
34
+ FunctionName : HelloLambdaFunction
35
+ Events :
36
+ HelloLambda :
37
+ Type : Api
38
+ Properties :
39
+ Path : /
40
+ Method : get
41
+ CodeUri : s3://holy-lambda--hello-lambda/hello-lambda-latest/42c3700297f855bc99543ad80034ce5d
Original file line number Diff line number Diff line change
1
+ AWSTemplateFormatVersion : ' 2010-09-09'
2
+ Transform : AWS::Serverless-2016-10-31
3
+ Description : >
4
+ Example basic lambda using `holy-lambda` micro library
5
+
6
+ Parameters :
7
+ Runtime :
8
+ Type : String
9
+ Default : provided
10
+ Timeout :
11
+ Type : Number
12
+ Default : 40
13
+ MemorySize :
14
+ Type : Number
15
+ Default : 2000
16
+ CodeUri :
17
+ Type : String
18
+ Default : latest.zip
19
+
20
+ Globals :
21
+ Function :
22
+ Runtime : !Ref Runtime
23
+ Timeout : !Ref Timeout
24
+ MemorySize : !Ref MemorySize
25
+ CodeUri : !Ref CodeUri
26
+
27
+ Resources :
28
+ GetOrderFunction :
29
+ Type : AWS::Serverless::Function # More info about Function Resource: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction
30
+ Properties :
31
+ Handler : hello-lambda.core.HelloLambda
32
+ FunctionName : HelloLambdaFunction
33
+ Events :
34
+ HelloLambda :
35
+ Type : Api # More info about API Event Source: https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#api
36
+ Properties :
37
+ Path : /
38
+ Method : get
Original file line number Diff line number Diff line change
1
+ AWSTemplateFormatVersion : ' 2010-09-09'
2
+ Transform : AWS::Serverless-2016-10-31
3
+ Description : ' Example basic lambda using `holy-lambda` micro library
4
+
5
+ '
6
+ Parameters :
7
+ Runtime :
8
+ Type : String
9
+ Default : java8
10
+ Timeout :
11
+ Type : Number
12
+ Default : 40
13
+ MemorySize :
14
+ Type : Number
15
+ Default : 2000
16
+ CodeUri :
17
+ Type : String
18
+ Default : target/hello-lambda.jar
19
+ Globals :
20
+ Function :
21
+ Runtime :
22
+ Ref : Runtime
23
+ Timeout :
24
+ Ref : Timeout
25
+ MemorySize :
26
+ Ref : MemorySize
27
+ CodeUri :
28
+ Ref : CodeUri
29
+ Resources :
30
+ GetOrderFunction :
31
+ Type : AWS::Serverless::Function
32
+ Properties :
33
+ Handler : hello-lambda.core.HelloLambda
34
+ FunctionName : HelloLambdaFunction
35
+ Events :
36
+ HelloLambda :
37
+ Type : Api
38
+ Properties :
39
+ Path : /
40
+ Method : get
41
+ CodeUri : s3://holy-lambda--hello-lambda/hello-lambda-latest/353cd8a931c84b187ce9790e579c265b
Original file line number Diff line number Diff line change 6
6
(h/deflambda HelloLambda
7
7
[event context]
8
8
{:statusCode 200
9
- :body " Hello"
9
+ :body {:message " Hello"
10
+ " it's" " me"
11
+ :you " looking"
12
+ :for true }
10
13
:isBase64Encoded false
11
- :headers {" content-type" " text/html" }}
12
- )
14
+ :headers {" Content-Type" " application/json" }})
13
15
14
16
(h/gen-main [#'HelloLambda])
Original file line number Diff line number Diff line change @@ -8,10 +8,10 @@ Parameters:
8
8
Type : String
9
9
Default : java8
10
10
Timeout :
11
- Type : Integer
11
+ Type : Number
12
12
Default : 40
13
13
MemorySize :
14
- Type : Integer
14
+ Type : Number
15
15
Default : 2000
16
16
CodeUri :
17
17
Type : String
You can’t perform that action at this time.
0 commit comments