{"id":36693295,"url":"https://github.com/jdevelop/go-aws-mfa","last_synced_at":"2026-01-12T11:24:23.147Z","repository":{"id":57546962,"uuid":"102917784","full_name":"jdevelop/go-aws-mfa","owner":"jdevelop","description":"Simple tool to refresh an MFA token for AWS IAM account (using STS)","archived":false,"fork":false,"pushed_at":"2019-11-19T02:55:44.000Z","size":5,"stargazers_count":13,"open_issues_count":0,"forks_count":5,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-06-20T02:11:12.667Z","etag":null,"topics":["amazon-aws","golang","golang-application"],"latest_commit_sha":null,"homepage":null,"language":"Go","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/jdevelop.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}},"created_at":"2017-09-09T01:32:16.000Z","updated_at":"2022-06-25T18:03:48.000Z","dependencies_parsed_at":"2022-09-05T12:31:18.089Z","dependency_job_id":null,"html_url":"https://github.com/jdevelop/go-aws-mfa","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jdevelop/go-aws-mfa","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevelop%2Fgo-aws-mfa","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevelop%2Fgo-aws-mfa/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevelop%2Fgo-aws-mfa/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevelop%2Fgo-aws-mfa/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jdevelop","download_url":"https://codeload.github.com/jdevelop/go-aws-mfa/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jdevelop%2Fgo-aws-mfa/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338971,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T10:58:46.209Z","status":"ssl_error","status_checked_at":"2026-01-12T10:58:42.742Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["amazon-aws","golang","golang-application"],"created_at":"2026-01-12T11:24:23.012Z","updated_at":"2026-01-12T11:24:23.141Z","avatar_url":"https://github.com/jdevelop.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"### Why\nIf you have an [MFA-enabled](https://aws.amazon.com/iam/details/mfa/) account on Amazon AWS, you need to refresh the token periodically, in order to use [aws cli toolkit](https://aws.amazon.com/cli/). \n\nThe sequence of actions is:\n\n* using the primary AWS account, request the [list of MFA devices](http://docs.aws.amazon.com/IAM/latest/APIReference/API_ListMFADevices.html) configured for this account\n* issue an STS request to [get the session token](http://docs.aws.amazon.com/STS/latest/APIReference/API_GetSessionToken.html)\n* update the `~/.aws/credentials` file with the received access key, secret key and session token for the given profile\n\nThis simple flow is implemented as Go utility, that only updates the existing profile in the `~/.aws/credentials` with the access/secret/session tokens.\n\nThere is another utility [awsmfa](https://github.com/dcoker/awsmfa/) with extended functionality for AWS key management / rotation.\n\n### How\n\n```\nUsage of ./go-aws-mfa:\n  -d string\n        MFA-enabled profile\n  -s string\n        Source (primary) profile\n```\n\nwhere\n\n* `-s` specifies the IAM role that has an [MFA device configured](http://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_mfa_enable_virtual.html)\n* `-d` specifies the target profile to add/replace the credentials to.\n\n#### Example\n\n`./go-aws-mfa -s user1 -d user1-mfa` will ask for the token code for MFA device configured for `user1`. Then the temporary credentials will be stored for `user1-mfa`.\nIn order to use that temporary account with `awscli`, you need to set the `AWS_PROFILE` environment variable to `user1-mfa` and then invoke `aws` command normally, for example:\n\n```\nAWS_PROFILE=user1-mfa aws s3 ls s3://bucket-user1/\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdevelop%2Fgo-aws-mfa","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjdevelop%2Fgo-aws-mfa","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjdevelop%2Fgo-aws-mfa/lists"}