If you are an existing Infura IPFS user or are currently self-hosting your data and want to migrate to the new Infura IPFS service, this tutorial is your step-by-step guide.
The new Infura IPFS service is more reliable, performant and comes with a bunch of exciting features:
- A project dashboard with all the essential stats (usage, storage size, etc.)
- Pinning/Unpinning API
- Regular background publishing of your files to the rest of the IPFS P2P network, so your content is accessible globally
Step 1 - Create your Infura IPFS Project
Register for a new account at https://infura.io (if you don't have one already), and set up your IPFS project following the instructions.
After the registration, you will be redirected to the settings page, where you find your credentials: PROJECT_ID + PROJECT_SECRET.
Step 2 - Install the
Download the pre-compiled binary based on your operating system from the Github Release v1.0.0.
Alternatively, you can build it from scratch with Go tools.
go install github.com/INFURA/ipfs-copy/cmd/ipfs-copy@latest
Or clone the source code manually and compile it:
git clone https://github.com/INFURA/ipfs-copy.git cd ipfs-copy make install
Verify the installation:
ipfs-copy version > ipfs-copy version: 1.0.0
For the next step, you have two options depending on whether you want to pin existing Infura hosted data to your project or migrate data from a different IPFS node.
Step 3 - Migrate data
How to pin IPFS data already hosted by Infura
If you want to pin only a handful of CIDs, you can manually use the standard IPFS API with extra authentication for the Infura IPFS service.
Here is an API pinning call example using cURL:
curl -X POST -u "YOUR_PROJECT_ID:YOUR_PROJECT_SECRET" "https://ipfs.infura.org:5001/api/v0/pin/add?arg=YOUR_IPFS_CID"
If you have tens/hundreds or even thousands of CIDs, you can put them all in a single file and run the
Create a file containing IPFS CIDs separated by a line-break character \n.
QmaEZGiDrS7kDXMxbmpamrX1sPHZUM61a3YpjDoyaC3yfJ QmTeRJXx623WwsoDk4371kh3JKCjoDcoWrqrhY9ekRasjE QmUsQxC5bsgX53WhQ11DkxyB4uPYLEpdgmidFhGgUFK5aK
ipfs-copy command will read your file with all the IPFS CIDs and pin them to your Infura IPFS project in parallel with multiple workers for optimal performance.
ipfs-copy --cids=/home/xxx/Documents/ipfs-cids.txt --project-id=<YOUR_PROJECT_ID> --project-secret=<YOUR_PROJECT_SECRET>
How to migrate data from another node
If you currently store your data on a self-hosted IPFS node, you can migrate too! Focus on your business and let Infura handle all the IPFS infrastructure and monitoring.
ipfs-copy command will iterate all pins from the source node, copy the blocks, and pin them to your Infura IPFS project.
ipfs-copy --source-api-url=http://localhost:5001 --project-id=<YOUR_PROJECT_ID> --project-secret=<YOUR_PROJECT_SECRET>
Done! You have completed the migration to the new IPFS service!
Open your Infura project's dashboard and review all the data, their size, or usage.