{"id":15366851,"url":"https://github.com/jacobv90/localstack_terraform_python_lambda_ex","last_synced_at":"2025-04-15T12:33:37.674Z","repository":{"id":101647181,"uuid":"262476904","full_name":"JacobV90/localstack_terraform_python_lambda_ex","owner":"JacobV90","description":"Example configuration for using Localstack and docker-compose.","archived":false,"fork":false,"pushed_at":"2024-10-24T16:46:52.000Z","size":12,"stargazers_count":3,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-28T20:12:16.232Z","etag":null,"topics":["aws-lambda","docker","lambda-functions","localstack","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JacobV90.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-09T03:02:34.000Z","updated_at":"2024-03-27T19:46:32.000Z","dependencies_parsed_at":"2023-06-07T07:00:23.445Z","dependency_job_id":null,"html_url":"https://github.com/JacobV90/localstack_terraform_python_lambda_ex","commit_stats":{"total_commits":8,"total_committers":1,"mean_commits":8.0,"dds":0.0,"last_synced_commit":"36ab38744757f606bce29e24c4ce5c7b889ff949"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobV90%2Flocalstack_terraform_python_lambda_ex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobV90%2Flocalstack_terraform_python_lambda_ex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobV90%2Flocalstack_terraform_python_lambda_ex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JacobV90%2Flocalstack_terraform_python_lambda_ex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JacobV90","download_url":"https://codeload.github.com/JacobV90/localstack_terraform_python_lambda_ex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249072432,"owners_count":21208185,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","docker","lambda-functions","localstack","python"],"created_at":"2024-10-01T13:20:01.143Z","updated_at":"2025-04-15T12:33:37.668Z","avatar_url":"https://github.com/JacobV90.png","language":"Python","funding_links":["https://paypal.me/therealveal?locale.x=en_US"],"categories":[],"sub_categories":[],"readme":"\n# AWS Lambda and Terraform local development using Localstack and Docker\n\n## Why?.. To save time and money\n\nBy mocking some AWS services, we can develop locally without having to deploy to AWS. This capability will help increase the development cycle by reducing the feedback time.\n\nThis example project leverages a docker compose file to spin up a local Localstack instance and an infrastructure service that uses terraform to deploy an AWS Lambda Function to the running Localstack instance on your computer.\n\nThe docker-compose configuration will mount the projects directory to the docker containers started by localstack. This is done to enable rapid development. Any changes made will take effect when the file is saved so theres no need to redeploy the lambda function to localstack.\n\n## Requirements\n  * python3.x\n  * docker and docker compose\n\n## Installation\n\n### Mac/Linux \n``` bash\ncd localstack_terraform_python_lambda_ex\npython3 -m venv venv\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\n### Windows\n``` powershell\ncd localstack_terraform_python_lambda_ex\npython3 -m venv venv\n.\\venv\\Scripts\\activate\npip install -r requirements.txt\n```\n\nCreate a **.env** file in the top level directory with these variables:\n```\nTF_VAR_PROJECT_ABS_PATH={your_absolute_path_to_this_project}\nTF_VAR_PYTHON_LIB_PATH={relative_path_to_python_packages}\n```\n\n## Running the example project\n```\ndocker-compose up\n```\n\nAfter the docker images are pulled down and built, you should see Localstack outputting logs when its container is started. *The infrastructure service will wait for Localstack to be ready inorder to deploy the lambda function.* \n\nOnce the lambda function is deployed, run in a python virtual environment activated terminal:\n```\nawslocal lambda invoke --function-name lambda-function response.json\n```\n\u003e[awslocal](https://github.com/localstack/awscli-local) is python package that mimics the **awscli** tool but is tailored towards Localstack. It makes it very easy to interact with Localstack like you normally would with AWS.\n\nThe lambda function should have been successfully invoked and should return its connection status to the MySql database.\n\n**And thats it!**\n\nYou can now make changes to the lambda functions code without having to deploy to AWS or redeploy to Localstack. \n\nIf you found this example valuable and want to show some love, I wouldn't say no to a coffee 😄\n\nPaypal - \nhttps://paypal.me/therealveal?locale.x=en_US\n\nCashapp - https://cash.app/$theRealVeal\n\nBitcoin - 3HgZALWTyDFum4YcFwvjNvhYZHDUhJ45EQ\n\nEthereum - 0xED4e780A5E35d9d9cA0275302f16A394aeF7D862\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobv90%2Flocalstack_terraform_python_lambda_ex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjacobv90%2Flocalstack_terraform_python_lambda_ex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjacobv90%2Flocalstack_terraform_python_lambda_ex/lists"}