-
Notifications
You must be signed in to change notification settings - Fork 21
Added possibility to deploy sample example with terraform #37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
51783f9
Added possibility to deploy sample example with terraform
1756406
Removed unnecessary region, renamed policy file
b3f1bc3
Silent command with token, remove -s flag from readme
d9a1d06
Moved policices to terraform folder
9c40758
Moved deploy script to deployment/awslocal folder
d827827
Changed deploy.sh script
e7804cf
Added usage and build targets to Makefile, updated readme and python …
dab31f4
Removed LOCAL_RUN env variable
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
LOCALSTACK_AUTH_TOKEN=YOUR_TOKEN | ||
AWS_DEFAULT_REGION=us-east-1 | ||
# LOCAL_RUN=false # Default is true | ||
k-a-il marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
export AWS_DEFAULT_REGION=us-east-1 | ||
export AWS_ACCESS_KEY_ID ?= test | ||
export AWS_SECRET_ACCESS_KEY ?= test | ||
export LOCAL_RUN ?= true | ||
SHELL := /bin/bash | ||
|
||
include .env | ||
|
||
build: | ||
bin/build_lambdas.sh; | ||
|
||
awslocal-setup: | ||
bin/deploy.sh | ||
|
||
terraform-setup: | ||
$(MAKE) build | ||
cd deployment/terraform; \ | ||
tflocal init; \ | ||
echo "Deploying Terraform configuration 🚀"; \ | ||
tflocal apply --auto-approve -var="local_run=${LOCAL_RUN}"; \ | ||
echo "Paste the function URLs above to the WebApp 🎉"; | ||
|
||
terraform-destroy: | ||
cd deployment/terraform; \ | ||
tflocal destroy --auto-approve; | ||
|
||
start: | ||
LOCALSTACK_AUTH_TOKEN=$(LOCALSTACK_AUTH_TOKEN) localstack start -d | ||
|
||
stop: | ||
@echo | ||
localstack stop | ||
|
||
.PHONY: build awslocal-setup terraform-setup terraform-destroy start stop | ||
k-a-il marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
|
||
(cd lambdas/presign; rm -f lambda.zip; zip lambda.zip handler.py) | ||
|
||
(cd lambdas/list; rm -f lambda.zip; zip lambda.zip handler.py) | ||
|
||
os=$(uname -s) | ||
if [ "$os" == "Darwin" ]; then | ||
( | ||
cd lambdas/resize | ||
rm -rf libs lambda.zip | ||
docker run --platform linux/x86_64 --rm -v "$PWD":/var/task "public.ecr.aws/sam/build-python3.11" /bin/sh -c "pip3 install -r requirements.txt -t libs; exit" | ||
|
||
cd libs && zip -r ../lambda.zip . && cd .. | ||
zip lambda.zip handler.py | ||
rm -rf libs | ||
) | ||
else | ||
( | ||
cd lambdas/resize | ||
rm -rf package lambda.zip | ||
mkdir package | ||
pip3 install -r requirements.txt --platform manylinux2014_x86_64 --only-binary=:all: -t package | ||
zip lambda.zip handler.py | ||
cd package | ||
zip -r ../lambda.zip *; | ||
) | ||
fi |
k-a-il marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
k-a-il marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
} | ||
} | ||
] | ||
} | ||
k-a-il marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"ssm:GetParameters" | ||
], | ||
"Resource": [ | ||
"arn:aws:ssm:::parameter/localstack-thumbnail-app/*" | ||
] | ||
} | ||
] | ||
} |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:ListBucket", | ||
"s3:GetObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::${images_bucket}", | ||
"arn:aws:s3:::${images_bucket}/*", | ||
"arn:aws:s3:::${images_resized_bucket}", | ||
"arn:aws:s3:::${images_resized_bucket}/*" | ||
] | ||
} | ||
] | ||
} |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:ListBucket", | ||
"s3:GetObject", | ||
"s3:PutObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::${images_bucket}", | ||
"arn:aws:s3:::${images_bucket}/*" | ||
] | ||
} | ||
] | ||
} |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Action": [ | ||
"s3:ListBucket", | ||
"s3:GetObject", | ||
"s3:PutObject" | ||
], | ||
"Resource": [ | ||
"arn:aws:s3:::${images_resized_bucket}", | ||
"arn:aws:s3:::${images_resized_bucket}/*" | ||
] | ||
} | ||
] | ||
} |
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Action": [ | ||
"sns:Publish" | ||
], | ||
"Effect": "Allow", | ||
"Resource": "${failure_notifications_topic_arn}" | ||
}, | ||
{ | ||
"Action": "lambda:InvokeFunction", | ||
"Effect": "Allow", | ||
"Resource": "${resize_lambda_arn}" | ||
} | ||
] | ||
} |
alexrashed marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Effect": "Allow", | ||
"Principal": { | ||
"AWS": "${cdn_identity_arn}" | ||
}, | ||
"Action": "s3:GetObject", | ||
"Resource": "${website_bucket_arn}/*" | ||
} | ||
] | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.