Running IPFS on Google Compute Engine instance


I’m trying to run IPFS on a Google Compute Engine Instance. I already installed the linux prebuilt package but, when I first started the daemon I was not able to access the gateway but I fixed it by opening the 5001 tcp and udp ports but it don’t connect to any node.

I tried by opening the following ports I found in another thread IPFS ports firewall

TCP 4001 5001 8080 8081
UDP 4002/udp

I’m also seeing that the fields Peer ID, Location, Agent Version, Protocol Version, Public Key are empty in the webui

I’m working on a small project and I’m trying to make it visible for a small presentation and it will be great if I can run it on a VM to make the public interact with it

could you precise OS version and ipfs version

could try to run ipfs init


I’m running IPFS 0.4.13 over Ubuntu 16.04

This is the full uname -a output

Linux instance-1 4.10.0-38-generic #42~16.04.1-Ubuntu SMP Tue Oct 10 16:32:20 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

could you see your ipfs config ? ipfs config show

This is my config

  "API": {
    "HTTPHeaders": null
  "Addresses": {
    "API": "/ip4/",
    "Announce": [],
    "Gateway": "/ip4/",
    "NoAnnounce": [],
    "Swarm": [
  "Bootstrap": [
  "Reprovider": {
  "Datastore": {
    "BloomFilterSize": 0,
    "GCPeriod": "1h",
    "HashOnRead": false,
    "Spec": {
      "mounts": [
          "child": {
            "path": "blocks",
            "shardFunc": "/repo/flatfs/shard/v1/next-to-last/2",
            "sync": true,
            "type": "flatfs"
          "mountpoint": "/blocks",
          "prefix": "flatfs.datastore",
          "type": "measure"
          "child": {
            "compression": "none",
            "path": "datastore",
            "type": "levelds"
          "mountpoint": "/",
          "prefix": "leveldb.datastore",
          "type": "measure"
      "type": "mount"
    "StorageGCWatermark": 90,
    "StorageMax": "10GB"
  "Discovery": {
    "MDNS": {
      "Enabled": true,
      "Interval": 10
  "Experimental": {
    "FilestoreEnabled": false,
    "Libp2pStreamMounting": false,
    "ShardingEnabled": false
  "Gateway": {
    "HTTPHeaders": {
      "Access-Control-Allow-Headers": [
      "Access-Control-Allow-Methods": [
      "Access-Control-Allow-Origin": [
    "PathPrefixes": [],
    "RootRedirect": "",
    "Writable": false
  "Identity": {
    "PeerID": "QmYYSD3GP88wwMo9MTjM3vze8KR5p4AJfGVkSfUgCQZGqs"
  "Ipns": {
    "RecordLifetime": "",
    "RepublishPeriod": "",
    "ResolveCacheSize": 128
  "Mounts": {
    "FuseAllowOther": false,
    "IPFS": "/ipfs",
    "IPNS": "/ipns"
  "Reprovider": {
    "Interval": "12h",
    "Strategy": "all"
  "Swarm": {
    "AddrFilters": null,
    "ConnMgr": {
      "GracePeriod": "20s",
      "HighWater": 900,
      "LowWater": 600,
      "Type": "basic"
    "DisableBandwidthMetrics": false,
    "DisableNatPortMap": false,
    "DisableRelay": false,
    "EnableRelayHop": false

do you check firewall on GCE :

I opened all ports (incoming and outgoing) on the instance but it can’t connect

in your navigator javascript console do you have javascript error ?

yes, I opened inspector and it is showing this error on file ipfs-webui.0.3.0.js:12:31024

SyntaxError: JSON.parse: unexpected non-whitespace character after JSON data at line 1 column 5 of the JSON data
Stack trace:

intresting maybe you can poste this issue on github

Issue here:

However, this doesn’t look like a bug. It looks like a CORS issue. Solution here:

Standard warning: Whatever you do, please do not leave the API exposed on the public internet.

1 Like

Hi, I am trying to upload a file to the IPFS node which is running in GCP, CentOS 7 (using js-ipfs).

this.ipfsApi = ipfsAPI(‘localhost’, ‘5001’) - works fine
this.ipfsApi = ipfsAPI(‘GCP Instance’s IP’, ‘5001’) - does not work and it says connection refused. I have allowed all ports actually, but still no luck reaching out to this.

I want to upload the files from my client to the remote node, without using the local node. Any help would be greatly appreciated.

Thanks in advance.