initial commit
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
# LambdaPyZip
|
||||
|
||||
This layer uses the ```python_aws_lambda``` data source, which creates zip archives with the following inputs
|
||||
- source/function.py
|
||||
- source/requirements.txt
|
||||
|
||||
Function.py contains the lambda handler, while requirements.txt states the dependencies. This datasource will run
|
||||
pip install and generate zip archives in the output directory.
|
||||
@@ -0,0 +1,27 @@
|
||||
terraform {
|
||||
required_providers {
|
||||
python = {
|
||||
source = "ATenderholt/python"
|
||||
version = "0.9.2"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
provider "python" {
|
||||
pip_command = "pip3"
|
||||
}
|
||||
|
||||
data "python_aws_lambda" "example" {
|
||||
source_dir = "source"
|
||||
archive_path = "output/handler.zip"
|
||||
dependencies_path = "output/dependencies.zip"
|
||||
extra_args = "--only-binary=:all:"
|
||||
}
|
||||
|
||||
output lib_sum {
|
||||
value = data.python_aws_lambda.example.dependencies_base64sha256
|
||||
}
|
||||
|
||||
output function_sum {
|
||||
value = data.python_aws_lambda.example.archive_base64sha256
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
# reference: https://aws.amazon.com/premiumsupport/knowledge-center/start-stop-lambda-eventbridge/
|
||||
import requests
|
||||
|
||||
def lambda_handler(event, context):
|
||||
r = requests.get('https://ipinfo.io/')
|
||||
return {
|
||||
"HttpResponseCode": r.status_code
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
dnspython==2.7.0
|
||||
requests
|
||||
Reference in New Issue
Block a user