{"id":24308095,"url":"https://github.com/bpineau/cloud-floating-ip","last_synced_at":"2026-03-16T08:02:56.629Z","repository":{"id":141386131,"uuid":"124035194","full_name":"bpineau/cloud-floating-ip","owner":"bpineau","description":"Implement a cloud floating/virtual IP by configuring GCP or AWS routes","archived":false,"fork":false,"pushed_at":"2018-03-19T07:48:07.000Z","size":51,"stargazers_count":5,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-08T07:39:37.334Z","etag":null,"topics":["aws","ec2","floating","gce","gcp","golang","vip"],"latest_commit_sha":null,"homepage":"","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/bpineau.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":"2018-03-06T07:00:12.000Z","updated_at":"2021-03-09T13:48:52.000Z","dependencies_parsed_at":"2024-06-20T11:10:23.534Z","dependency_job_id":null,"html_url":"https://github.com/bpineau/cloud-floating-ip","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/bpineau/cloud-floating-ip","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpineau%2Fcloud-floating-ip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpineau%2Fcloud-floating-ip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpineau%2Fcloud-floating-ip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpineau%2Fcloud-floating-ip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bpineau","download_url":"https://codeload.github.com/bpineau/cloud-floating-ip/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bpineau%2Fcloud-floating-ip/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":277090732,"owners_count":25759205,"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","status":"online","status_checked_at":"2025-09-26T02:00:09.010Z","response_time":78,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","ec2","floating","gce","gcp","golang","vip"],"created_at":"2025-01-17T04:47:23.033Z","updated_at":"2025-09-26T14:30:44.900Z","avatar_url":"https://github.com/bpineau.png","language":"Go","readme":"[![Build Status](https://travis-ci.org/bpineau/cloud-floating-ip.svg?branch=master)](https://travis-ci.org/bpineau/cloud-floating-ip)\n[![Go Report Card](https://goreportcard.com/badge/github.com/bpineau/cloud-floating-ip)](https://goreportcard.com/report/github.com/bpineau/cloud-floating-ip)\n\n# cloud-floating-ip\n\nImplement a floating/virtual IP by configuring cloud provider's routes.\n\nChoose an arbitrary private IP address, and `cloud-floating-ip` will\nconfigure route for that IP to the AWS or GCP instance of your choice.\n\n## Instances preparation\n\nTo choose a virtual IP: this address must be available, and not used\nelsewhere in the VPC; it doesn't have to be part of an existing subnet range.\n\nAll EC2/GCE instances that may become \"primary\" (carry the floating IP)\nat some point should be allowed by the cloud provider to route traffic:\n`SourceDestCheck` (EC2) or `canIpForward` (GCE) must be enabled.\n\nThose instances should be able to accept traffic to the floating IP.\nTo that effect, we can assign the virtual IP address to a loopback or\na dummy interface on all instances:\n\n```bash\n# we can do that on all instances\nip link add dummy0 type dummy\nip address add 10.200.0.50/32 dev dummy0\nip link set dev dummy0 up\n```\n\nThis can be persisted in network configurations (eg. in /etc/network/interfaces\nor /etc/sysconfig/network-scripts/).\n\n## Usage\n\nTo route the floating IP to the current instance:\n```bash\n# see what would change\ncloud-floating-ip -i 10.200.0.50 preempt --dry-run\n\n# apply the changes\ncloud-floating-ip -i 10.200.0.50 preempt\n```\n\nThe IP can be preempted by other instances in the VPC, by using the same\n`preempt` command.\n\nTo verify the status (\"primary\" or \"standby\") of any instance:\n```bash\ncloud-floating-ip -i 10.200.0.50 status\n```\n\nWhen `cloud-floating-ip` runs on the target instance, most settings (region,\ninstance id, cloud provider, ...) can be guessed from the instance metadata.\nTo act on a remote instance, we must be more explicit (or use a configuration file). Eg:\n\n```bash\ncloud-floating-ip -o aws -i 10.200.0.50 -t i-0e3f4ac17545ce580 -r eu-west-1 status\ncloud-floating-ip -o aws -i 10.200.0.50 -t i-0e3f4ac17545ce580 -r eu-west-1 preempt\n\ncloud-floating-ip -o gce -i 10.200.0.50 -p my-gcp-project \\\n  -t my-gce-instance -z europe-west1-b status\n\n````\n\nTo store the configuration (and save repetitive `-i ...` arguments):\n```bash\ncat\u003c\u003cEOF \u003e /etc/cloud-floating-ip.yaml\nip: 10.200.0.50\nquiet: true\nEOF\n```\n\n## Multihomed instances\n\nWhen the instance has only one interface attached to the VPC, `cloud-floating-ip`\nwill find and use this interface automatically.\n\nIf the instance has more than one external interfaces (and/or networks), we need\none of the following options to choose the target interface we'll route traffic to:\n\nProvide either:\n* --interface : the target interface name (ie. eni-xxxx on AWS, nicX on GCE)\n* --subnet : the target network interface's subnet name\n* --target-ip : the target network interface's private IP\n\n## Options\n\nThe `ip` argument is mandatory. Other settings can be collected from instance's\nmetadata when running `cloud-floating-ip` from an AWS or GCE instance.\n\nThose settings can be stored in the `/etc/cloud-floating-ip.yaml`\nconfiguration file. You can also pass them through environments (upper\ncase, prefixed by `CFI_`).\n\n\n```\nUsage:\n  cloud-floating-ip [flags]\n  cloud-floating-ip [command]\n\nAvailable Commands:\n  destroy     Delete the routes managed by cloud-floating-ip\n  help        Help about any command\n  preempt     Preempt an IP address and route it to the instance\n  status      Display the status of the instance (owner or standby)\n\nFlags:\n  -c, --config string              config file (default is /etc/cloud-floating-ip.yaml)\n  -i, --ip string                  IP address\n  -d, --dry-run                    dry-run mode\n  -q, --quiet                      quiet mode\n  -h, --help                       help for cloud-floating-ip\n  -o, --hoster string              hosting provider (aws or gce)\n  -t, --instance string            instance name\n  -f, --interface string           network interface ID\n  -s, --subnet string              subnet ID\n  -g, --target-ip string           target private IP\n  -m, --ignore-main-table          (AWS) ignore routes in main table\n  -a, --aws-access-key-id string   (AWS) access key Id\n  -k, --aws-secret-key string      (AWS) secret key\n  -r, --region string              (AWS) region name\n  -b, --table strings              (AWS) only consider this route table (may be specified several times)\n  -p, --project string             (GCP) project id\n  -z, --zone string                (GCP) zone name\n```\n\n## Required privileges\n\nOn EC2, the account running `cloud-floating-ip` must have the following rights:\n```\nec2:DescribeInstances\nec2:DescribeRouteTables\nec2:CreateRoute\nec2:ReplaceRoute\nec2:DeleteRoute\n```\n\nOn GCE:\n```\ncompute.instances.get\ncompute.routes.get\ncompute.routes.create\ncompute.routes.delete\ncontainer.operations.get\ncontainer.operations.list\n```\n\n## Limitations\n\n* On GCE, `cloud-floating-ip` won't delete already created, pre-existing routes with a distinct custom name\n* IPv4 only, for now\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpineau%2Fcloud-floating-ip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbpineau%2Fcloud-floating-ip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbpineau%2Fcloud-floating-ip/lists"}