1
0
mirror of https://github.com/oceanprotocol/docs.git synced 2024-11-26 19:49:26 +01:00
docs/using-ocean-market/asset-hosting.md
mariacarmina 57b9b512db
Remove drives. Added section for AWS. (#1145)
* Remove drives. Added section for AWS.

* Fix AWS section.

* Finished step 1. Began step 2 for AWS S3 bucket hosting.

* Finished hosting asset on AWS using S3 bucket storage.

* Resolved requested changes for text part.

* Deleted one drive screenshots.

* Refactored screenshot with the file.

* Updated images.

* Moved images for hosting services into using ocean market images folder. Moved asset hosting tutorial into using ocean market folder as well.
2022-10-31 13:54:40 +02:00

7.7 KiB

title description
Publish assets using hosting services Tutorial to publish assets using hosting services like AWS and Azure.

Publishing with Hosting Services

Overview

To publish assets on the Ocean Marketplace, publishers must provide a link(an URL) to the file. It is up to the asset publisher to decide where to host the asset. For example, a publisher can store the content on their AWS server, private cloud server, or other third-party hosting services. Through publishing, the URL of the asset is encrypted and stored as a part of DDO on the blockchain. Buyers don't have access directly to the URL, but they interact with the Provider, which decrypts the URL and acts as a proxy to serve the asset. The DDO only stores the location of the file, which is accessed on-demand by the Provider. Implementing a security policy that allows only the Provider to access the URL and blocks requests from other unauthorized actors is recommended. One of the possible ways to achieve this is to allow only the Provider's IP address to access the URL. But, not all hosting services provide this feature. So, the publishers must consider the security features while choosing a hosting service.

On Ocean Marketplace, a publisher must provide the link to the asset during publish step in the field shown in the below image.

Publish - File URL field

Hosting services

Publishers can choose any hosting service of their choice. The below section explains how to use commonly used hosting services with Ocean Marketplace.

Please use a proper hosting solution to keep your files. When using other systems (for example, Google Drive) that are not specifically designed for this use case, you risk not gaining traction. Systems such as Google Drive, include various virus checks and rate limiters that prevent the Provider to download the asset once it was purchased.

AWS

AWS provides various options to host data and multiple configuration possibilities. Publishers are required to do their research and decide what would be the right choice. The below steps provide one of the possible ways to host data using AWS S3 bucket and publish it on Ocean Marketplace.

Prerequisite

Create an account on AWS. Users might also be asked to provide payment details and billing addresses that are out of this tutorial's scope.

Step 1 - Create a storage account

Go to AWS portal

Go to the AWS portal for S3: https://aws.amazon.com/s3/ and select from the upper right corner Create an AWS account as shown below.

Create an account - 1

Fill in the details

Create an account - 2)

Create a bucket

After logging into the new account, search for the available services and select S3 type of storage.

Create an account - 3

In order to create a S3 bucket, choose Create bucket.

Create an account - 4

Fill in the form with the necessary information. Then, the bucket is up & running.

Create an account - 5

Step 2 - Upload asset on S3 bucket

Now, the asset can be uploaded by selecting the bucket name and choose Upload in the Objects tab.

Upload asset on S3 bucket - 1

Add files to the bucket

Get the files and add them to the bucket.

The file is an example used in multiple Ocean repositories, and it can be found here.

Upload asset on S3 bucket - 3

The permissions and properties can be set afterwards, for the moment keep them as default.

After selecting Upload, make sure that the status is Succeeded.

Upload asset on S3 bucket - 4

Step 3 - Access the Object URL on S3 Bucket

By default, the permissions of accessing the file from S3 bucket are set to private. To publish an asset on the market, the S3 URL needs to be public. This step shows how to set up access control policies to grant permissions to others.

Editing permissions

Go to the Permissions tab and select Edit and then uncheck Block all public access boxes to give everyone read access to the object and click Save.

If editing the permissions is unavailable, modify the Object Ownership by enabling the ACLs as shown below.

Access the Object URL on S3 Bucket - 1

Modifying bucket policy

In order to have the bucket granted on public access, its policy needs to be modified likewise.

Note that the <BUCKET-NAME> must be chosen from personal buckets' dashboard.

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "Public S3 Bucket",
            "Principal": "*",
            "Effect": "Allow",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::<BUCKET-NAME>/*"
        }
    ]
}

After saving the changes, the bucket should appear as Public access.

Access the Object URL on S3 Bucket - 2

Verify the object URL on public access

Select the file from the bucket that needs verification and select Open. Now it should be able to download the file on personal system.

Access the Object URL on S3 Bucket - 3

Step 4 - Get the S3 Bucket Link & Publish Asset on Market

Now that the S3 endpoint has public access, the asset will be hosted successfully.

Go to Ocean Market to complete the form for asset creation.

Copy the Object URL that can be found at Object Overview from AWS S3 bucket and paste it in the File field from the form found at step 2 as it is illustrated below.

Get the S3 Bucket Link & Publish Asset on Market - 1

Azure storage

Azure provides various options to host data and multiple configuration possibilities. Publishers are required to do their research and decide what would be the right choice. The below steps provide one of the possible ways to host data using Azure storage and publish it on Ocean Marketplace.

Prerequisite

Create an account on Azure. Users might also be asked to provide payment details and billing addresses that are out of this tutorial's scope.

Step 1 - Create a storage account

Go to Azure portal

Go to the Azure portal: https://portal.azure.com/#home and select Storage accounts as shown below.

Create a storage account - 1

Create a new storage account

Create a storage account - 2

Fill in the details

Add details

Storage account created

Storage account created

Step 2 - Create a blob container

Create a blob container

Step 3 - Upload a file

Upload a file

Step 4 - Share the file

Select the file to be published and click Generate SAS

Click generate SAS

Configure the SAS details and click Generate SAS token and URL

Generate link to file

Copy the generated link

Copy the link

Step 5 - Publish the asset using the generated link

Now, copy and paste the link in the Publish page in the Ocean Marketplace.

Publish the file as an asset