aws-sdk-net

S3 access using aws-sdk-net

To use aws-sdk-net (awssdk.core >= 3.3.22.3) with CROC Cloud, go through the next steps:

  1. Download credentials for your cloud account;
  2. Init environment variables with cloud account credentials;
  3. Create .net project and add packages AWSSDK.Core and AWSSDK.S3` from AWS documentation to it;
  4. Add file endpoints.json to the project and set Copy to Output Directory: Copy always to this file, or place it to buildout directory.
endpoints.json
{
  "endpoints": {
    "croc/s3": {
      "endpoint": "storage.cloud.{region}.ru",
      "auth-region": "croc"
    },
    "croc/ec2": {
      "endpoint": "monitoring.cloud.{region}.ru",
      "auth-region": "croc"
    },
    "croc/monitoring": {
      "endpoint": "api.cloud.{region}.ru"
    }
  },
  "partitions": [
    {
      "defaults": {
        "protocols": [ "https" ],
        "signatureVersions": [ "v4" ]
      },
      "dnsSuffix": "cloud.croc.ru",
      "partition": "croc",
      "partitionName": "CROC Cloud",
      "regionRegex": "^croc$",
      "regions": {
        "croc": {
          "description": "Main CROC Cloud region"
        }
      },
      "services": {
        "ec2": {
          "defaults": {
            "hostname": "api.cloud.{region}.ru",
            "protocols": [ "http", "https" ]
          },
          "endpoints": {
            "croc": {}
          }
        },
        "monitoring": {
          "defaults": {
            "hostname": "monitoring.cloud.{region}.ru",
            "protocols": [ "http", "https" ]
          },
          "endpoints": {
            "croc": {}
          }
        },
        "s3": {
          "defaults": {
            "hostname": "storage.cloud.{region}.ru",
            "protocols": [ "http", "https" ],
            "signatureVersions": [ "s3", "s3v4" ]
          },
          "endpoints": {
            "croc": {}
          }
        }
      }
    }
  ],
  "version": 3
}
  1. Add aws section to App.config file:
App.config
<aws region="croc"/>
  1. Create api client:
Program.cs
var client = new AmazonS3Client();