{"id":19529228,"url":"https://github.com/softmotions/aws4","last_synced_at":"2026-01-24T20:54:39.942Z","repository":{"id":65550084,"uuid":"530702823","full_name":"Softmotions/aws4","owner":"Softmotions","description":"AWS API client library in pure C","archived":false,"fork":false,"pushed_at":"2024-09-05T05:04:26.000Z","size":323,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-26T11:38:14.022Z","etag":null,"topics":["amazon","amazon-web-services","aws","aws-api","aws-client","aws-http-api","aws-http-client","aws-s3","aws-sdk","aws-sdk-c","aws-sdk-cpp","c","c-library","client","dynamodb"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Softmotions.png","metadata":{"files":{"readme":"README.md","changelog":"Changelog","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}},"created_at":"2022-08-30T14:49:19.000Z","updated_at":"2024-09-05T05:04:29.000Z","dependencies_parsed_at":"2024-11-11T01:24:19.102Z","dependency_job_id":"1c2265c9-3dda-4257-80a1-61991372bcc2","html_url":"https://github.com/Softmotions/aws4","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/Softmotions/aws4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softmotions%2Faws4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softmotions%2Faws4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softmotions%2Faws4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softmotions%2Faws4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Softmotions","download_url":"https://codeload.github.com/Softmotions/aws4/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softmotions%2Faws4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28736791,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-24T19:23:36.361Z","status":"ssl_error","status_checked_at":"2026-01-24T19:23:28.966Z","response_time":89,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["amazon","amazon-web-services","aws","aws-api","aws-client","aws-http-api","aws-http-client","aws-s3","aws-sdk","aws-sdk-c","aws-sdk-cpp","c","c-library","client","dynamodb"],"created_at":"2024-11-11T01:22:55.396Z","updated_at":"2026-01-24T20:54:39.926Z","avatar_url":"https://github.com/Softmotions.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS API client library in pure C\n\nAWS4 is a C client library used for signing and sending requests to AWS HTTP APIs (aws4.h).\nAlso it offers a simple DynamoDB client API (aws4dd.h) and **Distributed Resources Locking API (aws4dl.h)**.\n\nSoftmotions AWS4 library is very lightweight and It is not bloated with tons of dependencies.\n\n## Prerequisites\n\n* libcurl with SSL enabled\n* gcc or clang C11 compiler (tested on clang v14 / gcc v11) \n* cmake v3.18+, make or ninja\n\n## How to build\n\n```sh\ngit clone https://github.com/Softmotions/aws4\ncd ./aws4 \u0026\u0026 mkdir ./build\ncmake -DCMAKE_BUILD_TYPE=Release  ..\nmake\n```\n\n## Usage\n\nLook into `./src/aws4.h` and `./src/aws4dd.h` for API documentation.\n\nAlso look into test cases in `./src/tests` directory.\n\n### Examples\n\n#### DynamoDB API Put Item\n\n```c\n#include \u003caws4/aws4dd.h\u003e\n\niwrc rc = 0;\nstruct aws4dd_item_put *op = 0;\nstruct aws4dd_response *resp = 0;\n\naws4dd_item_put_op(\u0026op, \u0026(struct aws4dd_item_put_spec) {\n  .table_name = \"Thread\",\n  .condition_expression = \"ForumName \u003c\u003e :f and Subject \u003c\u003e :s\"\n});\n\naws4dd_item_put_value(op, \"/ExpressionAttributeValues/:f\", \"S\", \"Amazon DynamoDB\");\naws4dd_item_put_value(op, \"/ExpressionAttributeValues/:s\", \"S\", \"How do I update multiple items?\");\n\naws4dd_item_put_value(op, \"/Item/LastPostDateTime\", \"S\", \"201303190422\");\naws4dd_item_put_array(op, \"/Item/Tags\", \"SS\", (const char*[]) { \"Update\", \"Multiple\", \"Help\", 0 });\naws4dd_item_put_value(op, \"/Item/ForumName\", \"S\", \"Amazon DynamoDB\");\naws4dd_item_put_value(op, \"/Item/Message\", \"S\", \"I want to update multiple items in a single call.\");\naws4dd_item_put_value(op, \"/Item/Subject\", \"S\", \"How do I update multiple items?\");\naws4dd_item_put_value(op, \"/Item/LastPostedBy\", \"S\", \"fred@example.com\");\n\naws4dd_item_put(\u0026request_spec, op, \u0026resp);\n\naws4dd_response_destroy(\u0026resp);\naws4dd_item_put_op_destroy(\u0026op);\nreturn rc;\n```\n\n#### DynamoDB API Query\n\n```c\n\nRCC(rc, finish, aws4dd_query_op(\u0026op, \u0026(struct  aws4dd_query_spec) {\n  .table_name = s-\u003espec.service_table,\n  .key_condition_expression = \"kind = :kind\",\n  .filter_expression = \"ttl \u003c= :ttl\",\n  .projection_expression = \"kind\",\n  .limit = 1,\n  .consistent_read = true,\n}));\n\nRCC(rc, finish, aws4dd_query_value(op, \"/ExpressionAttributeValues/:kind\", \"S\", s-\u003espec.kind));\nRCC(rc, finish, aws4dd_query_value(op, \"/ExpressionAttributeValues/:ttl\", \"N\", ttl));\nRCC(rc, finish, aws4dd_query(\u0026s-\u003espec.request_spec, op, \u0026resp));\n\nif (!jbn_at(resp-\u003edata, \"/Items/0\", \u0026n) || n-\u003etype != JBV_OBJECT) {\n  *out = false;\n} else {\n  *out = true;\n}\n\n...\n\n```\n\n#### Low level universal AWS4 API\n\n```c\niwrc rc = 0;\nchar *out = 0;\n\nrc = aws4_request_raw(\u0026(struct aws4_request_spec) {\n  .flags = AWS_SERVICE_DYNAMODB,\n  .aws_region = \"us-east-1\",\n  .aws_key = \"fakeMyKeyId\",\n  .aws_secret_key = \"fakeSecretAccessKey\",\n  .aws_url = \"http://localhost:8000\"\n}, \u0026(struct aws4_request_payload) {\n  .payload = \"{}\",\n  .payload_len = IW_LLEN(\"{}\"),\n  .amz_target = \"DynamoDB_20120810.ListTables\"\n}, \u0026out);\n\nIWN_ASSERT(rc == 0);\nIWN_ASSERT(out);\n\nif (out) {\n  IWN_ASSERT(0 == strcmp(out, \"{\\\"TableNames\\\":[]}\"))\n}\n\nfree(out);\nreturn rc;\n```\n\n#### Distributed Resources Locking API\n\n```c\niwrc rc = 0;\nstruct aws4dl_lock *lock = 0;\nstruct aws4dl_lock_acquire_spec spec = {\n  .request                  = request_spec,\n  .poller                   = poller,\n};\n\nRCC(rc, finish, aws4dl_lock_acquire(\u0026spec, \u0026lock));\n\n// Critical section...\n\nRCC(rc, finish, aws4dl_lock_release(\u0026lock));\n\nfinish:\nif (rc) {\n  iwlog_ecode_error3(rc);\n}\nreturn rc;\n```\n\n## Tips\n\nTo make AWS API calls more efficient you can use a global `aws4_request_spec` structure and \nspecify globaly initialized `curl` handle in it. This will avoid creating a new `curl` handle\nfor each request. Note that you should not use a shared `curl` handle in a multi-threaded environment.\n\n## IWSTART\n\n[IWSTART](https://github.com/Softmotions/iwstart) is an automatic CMake initial project generator for C projects based on \n[iowow](https://github.com/Softmotions/iowow) / \n[iwnet](https://github.com/Softmotions/iwnet) / \n[ejdb2](https://github.com/Softmotions/ejdb) / \n[aws4](https://github.com/Softmotions/aws4) libs.\nYou may use it to create a new C project template from scratch based on thiese libs.\n\n\n# License\n```\n\nMIT License\n\nCopyright (c) 2012-2023 Softmotions Ltd \u003cinfo@softmotions.com\u003e\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftmotions%2Faws4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftmotions%2Faws4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftmotions%2Faws4/lists"}