-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
61 lines (53 loc) · 1.83 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
.PHONY: build_local build_release build_lambda_release deploy_cli add_permissions remove_version remove_version dev clean
build_local:
@echo "Building from source..."
@cargo build --release
@echo "Build completed"
build_release:
@echo "Building from source..."
@cargo build --target x86_64-unknown-linux-gnu --release
@echo "Build completed"
build_lambda_release:
@echo "Building from source..."
@cargo lambda build --extension --release
@rm -rf ./out
@cp -R target/lambda/extensions ./out
@cp ./scripts/retrieve-secrets ./out
@chmod +x ./out/env-vars-from-secrets-manager
@chmod +x ./out/retrieve-secrets
@cd out && zip -r ../out.zip *
@echo "Build completed"
deploy_cli:
@echo "Deploying..."
@aws lambda publish-layer-version \
--layer-name env-vars-from-secrets-manager \
--description "Layer for read secrets manager and store them in env variables" \
--zip-file fileb://out.zip \
--compatible-architectures x86_64 \
--compatible-runtimes provided.al2 provided.al2023 nodejs18.x nodejs20.x python3.10 python3.11 python3.12 \
> response.json
@echo "Deploy completed"
add_permissions:
@echo "Adding permissions..."
$(eval EXTENSION_VERSION=$(shell jq -r '.Version' response.json))
@aws lambda add-layer-version-permission \
--layer-name env-vars-from-secrets-manager \
--statement-id AWSLambdaExecute \
--action lambda:GetLayerVersion \
--principal "*" \
--organization-id "$(ORG_ID)" \
--version-number "$(EXTENSION_VERSION)"
@echo "Permissions added"
remove_version:
@echo "Removing version..."
@aws lambda delete-layer-version \
--layer-name env-vars-from-secrets-manager \
--version-number "$(VERSION)"
@echo "Version removed"
dev:
@echo "Starting your app using dev...."
@cargo run -- --secrets $(SECRETS) --path $(PATH) --prefix secret
clean:
@echo "Cleaning..."
@cargo clean
@echo "Clean completed"