forked from ExamProCo/AWS-Examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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,6 @@ | ||
#!/usr/bin/env bash | ||
cd /workspace | ||
curl -L "https://github.com/aws/aws-sam-cli/releases/latest/download/aws-sam-cli-linux-x86_64.zip" -o "samcli.zip" | ||
unzip samcli.zip -d sam-installation | ||
sudo ./sam-installation/install | ||
cd $THEIA_WORKSPACE_ROOT |
This file contains 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,5 @@ | ||
# This file is auto generated by SAM CLI build command | ||
|
||
[function_build_definitions] | ||
|
||
[layer_build_definitions] |
This file contains 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 @@ | ||
AWSTemplateFormatVersion: '2010-09-09' | ||
Transform: AWS::Serverless-2016-10-31 | ||
Resources: | ||
InlineLambda: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
Runtime: python3.12 | ||
PackageType: Zip | ||
InlineCode: "def handler(event, context):\n message = 'Hello {} {}!'.format(event['first_name'],\ | ||
\ event['last_name']) \n print(\"Log this for me\")\n return { \n \ | ||
\ 'message' : message\n }" |
This file contains 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,11 @@ | ||
# Install SAM CLI | ||
|
||
```sh | ||
./bin/aws_sam_cli_install.sh | ||
``` | ||
|
||
# Install CFN Lint | ||
|
||
```sh | ||
brew install cfn-lint | ||
``` |
This file contains 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,19 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# we need the absolute path of samconfig.toml | ||
# because relative path was giving us trouble | ||
root_path=$(realpath .) | ||
template_path="${root_path}/template.yml" | ||
|
||
# sam build | ||
# =================== | ||
# https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-building.html | ||
# https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-build.html | ||
# ------------------- | ||
# This will prepare the artifact to be uploaded to S3 by generating: | ||
# .aws-sam/build/template.yml | ||
echo "== SAM build..." | ||
echo "using template: ${template_path}" | ||
sam build \ | ||
--template-file "${template_path}" |
This file contains 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,25 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# we need the absolute path because relative path was giving us trouble | ||
root_path=$(realpath .) | ||
#config_path="$(realpath ..)/python.toml" | ||
|
||
#if [ ! -f "$config_path" ]; then | ||
# echo "$config_path does not exist." | ||
# exit 1 | ||
#fi | ||
|
||
# sam deploy | ||
# =================== | ||
# https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-deploying.html | ||
# https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-deploy.html | ||
# ------------------- | ||
echo "== SAM deploy..." | ||
#echo "loading configuration: $config_path" | ||
|
||
sam deploy \ | ||
--template-file "./.aws-sam/build/template.yaml" \ | ||
--stack-name "inline-lamba-py" \ | ||
--capabilities "CAPABILITY_IAM" | ||
#--config-file "$config_path" \ |
This file contains 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,11 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
|
||
# we need the absolute path because relative path was giving us trouble | ||
root_path=$(realpath .) | ||
|
||
# cfn-lint | ||
# ------------------- | ||
# This will check our cloudformation template to ensure its valid format | ||
echo "== CFN linting..." | ||
cfn-lint "${root_path}/template.yml" |
This file contains 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,5 @@ | ||
def handle(event, context): | ||
message = 'Hello {} {}!'.format(event['first_name'], event['last_name']) | ||
return { | ||
'message' : message | ||
} |
This file contains 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 @@ | ||
AWSTemplateFormatVersion : '2010-09-09' | ||
Transform: AWS::Serverless-2016-10-31 | ||
Resources: | ||
# https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-resource-function.html | ||
InlineLambda: | ||
Type: AWS::Serverless::Function | ||
Properties: | ||
Handler: index.handler | ||
Runtime: python3.12 | ||
PackageType: Zip | ||
InlineCode: | | ||
def handler(event, context): | ||
message = 'Hello {} {}!'.format(event['first_name'], event['last_name']) | ||
print("Log this for me") | ||
return { | ||
'message' : message | ||
} |