{"id":17132222,"url":"https://github.com/bitsofinfo/covid19datapuller-sam","last_synced_at":"2025-03-24T05:18:47.522Z","repository":{"id":146758818,"uuid":"273989401","full_name":"bitsofinfo/covid19datapuller-sam","owner":"bitsofinfo","description":"Simple SAM demo that pulls public data from coronavirusapi.com","archived":false,"fork":false,"pushed_at":"2020-06-21T22:13:14.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T11:13:00.173Z","etag":null,"topics":["aws-lambda","lambda-functions","sam"],"latest_commit_sha":null,"homepage":null,"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/bitsofinfo.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-06-21T21:54:31.000Z","updated_at":"2020-06-21T22:13:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"f83a4a32-cbfa-48e9-a560-8837c9169507","html_url":"https://github.com/bitsofinfo/covid19datapuller-sam","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Fcovid19datapuller-sam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Fcovid19datapuller-sam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Fcovid19datapuller-sam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bitsofinfo%2Fcovid19datapuller-sam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bitsofinfo","download_url":"https://codeload.github.com/bitsofinfo/covid19datapuller-sam/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245212311,"owners_count":20578443,"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","lambda-functions","sam"],"created_at":"2024-10-14T19:26:24.480Z","updated_at":"2025-03-24T05:18:47.501Z","avatar_url":"https://github.com/bitsofinfo.png","language":"Python","readme":"# covid19datapuller SAM demo\n\nThis demo will get you up and running with the [AWS SAM (Serverless Application Model)](https://aws.amazon.com/serverless/sam/) with an example AWS lambda (python3) function that pulls public data from http://coronavirusapi.com/ every `60` minutes, and writes it to an s3 bucket under `[bucketname]/[fetch-timestamp]/data.json`\n\n## Prerequisites\n\n* Docker Desktop (https://docs.docker.com/desktop/)\n* Python 3.x \u0026 pip 3.x\n* AWS cli w/ configured credentials with the appropriate access to create s3 buckets, lambda functions, cloudformation stacks, cloudwatch events etc.\n\n## Setup\n\nOsx, install via brew:\n```\nbrew tap aws/tap\nbrew install aws-sam-cli\n```\n\nVerify installed version:\n```\nsam --version\n```\n\nCreate the S3 bucket where SAM will upload its artifacts:\n```\naws --region us-east-1 s3 mb s3://sam-covid19datapuller\n```\n\nBuild the app:\n```\nsam build \n```\n\nDeploy to \"dev\"\n```\nsam deploy \\\n  --parameter-overrides \"ParameterKey=Env,ParameterValue=dev ParameterKey=Version,ParameterValue=1.0.0\" \\\n  --stack-name covid19datapuller-dev\n```\n\nDeploy to \"prod\"\n```\nsam deploy \\\n  --parameter-overrides \"ParameterKey=Env,ParameterValue=prod ParameterKey=Version,ParameterValue=1.0.0\" \\\n  --stack-name covid19datapuller-prod\n```\n\n## Notes\n\nOnce up and running you can checkout the created items in the follow AWS services. Be sure to verify that your region matches the region in your local AWS creds file which in-turn is the region where serverless will deploy everything to.\n\n* https://console.aws.amazon.com/events (click on events -\u003e rules)\n  * There will be 2 `covid19datapuller-[dev|prod]` event triggers created for both the dev/prod functions (every 60m, you can change this in `template.yaml`)\n  \n* https://s3.console.aws.amazon.com/s3/home\n  * There will be 2 `covid19datapuller-bucket-[dev|prod]` buckets created, one for each dev/prod function, where the pulled data will be written in JSON format and annotated w/ the function version and timestamp the data was pulled. (every 60m)\n  \n* https://console.aws.amazon.com/lambda\n  * There should be 2 `covid19datapuller-[dev|prod]` functions, one for each serverless \"stage\" (dev/prod)\n\n* https://console.aws.amazon.com/cloudformation/home\n    * There should be 2 `covid19datapuller-[dev|prod]` stacks, one for each dev/prod serverless app\n  \n* https://console.aws.amazon.com/iam/home (look in roles)\n  * There should be ONE `covid19datapuller-[dev|prod]` role with appropriate permissions. \n\n## Cleanup\n```\naws --region us-east-1 cloudformation delete-stack --stack-name covid19datapuller-dev\naws --region us-east-1 cloudformation delete-stack --stack-name covid19datapuller-prod\n```\n\n## Errata\n\nYou can create 7 types of CF things represented by these higher level abstractions in the SAM spec + any other lower-level CF resource types\n\n* `AWS::Serverless::Api`: Documents the API via openapi spec. Implicitly created via any AWS::Serverless::Function\n  \n* `AWS::Serverless::Application`: Embeds/refs a named serverless application as a nested app from a published ref the SAM app repository or an S3 bucket \n  \n* `AWS::Serverless::Function`: defines a lambda function to be created referencing the local `CodeUri` of a folder in the project \n\n* `AWS::Serverless::HttpApi`: API gateway definition, might also be created automatically if your `AWS::Serverless::Function` declares an event of type `Api`\n\n* `AWS::Serverless::LayerVersion`: Creates a lambda layer, reference local or remote s3 repo where this lives\n\n* `AWS::Serverless::SimpleTable`: Creates a DynamoDB table with a single attribute primary key\n\n* `AWS::Serverless::StateMachine`: Creates an AWS Step Functions state machine\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitsofinfo%2Fcovid19datapuller-sam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbitsofinfo%2Fcovid19datapuller-sam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbitsofinfo%2Fcovid19datapuller-sam/lists"}