how to connect to psql on google VM Instance
I can connect and ssh into the external VM. But I have a hard time accessing the postgres serve on the VM. I have done the following
I updated the postgresql.conf to
listen_addresses = '*'
port = 5432
- I have did the following to my firewall.
what should i do next?
google-cloud-platform psql
add a comment |
I can connect and ssh into the external VM. But I have a hard time accessing the postgres serve on the VM. I have done the following
I updated the postgresql.conf to
listen_addresses = '*'
port = 5432
- I have did the following to my firewall.
what should i do next?
google-cloud-platform psql
add a comment |
I can connect and ssh into the external VM. But I have a hard time accessing the postgres serve on the VM. I have done the following
I updated the postgresql.conf to
listen_addresses = '*'
port = 5432
- I have did the following to my firewall.
what should i do next?
google-cloud-platform psql
I can connect and ssh into the external VM. But I have a hard time accessing the postgres serve on the VM. I have done the following
I updated the postgresql.conf to
listen_addresses = '*'
port = 5432
- I have did the following to my firewall.
what should i do next?
google-cloud-platform psql
google-cloud-platform psql
asked Jan 19 at 3:10
user1871528user1871528
64121127
64121127
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The firewall rule is really insecure (you are allowing everyone on internet to connect to your GCE instance using all the ports) and maybe another firewall rule is blocking this rule due to the priority is really low (the greater the priority number is, the lower priority has). Did you follow this tutorial? once you add listen_addresses = '*'
, you need to restart your PostgreSQL service with sudo service postgresql restart
.
Also, you need to create 2 firewall rules, one for ingress and another one for egress. Both to accept traffic to tcp:5432
, can you please create 2 firewall rules with more priority that accepts traffic from that port with a smaller IP range?
Thanks this helped. The only question I have is with the range of the IP access. we use different VMS (that might come and go into existence) as our IP address. How can I allow for them to have access if the ips are changing and I dont have listen_addresses = '*'?
– user1871528
Jan 21 at 22:34
@user1871528 those VMs are local VMs or GCE instances? if are GCE instances, you can reserve static IPs for free to use them in your GCE instances. If not... It's much complicated and costly. However, you can use 0.0.0.0/0 as you had, but it's a bit risky.
– Alex Riquelme
Jan 22 at 0:48
Some are some are not GCP. For the GCP, when I create a vm can i give it a higher and lower range?
– user1871528
Jan 22 at 1:55
@user1871528 the IP is set randomly in your GCP instance, but you can set that IP to be static and will not change. Also, in your FW rule you can add all the IPs of your GCP instances one by one.
– Alex Riquelme
Jan 24 at 11:15
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54263745%2fhow-to-connect-to-psql-on-google-vm-instance%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The firewall rule is really insecure (you are allowing everyone on internet to connect to your GCE instance using all the ports) and maybe another firewall rule is blocking this rule due to the priority is really low (the greater the priority number is, the lower priority has). Did you follow this tutorial? once you add listen_addresses = '*'
, you need to restart your PostgreSQL service with sudo service postgresql restart
.
Also, you need to create 2 firewall rules, one for ingress and another one for egress. Both to accept traffic to tcp:5432
, can you please create 2 firewall rules with more priority that accepts traffic from that port with a smaller IP range?
Thanks this helped. The only question I have is with the range of the IP access. we use different VMS (that might come and go into existence) as our IP address. How can I allow for them to have access if the ips are changing and I dont have listen_addresses = '*'?
– user1871528
Jan 21 at 22:34
@user1871528 those VMs are local VMs or GCE instances? if are GCE instances, you can reserve static IPs for free to use them in your GCE instances. If not... It's much complicated and costly. However, you can use 0.0.0.0/0 as you had, but it's a bit risky.
– Alex Riquelme
Jan 22 at 0:48
Some are some are not GCP. For the GCP, when I create a vm can i give it a higher and lower range?
– user1871528
Jan 22 at 1:55
@user1871528 the IP is set randomly in your GCP instance, but you can set that IP to be static and will not change. Also, in your FW rule you can add all the IPs of your GCP instances one by one.
– Alex Riquelme
Jan 24 at 11:15
add a comment |
The firewall rule is really insecure (you are allowing everyone on internet to connect to your GCE instance using all the ports) and maybe another firewall rule is blocking this rule due to the priority is really low (the greater the priority number is, the lower priority has). Did you follow this tutorial? once you add listen_addresses = '*'
, you need to restart your PostgreSQL service with sudo service postgresql restart
.
Also, you need to create 2 firewall rules, one for ingress and another one for egress. Both to accept traffic to tcp:5432
, can you please create 2 firewall rules with more priority that accepts traffic from that port with a smaller IP range?
Thanks this helped. The only question I have is with the range of the IP access. we use different VMS (that might come and go into existence) as our IP address. How can I allow for them to have access if the ips are changing and I dont have listen_addresses = '*'?
– user1871528
Jan 21 at 22:34
@user1871528 those VMs are local VMs or GCE instances? if are GCE instances, you can reserve static IPs for free to use them in your GCE instances. If not... It's much complicated and costly. However, you can use 0.0.0.0/0 as you had, but it's a bit risky.
– Alex Riquelme
Jan 22 at 0:48
Some are some are not GCP. For the GCP, when I create a vm can i give it a higher and lower range?
– user1871528
Jan 22 at 1:55
@user1871528 the IP is set randomly in your GCP instance, but you can set that IP to be static and will not change. Also, in your FW rule you can add all the IPs of your GCP instances one by one.
– Alex Riquelme
Jan 24 at 11:15
add a comment |
The firewall rule is really insecure (you are allowing everyone on internet to connect to your GCE instance using all the ports) and maybe another firewall rule is blocking this rule due to the priority is really low (the greater the priority number is, the lower priority has). Did you follow this tutorial? once you add listen_addresses = '*'
, you need to restart your PostgreSQL service with sudo service postgresql restart
.
Also, you need to create 2 firewall rules, one for ingress and another one for egress. Both to accept traffic to tcp:5432
, can you please create 2 firewall rules with more priority that accepts traffic from that port with a smaller IP range?
The firewall rule is really insecure (you are allowing everyone on internet to connect to your GCE instance using all the ports) and maybe another firewall rule is blocking this rule due to the priority is really low (the greater the priority number is, the lower priority has). Did you follow this tutorial? once you add listen_addresses = '*'
, you need to restart your PostgreSQL service with sudo service postgresql restart
.
Also, you need to create 2 firewall rules, one for ingress and another one for egress. Both to accept traffic to tcp:5432
, can you please create 2 firewall rules with more priority that accepts traffic from that port with a smaller IP range?
answered Jan 21 at 11:09
Alex RiquelmeAlex Riquelme
56129
56129
Thanks this helped. The only question I have is with the range of the IP access. we use different VMS (that might come and go into existence) as our IP address. How can I allow for them to have access if the ips are changing and I dont have listen_addresses = '*'?
– user1871528
Jan 21 at 22:34
@user1871528 those VMs are local VMs or GCE instances? if are GCE instances, you can reserve static IPs for free to use them in your GCE instances. If not... It's much complicated and costly. However, you can use 0.0.0.0/0 as you had, but it's a bit risky.
– Alex Riquelme
Jan 22 at 0:48
Some are some are not GCP. For the GCP, when I create a vm can i give it a higher and lower range?
– user1871528
Jan 22 at 1:55
@user1871528 the IP is set randomly in your GCP instance, but you can set that IP to be static and will not change. Also, in your FW rule you can add all the IPs of your GCP instances one by one.
– Alex Riquelme
Jan 24 at 11:15
add a comment |
Thanks this helped. The only question I have is with the range of the IP access. we use different VMS (that might come and go into existence) as our IP address. How can I allow for them to have access if the ips are changing and I dont have listen_addresses = '*'?
– user1871528
Jan 21 at 22:34
@user1871528 those VMs are local VMs or GCE instances? if are GCE instances, you can reserve static IPs for free to use them in your GCE instances. If not... It's much complicated and costly. However, you can use 0.0.0.0/0 as you had, but it's a bit risky.
– Alex Riquelme
Jan 22 at 0:48
Some are some are not GCP. For the GCP, when I create a vm can i give it a higher and lower range?
– user1871528
Jan 22 at 1:55
@user1871528 the IP is set randomly in your GCP instance, but you can set that IP to be static and will not change. Also, in your FW rule you can add all the IPs of your GCP instances one by one.
– Alex Riquelme
Jan 24 at 11:15
Thanks this helped. The only question I have is with the range of the IP access. we use different VMS (that might come and go into existence) as our IP address. How can I allow for them to have access if the ips are changing and I dont have listen_addresses = '*'?
– user1871528
Jan 21 at 22:34
Thanks this helped. The only question I have is with the range of the IP access. we use different VMS (that might come and go into existence) as our IP address. How can I allow for them to have access if the ips are changing and I dont have listen_addresses = '*'?
– user1871528
Jan 21 at 22:34
@user1871528 those VMs are local VMs or GCE instances? if are GCE instances, you can reserve static IPs for free to use them in your GCE instances. If not... It's much complicated and costly. However, you can use 0.0.0.0/0 as you had, but it's a bit risky.
– Alex Riquelme
Jan 22 at 0:48
@user1871528 those VMs are local VMs or GCE instances? if are GCE instances, you can reserve static IPs for free to use them in your GCE instances. If not... It's much complicated and costly. However, you can use 0.0.0.0/0 as you had, but it's a bit risky.
– Alex Riquelme
Jan 22 at 0:48
Some are some are not GCP. For the GCP, when I create a vm can i give it a higher and lower range?
– user1871528
Jan 22 at 1:55
Some are some are not GCP. For the GCP, when I create a vm can i give it a higher and lower range?
– user1871528
Jan 22 at 1:55
@user1871528 the IP is set randomly in your GCP instance, but you can set that IP to be static and will not change. Also, in your FW rule you can add all the IPs of your GCP instances one by one.
– Alex Riquelme
Jan 24 at 11:15
@user1871528 the IP is set randomly in your GCP instance, but you can set that IP to be static and will not change. Also, in your FW rule you can add all the IPs of your GCP instances one by one.
– Alex Riquelme
Jan 24 at 11:15
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54263745%2fhow-to-connect-to-psql-on-google-vm-instance%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown