Unable to connect to my private network using ipfs-http-client?

js-ipfs is same as ipfs-http-client right ?
I have made a private network using my pc and an instance from aws
i want to add files onto this network, check nodes added in the swarm, etc

Here’s what i have done and what i get

const ipfsClient = require (“ipfs-http-client”)
//tried these two :
var ipfs = ipfsClient(’/ip4/’)
var ipfs = ipfsClient({ host: ‘’, port: ‘4001’, ‘api-path’: ‘/ipfs/api/v0’ })
ipfs.swarm.peers((err, peers) => {
ipfs.config.get((err, config) => {
if (err) {
throw err

Attaching output
terminal above shows the network running, and peers added to the swarm
terminal below shows the output of the code

js-ipfs-http-client is a smaller library than js-ipfs

  • js-ipfs is a full implementation of IPFS
  • js-ipfs-http-client is a smaller library that controls an IPFS node that is already running via its HTTP API.

(refer to https://docs.ipfs.io/reference/js/overview/)

You should run an ipfs daemon locally.
(refer to https://github.com/ipfs/js-ipfs-http-client)

var ipfsClient = require('ipfs-http-client')

// connect to ipfs daemon API server
var ipfs = ipfsClient('localhost', '5001', { protocol: 'http' }) // leaving out the arguments will default to these values

// or connect with multiaddr
var ipfs = ipfsClient('/ip4/')

// or using options
var ipfs = ipfsClient({ host: 'localhost', port: '5001', protocol: 'http' })

// or specifying a specific API path
var ipfs = ipfsClient({ host: '', port: '80', 'api-path': '/ipfs/api/v0' })

Can i not use it with my private network