{"id":22477186,"url":"https://github.com/base2services/aws-lambda-http-check","last_synced_at":"2025-06-27T10:06:56.206Z","repository":{"id":46612989,"uuid":"105852718","full_name":"base2Services/aws-lambda-http-check","owner":"base2Services","description":"Lambda function to check http endpoint wrapped in serverless project","archived":false,"fork":false,"pushed_at":"2023-11-23T23:37:35.000Z","size":28,"stargazers_count":34,"open_issues_count":2,"forks_count":16,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-06-27T10:05:30.374Z","etag":null,"topics":["aws","aws-cloudwatch","cloudwatch","http-endpoint-check","lambda","monitoring-tool","python","serverless"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/base2Services.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2017-10-05T05:27:01.000Z","updated_at":"2024-11-11T03:43:56.000Z","dependencies_parsed_at":"2023-11-24T00:26:45.154Z","dependency_job_id":"523b54a5-e563-4cde-92ac-62e8f169f803","html_url":"https://github.com/base2Services/aws-lambda-http-check","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/base2Services/aws-lambda-http-check","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base2Services%2Faws-lambda-http-check","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base2Services%2Faws-lambda-http-check/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base2Services%2Faws-lambda-http-check/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base2Services%2Faws-lambda-http-check/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/base2Services","download_url":"https://codeload.github.com/base2Services/aws-lambda-http-check/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/base2Services%2Faws-lambda-http-check/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262235780,"owners_count":23279566,"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","aws-cloudwatch","cloudwatch","http-endpoint-check","lambda","monitoring-tool","python","serverless"],"created_at":"2024-12-06T14:09:47.024Z","updated_at":"2025-06-27T10:06:56.180Z","avatar_url":"https://github.com/base2Services.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lambda http check\n\nLambda function to check specific http endpoint, and report on it's availability.\n\n\nOptionally, it can record metrics to CloudWatch.\n\n## Inputs\n\nAll inputs are either defined as environment variables or as part of event data. Event data\nwill take priority over environment variables\n\n`ENDPOINT` - url to be checked\n\n`METHOD` - http method to use, defaults to `GET`\n\n`PAYLOAD` - http payload, if `POST` or `PUT` used as method\n\n`TIMEOUT` - timeout to use for http requests, defaults to 120s\n\n`HEADERS` - list of _percentage sign (%)_ separated headers to send to target server, defaults to empty list.\n\n`USER_AGENT` - If specified, will be added to the HEADERS. An example is: `Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Base2/Lambda`\n\n`REPORT_RESPONSE_BODY` - set to 1 if you wish to report on response body, 0\notherwise, 0 otherwise, defaults to 0\n\n`REPORT_AS_CW_METRICS` - set to 1 if you wish to store reported data as CW\ncustom metrics, 0 otherwise, defaults to 1\n\n`CW_METRICS_NAMESPACE` - if CW custom metrics are being reported, this will determine\ntheir namespace, defaults to 'HttpCheck'\n\n`BODY_REGEX_MATCH` - if CW custom metrics are being reported, this will enable `ResponseBodyRegexMatch`\nmetric to be published as well, with value determined by success of matching response body against\nregular expression contained within this option\n\n`STATUS_CODE_MATCH` - report whether http status code is equal to given status code or not. If this option\nis not present, it won't be reported upon. Defaults to empty\n\n`FAIL_ON_STATUS_CODE_MISMATCH` - if checking for status code match treat mismatch as failure, ie report `Available: 0`\n\n## Outputs\n\nBy default, following properties will be rendered in output Json\n\n`Reason` - Reason\n\n`Available` - 0 or 1\n\n`TimeTaken` - Time in ms it took to get response from remote server. Default timeout\nis 2 minutes for http requests.\n\n`StatusCode` - Http Status Code\n\n`ResponseBody` - Optional, by default this won't be reported\n\n`ResponseBodyRegexMatch` - Optional, if `BODY_REGEX_MATCH` option is provided\n\n`StatusCodeMatch` - Optional, if `STATUS_CODE_MATCH` options is provided\n\n## Dependencies\n\nLambda function is having no external dependencies by design, so no additional packaging steps are required\nfor deploying it, such as doing `pip install [libname]`\n\n## CloudWatch Metrics\n\nIn order to get some metrics which you can alert on, `REPORT_AS_CW_METRICS` and `CW_METRICS_NAMESPACE` environment\nvariables are used. Following metrics will be reported\n\n- `Available` - 0 or 1, whether response was received in timely manner, indicating problems with network, DNS lookup or\nserver timeout\n\n- `TimeTaken` - Time taken to fetch response, reported in milliseconds\n\n- `StatusCode` - HTTP Status code received from server\n\n- `ResponseBodyRegexMatch` - **optional** this will report 1 or 0 if `BODY_REGEX_MATCH` option is specified. 1 is reported\n if response body matches regex provided, or 0 otherwise. \n\n- `StatusCodeMatch` - **optional*\u0026 this will report 1 or 0 if `STATUS_CODE_MATCH` options is specified. 1 is reported\n if response status code matches code provided, or 0 otherwise\n\n## Deployment\n\nYou can either deploy Lambda manually, or through [AWS SAM CLI](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/what-is-sam.html).\nIf the SAM CLI is being chosen as method of deployments use command below, while\nmaking sure that you have [setup access](https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/serverless-getting-started-set-up-credentials.html) to your AWS account.\n\nbuild the lambda\n\n```sh\nsam build\n```\n\ndeploy the template\n\n```sh\nsam deploy --guided\n```\n\nIf you are setting up your Lambda function by hand, make sure it has proper IAM\npermissions to push Cloud Watch metrics data, and to write to CloudWatch logs\n\n## Testing\n\nTo test function locally with simple Google url (default), run following\n\n```\nsam local invoke Check\n```\n\nOptionally, for complicated example take a look at `test/ipify.json` file\n\n```sh\nsam local invoke Check --event test/ipify.json \n```\n\n## Debugging\n\nIf you wish to see debug output for http request, set `HTTP_DEBUG` environment\nvariable to '1'. This can't be controlled through event payload. \n\n## Schedule execution \n\nPull requests are welcome to serverless project to deploy CloudWatch rules in order\nto schedule execution of Http Checking Lambda function.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbase2services%2Faws-lambda-http-check","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbase2services%2Faws-lambda-http-check","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbase2services%2Faws-lambda-http-check/lists"}