{"id":20640113,"url":"https://github.com/maresb/resolve-ec2-id","last_synced_at":"2025-10-28T12:38:46.613Z","repository":{"id":107327289,"uuid":"443847962","full_name":"maresb/resolve-ec2-id","owner":"maresb","description":"Look up the EC2 instance ID given an instance name.","archived":false,"fork":false,"pushed_at":"2022-06-17T15:58:59.000Z","size":85,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-28T06:45:14.509Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","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/maresb.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-02T19:05:07.000Z","updated_at":"2022-01-02T22:23:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"5a0d0065-f3f6-4ddb-98f2-73e3fba1455e","html_url":"https://github.com/maresb/resolve-ec2-id","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/maresb/resolve-ec2-id","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresb%2Fresolve-ec2-id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresb%2Fresolve-ec2-id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresb%2Fresolve-ec2-id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresb%2Fresolve-ec2-id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maresb","download_url":"https://codeload.github.com/maresb/resolve-ec2-id/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maresb%2Fresolve-ec2-id/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265437295,"owners_count":23765119,"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":[],"created_at":"2024-11-16T15:28:01.053Z","updated_at":"2025-10-28T12:38:41.581Z","avatar_url":"https://github.com/maresb.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# resolve-ec2-id\n\n## Links\n\n- [GitLab](https://gitlab.com/bmares/resolve-ec2-id)\n- [GitHub](https://github.com/maresb/resolve-ec2-id)\n- [PyPI](https://pypi.org/project/resolve-ec2-id/)\n\n## Introduction\n\nThis is a simple command-line tool which looks up the EC2 instance ID given an instance name:\n\n```bash\n$ resolve-ec2-id my-named-instance\ni-1234567890abcdef0\n```\n\nCurrently this tool only works with default credentials. Consider configuring them with environment variables or using a program like [aws-vault](https://github.com/99designs/aws-vault).\n\n## Alternatives\n\nThis package is perhaps not so useful because very similar functionality can be accomplished with AWS CLI as follows:\n\n```bash\naws ec2 describe-instances --filters 'Name=tag:Name,Values=my-named-instance' --query 'Reservations[*].Instances[*].{Instance:InstanceId}' --output text\n```\n\nHowever, this tool has slightly better error-handling; the above AWS CLI command will not generate an error in the case that no instance is found.\n\n## Installation\n\nIn order to install in a clean and isolated Python environment, it is recommended to use [pipx](https://github.com/pypa/pipx):\n\n```bash\npipx install resolve-ec2-id\n```\n\n## Examples\n\nAssuming you are using the Bash shell, to start an instance if you know the name but not the ID:\n\n```bash\n$ aws ec2 start-instances --output=yaml --instance-ids=\"$(resolve-ec2-id my-named-instance)\"\nStartingInstances:\n- CurrentState:\n    Code: 0\n    Name: pending\n  InstanceId: i-1234567890abcdef0\n  PreviousState:\n    Code: 80\n    Name: stopped\n```\n\nThis can also be used from within Python:\n\n```python\nfrom resolve_ec2_id import resolve_ec2_id\n\nec2_id = resolve_ec2_id('my-named-instance')\n```\n\n## Requirements\n\nBeyond the base dependencies which install automatically, this requires either [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-install.html) or [boto3](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#installation). (I did not make `boto3` a dependency because it isn't needed if AWS CLI is already installed.)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaresb%2Fresolve-ec2-id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaresb%2Fresolve-ec2-id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaresb%2Fresolve-ec2-id/lists"}