ssl - adding ip with forwarding rules in google cloud -
can provide tutorial on how add additional ip instance via forwarding in google cloud?
the current documentation complicated , not helpful. not states command should executed , instruction vague.
i've been trying setup new instance, not understand on how setup forwarding of traffic on instance other instance. highly appreciate if shine light on topic.
thank you.
i understood question differently (compared other answer). understand need second public ip pointing instance has own public ip. if case, follow these steps:
let's start sdk, since mention:
it not states command should executed , instruction vague
the commands executed in terminal once have downloaded , installed google cloud sdk. in linux/os x be:
curl https://sdk.cloud.google.com | bash
there's 3-step guide in link more information.
issue command:
gcloud compute instances list
to list of instances , zone belong to. take note of name , zone of instance need work with. notice region needed in commands below, first part of zone field. (for example: zone: us-central1-f, region us-central1)
create static public ip receive traffic want forward:
gcloud compute addresses create name gcloud compute addresses create targ-ip-1
where name again, of choice. prompt region (pick same region instance is). command return ip, let's say: w.x.y.z
you need create target-instance:
gcloud compute target-instances create name --instance instance gcloud compute target-instances create targ-ins-1 --instance instance-1
where name name of choice target instance. instance name of instance handling traffic 1 or more forwarding rules. prompt zone (pick same zone instance is).
you can create target-pools point several instances @ same time, instead of target instance.
create forwarding rule, using target instance , static public ip created:
gcloud compute forwarding-rules create name --address address --target-instance target_instance --target-instance-zone target_instance_zone --ip-protocol ip_protocol --port-range [port | port-port] gcloud compute forwarding-rules create fwd-rule-1 --address w.x.y.z --target-instance targ-ins-1 --target-instance-zone us-central1-f --ip-protocol tcp --port-range 5678-5680
where:
- name: name of choice forwarding rule
- address: ip address reserved in step 3
- target_instance: target instance name created in step 4
- target_instance_zone: zone target instance belongs to
- ip_protocol (optional): ip protocol rule serve. if left empty, tcp used. supported protocols are: ah, esp, sctp, tcp, udp.
- port (optional): if specified, packets addressed ports in specified range forwarded. if not specified, ports matched
you prompted select region rule belong to.
to verify rule, can list configured forwarding rules this:
gcloud compute forwarding-rules list
you should start receiving traffic pointing new public ip, in instance chose.
Comments
Post a Comment