{"id":18573159,"url":"https://github.com/localstack-samples/sample-simple-invoke-lambda","last_synced_at":"2025-04-10T07:31:51.184Z","repository":{"id":185686616,"uuid":"673924988","full_name":"localstack-samples/sample-simple-invoke-lambda","owner":"localstack-samples","description":"Create node and python lambda from simple make targets using AWS CLI and invoke them","archived":true,"fork":false,"pushed_at":"2023-08-04T18:13:15.000Z","size":55,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":15,"default_branch":"main","last_synced_at":"2025-02-17T14:44:42.241Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Makefile","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/localstack-samples.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}},"created_at":"2023-08-02T18:25:27.000Z","updated_at":"2024-07-16T09:15:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"2948f9ba-ee40-407c-ac78-6053bd59225d","html_url":"https://github.com/localstack-samples/sample-simple-invoke-lambda","commit_stats":null,"previous_names":["localstack-samples/sample-simple-invoke-lambda"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-simple-invoke-lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-simple-invoke-lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-simple-invoke-lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/localstack-samples%2Fsample-simple-invoke-lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/localstack-samples","download_url":"https://codeload.github.com/localstack-samples/sample-simple-invoke-lambda/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248176387,"owners_count":21060058,"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":[],"created_at":"2024-11-06T23:08:14.874Z","updated_at":"2025-04-10T07:31:50.915Z","avatar_url":"https://github.com/localstack-samples.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simple AWS CLI Sample with Lambda\nUse three different methods via the CLI to create and invoke a Lambda. \nCreate node and python lambda from simple make targets.\n\n`makefile` uses these three different ways to configure the AWS CLI. Uncomment the one you want to use. \n```makefile\n#AWS_CLI=AWS_PROFILE=localstack aws\n#AWS_CLI=AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test aws --endpoint-url http://localhost:4566 --region us-east-1\n#AWS_CLI=awslocal\n```\n![\"Design\"](./docs/img/solution-diags.drawio.png)\n\n\n# Setup \nAfter you've cloned this repo.\nYou can either use a LocalStack AWS_PROFILE for credentials, or use `awslocal`. Setup options are directly below.\n\n### With LocalStack Profile\n1. Setup an AWS_PROFILE for LocalStack\n\n#### Add this to your `~/.aws/config` file\n\n```text\n[profile localstack]\nregion=us-east-1\noutput=json\nendpoint_url = http://localhost:4566\n```\n\n#### Add this to your `~/.aws/credentials` file\n\n```text\n[localstack]\naws_access_key_id=test\naws_secret_access_key=test\n```\n\n\n### With awslocal wrapper\n1. Create a Python venv and activate it\n\n      ```bash\n      make setup-venv\n      source venv/bin/activate\n      ```\n2. Change makefile to point at awslocal\n```makefile\n#AWS_CLI=AWS_PROFILE=localstack aws\n#AWS_CLI=AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test aws --endpoint-url http://localhost:4566 --region us-east-1\nAWS_CLI=awslocal\n```\n\n### With AWS CLI\nChange makefile to point at aws CLI. Must be AWS CLI v2.\n```makefile\n#AWS_CLI=AWS_PROFILE=localstack aws\nAWS_CLI=AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test aws --endpoint-url http://localhost:4566 --region us-east-1\n#AWS_CLI=awslocal\n```\n\n## Run LocalStack\nYou can use LocalStack Pro, just see the commented out line in `docker-compose.yml`.\n\n```shell\ndocker compose up\n```\n\n# Python Lambda Test\n1. Build python function zip\n```shell\nmake bundle-py\n```\n2. Deploy function\n```shell\nmake create-py-function\n```\n3. Invoke function\n```shell\nmake local-py-invoke\n```\n4. See results\n```shell\ncat output.txt\n```\n\n# Node Lambda Test\n1. Build python function zip\n```shell\nmake bundle\n```\n2. Deploy function\n```shell\nmake create-function\n```\n3. Invoke function\n```shell\nmake local-invoke\n```\n4. See results\n```shell\ncat output.txt\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Fsample-simple-invoke-lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flocalstack-samples%2Fsample-simple-invoke-lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flocalstack-samples%2Fsample-simple-invoke-lambda/lists"}