{"id":20455265,"url":"https://github.com/alexmhack/python-with-secrets-manager","last_synced_at":"2026-04-17T18:04:03.276Z","repository":{"id":229163347,"uuid":"775896194","full_name":"Alexmhack/python-with-secrets-manager","owner":"Alexmhack","description":"Testing a simple python application by making use of GCP Secrets Manager for the environment variables","archived":false,"fork":false,"pushed_at":"2024-03-22T10:31:05.000Z","size":306,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-04-08T02:14:14.746Z","etag":null,"topics":["aws","environment-variables","gcp","learning","python3","secrets","secrets-manager","testing","tutorial"],"latest_commit_sha":null,"homepage":"","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/Alexmhack.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}},"created_at":"2024-03-22T09:05:41.000Z","updated_at":"2024-03-22T10:29:17.000Z","dependencies_parsed_at":"2024-03-22T11:41:42.027Z","dependency_job_id":"d96abdee-b819-4080-a189-4604e7e1d9e1","html_url":"https://github.com/Alexmhack/python-with-secrets-manager","commit_stats":null,"previous_names":["alexmhack/python-with-secrets-manager"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Alexmhack/python-with-secrets-manager","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexmhack%2Fpython-with-secrets-manager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexmhack%2Fpython-with-secrets-manager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexmhack%2Fpython-with-secrets-manager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexmhack%2Fpython-with-secrets-manager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alexmhack","download_url":"https://codeload.github.com/Alexmhack/python-with-secrets-manager/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexmhack%2Fpython-with-secrets-manager/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31939794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-17T17:29:20.459Z","status":"ssl_error","status_checked_at":"2026-04-17T17:28:47.801Z","response_time":62,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":["aws","environment-variables","gcp","learning","python3","secrets","secrets-manager","testing","tutorial"],"created_at":"2024-11-15T11:18:23.331Z","updated_at":"2026-04-17T18:04:03.243Z","avatar_url":"https://github.com/Alexmhack.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# python-with-secrets-manager\n\nThis is a very basic FastAPI application that makes use of Secrets Manager Providers like [AWS](https://docs.aws.amazon.com/secretsmanager/latest/userguide/intro.html) \u0026 [GCP](https://cloud.google.com/security/products/secret-manager).\n\nYou can take reference from the code for better understanding, below are listed a few points to be noted for using and managing \nsecrets in Secrets Manager Provider.\n\n1. AWS provides us option to add *Other type of secret* which basically allows us to store Key/Value pairs as secrets, this is very \nhelpful as we can store lots of key value pairs and make use of them as a dictionary in Python code.\n\t![AWS - Other type of secret](https://github.com/Alexmhack/python-with-secrets-manager/blob/master/readme_images/aws_secret_type.png)\n\n2. On the other hand, GCP does not allow this option and instead we have a text based input, but we can definitely enter JSON format \nthere and store it and later on access this as a dictionary in Python code.\n\t![GCP - Text type of secret only](https://github.com/Alexmhack/python-with-secrets-manager/blob/master/readme_images/gcp_secret_type.png)\n\n3. We are using `lru_cache` from `itertools` to cache our secrets once they have being retrieved in the Python code, which is a good \nway to fetch secrets very fast after initial loading but the secrets value won't change until the server has been restarted which is \nserving FastAPI app.\n\n4. `AttrDict` -\u003e This is a custom written utility which helps to convert a Python dict to a class object which has access to all the dict keys using `.` notation. For e.g. if a secret is `{\"API_VERSION\": \"14\"}` then using `AttrDict` instance we can access it using `attr_dict_instance.API_VERSION  # output -\u003e 14`\n\n5. We can even use region wise secrets by defining the secrets in multiple regions of Secrets Manager Provider (AWS / GCP). This can be \nhelpful when we have different servers in different regions and we want to match the Secrets with those regions and access accordingly.\n\n\n## AWS Setup\n\n![AWS - Image showing secret stored in AWS console](https://github.com/Alexmhack/python-with-secrets-manager/blob/master/readme_images/aws_first_image.png)\n\n## GCP Setup\n\n![GCP - Image showing secret stored in GCP console](https://github.com/Alexmhack/python-with-secrets-manager/blob/master/readme_images/gcp_first_image.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexmhack%2Fpython-with-secrets-manager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexmhack%2Fpython-with-secrets-manager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexmhack%2Fpython-with-secrets-manager/lists"}