{"id":15407217,"url":"https://github.com/ltfschoen/aws-lambda-ganache","last_synced_at":"2026-04-18T06:31:37.085Z","repository":{"id":76619937,"uuid":"289504276","full_name":"ltfschoen/aws-lambda-ganache","owner":"ltfschoen","description":"AWS Lambda Function in Node.js that uses Truffle to deploy any Solidity contract on Ganache and calls its data using web3.js","archived":false,"fork":false,"pushed_at":"2020-08-22T15:11:29.000Z","size":63,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T02:28:33.017Z","etag":null,"topics":["aws-cli","aws-lambda","dotenv","ethereum","ganache","gitcoin","nodejs","solidity","truffle","web3js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/ltfschoen.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-08-22T14:31:30.000Z","updated_at":"2022-01-24T16:09:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"2e79879c-8b29-404b-95cf-eb10123be4f3","html_url":"https://github.com/ltfschoen/aws-lambda-ganache","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"1ad0cbdacf6d62a40dd390531dd002a2d71990b6"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ltfschoen/aws-lambda-ganache","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Faws-lambda-ganache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Faws-lambda-ganache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Faws-lambda-ganache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Faws-lambda-ganache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ltfschoen","download_url":"https://codeload.github.com/ltfschoen/aws-lambda-ganache/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ltfschoen%2Faws-lambda-ganache/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31959873,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-18T00:39:45.007Z","status":"online","status_checked_at":"2026-04-18T02:00:07.018Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-cli","aws-lambda","dotenv","ethereum","ganache","gitcoin","nodejs","solidity","truffle","web3js"],"created_at":"2024-10-01T16:27:48.142Z","updated_at":"2026-04-18T06:31:37.066Z","avatar_url":"https://github.com/ltfschoen.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS Lambda Function with Ganache\n\nReference: https://gitcoin.co/issue/blockgeeks/BountyAnyERC20/3/100023523\n\n## Goal\n\n* Create an AWS Lambda Function (see https://console.aws.amazon.com/lambda) that generates a Node.js app and deploys any contract on Ganache and uses web3 or ethers to get any data from that contract.\n* Call the AWS Lambda Function and run the code in response to a HTTP request using Amazon API Gateway or using API calls with the AWS SDK\n\n* Note:\n  * Each service that integrates with Lambda sends data to the function in JSON as an event. The structure of the event document is different for each event type, and contains data about the resource or request that triggered the function. Lambda runtimes convert the event into an object and pass it to your function. https://docs.aws.amazon.com/lambda/latest/dg/lambda-services.html. Create an event source mapping and grant Lambda permission to access the other service in the execution role https://docs.aws.amazon.com/lambda/latest/dg/lambda-intro-execution-role.html\n\n## Setup AWS CLI\n\nhttps://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html\n\n```\ncd ~/Downloads\ncurl \"https://awscli.amazonaws.com/AWSCLIV2.pkg\" -o \"AWSCLIV2.pkg\" \u0026\u0026 \\\n  sudo installer -pkg AWSCLIV2.pkg -target \u0026\u0026 \\\n  aws --version\n```\n\n## Setup AWS Credentials\n\nCreate new Access Key from https://console.aws.amazon.com/billing/home?#/account then click username and \"My Security Credentials\", then \"Access keys (access key ID and secret access key)\"\n\nSet Access Keys\n\n```\naws configure\n```\n\nAvailable regions to use include (e.g. `ap-southeast-2`): https://docs.aws.amazon.com/general/latest/gr/rande.html\n\nOutput formats include (e.g. `json`): https://docs.aws.amazon.com/cli/latest/userguide/cli-usage-output.html\n\n## Add AWS Account ID to .env file\n\nObtain AWS Account ID from https://console.aws.amazon.com/billing/home?#/account then click username and \"My Security Credentials\", then \"Account Identifiers\"\n\nAlternatively run `aws sts get-caller-identity`\n\n## Create Execution Role\n\n* Create Execution Role and add the AWSLambdaBasicExecutionRole policy since it has the permissions that the function needs to write logs to CloudWatch Logs.\n```\naws iam create-role --role-name lambda-ex --assume-role-policy-document file://trust-policy.json\naws iam attach-role-policy --role-name lambda-ex --policy-arn arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole\n```\n\n## Create Deployment Package of AWS Lambda Function with Dependencies\n\nCheck that Node.js version in local environment matches the Node.js version\nof the AWS Lambda function.\n\nSwitch to Node.js v10.x\n\nInstall libraries into the node_modules/ directory\n```\nnpm install;\n```\n\nCreate zip file containing contents of project folder\n```\nzip -r my-function.zip .\n```\n\n```\n./scripts/create-function.sh\n```\n\n## Run AWS Lambda Function Locally\n\n```\nnode index.js\n```\n\n## View Logs\n\n```\n./scripts/get-logs-all.sh\n./scripts/get-logs-last5.sh\n```\n\n## References\n\nhttps://docs.aws.amazon.com/lambda/latest/dg/welcome.html\nhttps://docs.aws.amazon.com/lambda/latest/dg/getting-started.html\nhttps://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-awscli.html\nhttps://docs.aws.amazon.com/lambda/latest/dg/lambda-nodejs.html\nhttps://docs.aws.amazon.com/lambda/latest/dg/nodejs-package.html\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltfschoen%2Faws-lambda-ganache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fltfschoen%2Faws-lambda-ganache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fltfschoen%2Faws-lambda-ganache/lists"}