Skip to content
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

docs(examples): update aws lambda tooling and iam role names #1224

Merged
merged 4 commits into from
Dec 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/aws_lambda/aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ def handler(event, context):
# export SLACK_BOT_TOKEN=xoxb-***
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zimeg quick question: our internal report mentioned the necessity to rename this file. when you did testing for this change, was it unnecessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seratch Thanks for checking on this! I noticed that updating the role used by deploy.sh was enough to resolve errors, but I will check this once more 🔍 ✨


# rm -rf vendor && cp -pr ../../src/* vendor/
# pip install python-lambda
# pip install git+https://github.com/nficano/python-lambda
# lambda deploy --config-file aws_lambda_config.yaml --requirements requirements.txt
9 changes: 4 additions & 5 deletions examples/aws_lambda/aws_lambda_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ function_name: bolt_py_function
handler: aws_lambda.handler
description: My first lambda function
runtime: python3.8
# role: lambda_basic_execution
role: bolt_python_lambda_invocation

# S3 upload requires appropriate role with s3:PutObject permission
# (ex. basic_s3_upload), a destination bucket, and the key prefix
Expand All @@ -20,12 +20,11 @@ aws_secret_access_key:
# timeout: 15
# memory_size: 512
# concurrency: 500
#

# Experimental Environment variables
# Lambda environment variables
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From what I can tell, these are no longer an experimental feature! 🎉

https://github.com/nficano/python-lambda?tab=readme-ov-file#environment-variables

environment_variables:
SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN}
SLACK_SIGNING_SECRET: ${SLACK_SIGNING_SECRET}
SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN}
SLACK_SIGNING_SECRET: ${SLACK_SIGNING_SECRET}

# If `tags` is uncommented then tags will be set at creation or update
# time. During an update all other tags will be removed except the tags
Expand Down
2 changes: 1 addition & 1 deletion examples/aws_lambda/aws_lambda_oauth.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ def handler(event, context):
# - AWSLambdaRole

# rm -rf latest_slack_bolt && cp -pr ../../src latest_slack_bolt
# pip install python-lambda
# pip install git+https://github.com/nficano/python-lambda
# lambda deploy --config-file aws_lambda_oauth_config.yaml --requirements requirements_oauth.txt
17 changes: 7 additions & 10 deletions examples/aws_lambda/aws_lambda_oauth_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ function_name: bolt_py_oauth_function
handler: aws_lambda_oauth.handler
description: My first lambda function
runtime: python3.8
# role: lambda_basic_execution
role: bolt_python_s3_storage

# S3 upload requires appropriate role with s3:PutObject permission
Expand All @@ -21,17 +20,15 @@ aws_secret_access_key:
# timeout: 15
# memory_size: 512
# concurrency: 500
#

# Experimental Environment variables
# Lambda environment variables
environment_variables:
SLACK_SIGNING_SECRET: ${SLACK_SIGNING_SECRET}
SLACK_CLIENT_ID: ${SLACK_CLIENT_ID}
SLACK_CLIENT_SECRET: ${SLACK_CLIENT_SECRET}
SLACK_SCOPES: ${SLACK_SCOPES}
SLACK_INSTALLATION_S3_BUCKET_NAME: ${SLACK_INSTALLATION_S3_BUCKET_NAME}
SLACK_STATE_S3_BUCKET_NAME: ${SLACK_STATE_S3_BUCKET_NAME}

SLACK_SIGNING_SECRET: ${SLACK_SIGNING_SECRET}
SLACK_CLIENT_ID: ${SLACK_CLIENT_ID}
SLACK_CLIENT_SECRET: ${SLACK_CLIENT_SECRET}
SLACK_SCOPES: ${SLACK_SCOPES}
SLACK_INSTALLATION_S3_BUCKET_NAME: ${SLACK_INSTALLATION_S3_BUCKET_NAME}
SLACK_STATE_S3_BUCKET_NAME: ${SLACK_STATE_S3_BUCKET_NAME}

# If `tags` is uncommented then tags will be set at creation or update
# time. During an update all other tags will be removed except the tags
Expand Down
4 changes: 2 additions & 2 deletions examples/aws_lambda/deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
rm -rf vendor && mkdir -p vendor/slack_bolt && cp -pr ../../slack_bolt/* vendor/slack_bolt/
pip install python-lambda -U
pip install git+https://github.com/nficano/python-lambda
lambda deploy \
--config-file aws_lambda_config.yaml \
--requirements requirements.txt
--requirements requirements.txt
2 changes: 1 addition & 1 deletion examples/aws_lambda/deploy_lazy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
rm -rf slack_bolt && mkdir slack_bolt && cp -pr ../../slack_bolt/* slack_bolt/
pip install python-lambda -U
pip install git+https://github.com/nficano/python-lambda
lambda deploy \
--config-file lazy_aws_lambda_config.yaml \
--requirements requirements.txt
2 changes: 1 addition & 1 deletion examples/aws_lambda/deploy_oauth.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
rm -rf slack_bolt && mkdir slack_bolt && cp -pr ../../slack_bolt/* slack_bolt/
pip install python-lambda -U
pip install git+https://github.com/nficano/python-lambda
lambda deploy \
--config-file aws_lambda_oauth_config.yaml \
--requirements requirements_oauth.txt
4 changes: 2 additions & 2 deletions examples/aws_lambda/lazy_aws_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,5 @@ def handler(event, context):
# export SLACK_BOT_TOKEN=xoxb-***

# rm -rf vendor && cp -pr ../../src/* vendor/
# pip install python-lambda
# lambda deploy --config-file aws_lambda_config.yaml --requirements requirements.txt
# pip install git+https://github.com/nficano/python-lambda
# lambda deploy --config-file lazy_aws_lambda_config.yaml --requirements requirements.txt
11 changes: 4 additions & 7 deletions examples/aws_lambda/lazy_aws_lambda_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ function_name: bolt_py_function
handler: lazy_aws_lambda.handler
description: My first lambda function
runtime: python3.8
# role: lambda_basic_execution
# Have lambda:InvokeFunction & lambda:GetFunction in the allowed actions
Comment on lines -7 to -8
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The required roles are noted in the README.md, so these comments were removed to avoid confusion! 📚

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, makes sense!

role: bolt_python_lambda_invocation
role: bolt_python_lambda_invocation

# S3 upload requires appropriate role with s3:PutObject permission
# (ex. basic_s3_upload), a destination bucket, and the key prefix
Expand All @@ -22,12 +20,11 @@ aws_secret_access_key:
# timeout: 15
# memory_size: 512
# concurrency: 500
#

# Experimental Environment variables
# Lambda environment variables
environment_variables:
SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN}
SLACK_SIGNING_SECRET: ${SLACK_SIGNING_SECRET}
SLACK_BOT_TOKEN: ${SLACK_BOT_TOKEN}
SLACK_SIGNING_SECRET: ${SLACK_SIGNING_SECRET}

# If `tags` is uncommented then tags will be set at creation or update
# time. During an update all other tags will be removed except the tags
Expand Down
Loading