{"id":15042461,"url":"https://github.com/zeljkobenovic/aws-commander","last_synced_at":"2025-04-14T20:33:19.014Z","repository":{"id":59044814,"uuid":"527611741","full_name":"ZeljkoBenovic/aws-commander","owner":"ZeljkoBenovic","description":"A tool used for running scripts on EC2 instances without the need for  direct SSH access.","archived":false,"fork":false,"pushed_at":"2023-11-22T12:09:34.000Z","size":38,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-28T08:51:13.919Z","etag":null,"topics":["aws","aws-ec2","aws-ssm","bash","bash-script"],"latest_commit_sha":null,"homepage":"","language":"Go","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/ZeljkoBenovic.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}},"created_at":"2022-08-22T14:57:43.000Z","updated_at":"2023-11-21T14:58:08.000Z","dependencies_parsed_at":"2024-01-01T05:10:05.246Z","dependency_job_id":"80228c83-0b69-4cc7-bd61-fe506e21c7d6","html_url":"https://github.com/ZeljkoBenovic/aws-commander","commit_stats":{"total_commits":12,"total_committers":2,"mean_commits":6.0,"dds":0.25,"last_synced_commit":"17436668e4d872d5c87f65828ffef0d9f795576c"},"previous_names":["trapesys/aws-commander"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeljkoBenovic%2Faws-commander","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeljkoBenovic%2Faws-commander/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeljkoBenovic%2Faws-commander/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZeljkoBenovic%2Faws-commander/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZeljkoBenovic","download_url":"https://codeload.github.com/ZeljkoBenovic/aws-commander/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248956207,"owners_count":21189313,"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-ec2","aws-ssm","bash","bash-script"],"created_at":"2024-09-24T20:47:20.817Z","updated_at":"2025-04-14T20:33:18.985Z","avatar_url":"https://github.com/ZeljkoBenovic.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AWS Commander\n\nA tool used for easier automation of the AWS EC2 instances, leveraging AWS Systems Manager - Run Command feature.   \nSupported scripts:\n* One-liner bash command\n* Bash script loaded from a local filesystem\n* Ansible playbook loaded from a local filesystem\n\nThe command/script/playbook will run across all EC2 instances simultaneously.     \nEC2 instances can be targeted by instance IDs or tags.\n\n\n## Prerequisites\n\n* The **AmazonSSMManagedInstanceCore** IAM role, attached on all EC2 instances.    \n* Authenticated AWS CLI session \n\n## Usage\n\n### AWS credentials\nAWS access must be authenticated via `aws cli`.\n\n### General Parameters\n* `log-level` - the level of logging output (`info`, `debug`, `error`). Default: `info`\n* `mode` - commands running mode (`bash`, `ansible`) Default: `bash`\n* `profile` - AWS profile as defined in *aws credentials* file.\n* `region` - AWS region in which EC2 instances reside.\n* `ids` - instance IDs, separated by comma (`,`). This is a mandatory flag.\n* `tags` - instance tags. Tags are semicolon delimited key - multiple value pairs (example: `Name=bar,baz;Role=foo,faz`)\n* `max-wait` - maximum wait time in seconds to run the command Default: `30`\n* `max-exec` - maximum wait time in seconds to get command result Default: `300`\n\n### Running Bash scripts\n* `cmd` - one-liner bash command that will be executed on EC2 instances.\n* `script` - the location of bash script file that will run on EC2 instances.\n* `mode` - for running Bash script or oneliner `mode` can be omitted or set to `bash`\n\n#### Example\n\n```bash\n# AWS authentication\naws sso login --profile test-account\n\n# oneliner using instance ids\naws-commander -instances i-0bf9c273c67f684a0,i-011c9b3e3607a63b5,i-0e53e37f7b34517f5,i-0f02ca10faf8f349e -cmd \"cd /tmp \u0026\u0026 ls -lah\" -aws-profile test-account\n\n# or bash script using instance ids\naws-commander -instances i-0bf9c273c67f684a0,i-011c9b3e3607a63b5,i-0e53e37f7b34517f5,i-0f02ca10faf8f349e -script ./script.sh -aws-profile test-account\n\n# or oneliner using tags\naws-commander -tags \"Name=Test,Test2,Test3;Role=test\" -cmd \"cd /tmp \u0026\u0026 ls -lah\" -aws-profile test-account\n\n# or bash script using tags\naws-commander -tags \"Name=Test,Test2,Test3;Role=test\" -script ./script.sh -aws-profile test-account\n```\n\n### Running Ansible Playbook\n* `playbook` - the location of Ansible playbook that will be executed on EC2 instances.\n* `ansible-url` - the URL locaction of the Ansible playbook\n* `extra-vars` - comma delimited, key value pairs of Ansible variables\n* `dryrun` - when set to true, Ansible playbook will run and the output will be shown, but \n  no data will be changed. Default: `false`\n* `mode` - for running Ansible playbook `mode` must be set to `ansible`\n\n#### Example\n```bash\n# AWS authentication\naws sso login\n\n# run local playbook using instance ids\naws-commander -instances i-0bf9c273c67f684a0,i-011c9b3e3607a63b5,i-0e53e37f7b34517f5,i-0f02ca10faf8f349e -mode ansible -playbook scripts/init.yaml -extra-vars foo=bar,faz=baz\n\n# or from url using instance ids\naws-commander -instances i-0bf9c273c67f684a0,i-011c9b3e3607a63b5,i-0e53e37f7b34517f5,i-0f02ca10faf8f349e -mode ansible -ansible-url https://example.com/init.yaml -extra-vars foo=bar,faz=baz\n\n# run local playbook using tags\naws-commander -tags \"Name=Test,Test2,Test3;Role=test\" -mode ansible -playbook scripts/init.yaml -extra-vars foo=bar,faz=baz\n\n# or from url using tags\naws-commander -tags \"Name=Test,Test2,Test3;Role=test\" -mode ansible -ansible-url https://example.com/init.yaml -extra-vars foo=bar,faz=baz\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeljkobenovic%2Faws-commander","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzeljkobenovic%2Faws-commander","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzeljkobenovic%2Faws-commander/lists"}