From c080b39e470913367f7e12a08a8c27e2706dd32e Mon Sep 17 00:00:00 2001 From: Dmitry Deniskin <110819396+ddeniskin@users.noreply.github.com> Date: Thu, 15 Sep 2022 17:04:34 +0200 Subject: [PATCH] s3: add support for IONOS Cloud Storage --- README.md | 1 + backend/s3/s3.go | 43 ++++++++++- docs/content/_index.md | 1 + docs/content/s3.md | 164 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 205 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 7f2302f89..6c0e35752 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ Rclone *("rsync for cloud storage")* is a command-line program to sync files and * Internet Archive [:page_facing_up:](https://rclone.org/internetarchive/) * Jottacloud [:page_facing_up:](https://rclone.org/jottacloud/) * IBM COS S3 [:page_facing_up:](https://rclone.org/s3/#ibm-cos-s3) + * IONOS Cloud [:page_facing_up:](https://rclone.org/s3/#ionos) * Koofr [:page_facing_up:](https://rclone.org/koofr/) * Mail.ru Cloud [:page_facing_up:](https://rclone.org/mailru/) * Memset Memstore [:page_facing_up:](https://rclone.org/swift/) diff --git a/backend/s3/s3.go b/backend/s3/s3.go index 7b3a81a29..25257bb85 100644 --- a/backend/s3/s3.go +++ b/backend/s3/s3.go @@ -64,7 +64,7 @@ import ( func init() { fs.Register(&fs.RegInfo{ Name: "s3", - Description: "Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi", + Description: "Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi", NewFs: NewFs, CommandHelp: commandHelp, Config: func(ctx context.Context, name string, m configmap.Mapper, config fs.ConfigIn) (*fs.ConfigOut, error) { @@ -116,6 +116,9 @@ func init() { }, { Value: "IDrive", Help: "IDrive e2", + }, { + Value: "IONOS", + Help: "IONOS Cloud", }, { Value: "LyveCloud", Help: "Seagate Lyve Cloud", @@ -384,10 +387,24 @@ func init() { Value: "auto", Help: "R2 buckets are automatically distributed across Cloudflare's data centers for low latency.", }}, + }, { + Name: "region", + Help: "Region where your bucket will be created and your data stored.\n", + Provider: "IONOS", + Examples: []fs.OptionExample{{ + Value: "de", + Help: "Frankfurt, Germany", + }, { + Value: "eu-central-2", + Help: "Berlin, Germany", + }, { + Value: "eu-south-2", + Help: "Logrono, Spain", + }}, }, { Name: "region", Help: "Region to connect to.\n\nLeave blank if you are using an S3 clone and you don't have a region.", - Provider: "!AWS,Alibaba,ChinaMobile,Cloudflare,ArvanCloud,RackCorp,Scaleway,Storj,TencentCOS,HuaweiOBS,IDrive", + Provider: "!AWS,Alibaba,ChinaMobile,Cloudflare,IONOS,ArvanCloud,RackCorp,Scaleway,Storj,TencentCOS,HuaweiOBS,IDrive", Examples: []fs.OptionExample{{ Value: "", Help: "Use this if unsure.\nWill use v4 signatures and an empty region.", @@ -698,6 +715,20 @@ func init() { Value: "s3.private.sng01.cloud-object-storage.appdomain.cloud", Help: "Singapore Single Site Private Endpoint", }}, + }, { + Name: "endpoint", + Help: "Endpoint for IONOS S3 Object Storage.\n\nSpecify the endpoint from the same region.", + Provider: "IONOS", + Examples: []fs.OptionExample{{ + Value: "s3-eu-central-1.ionoscloud.com", + Help: "Frankfurt, Germany", + }, { + Value: "s3-eu-central-2.ionoscloud.com", + Help: "Berlin, Germany", + }, { + Value: "s3-eu-south-2.ionoscloud.com", + Help: "Logrono, Spain", + }}, }, { // oss endpoints: https://help.aliyun.com/document_detail/31837.html Name: "endpoint", @@ -1001,7 +1032,7 @@ func init() { }, { Name: "endpoint", Help: "Endpoint for S3 API.\n\nRequired when using an S3 clone.", - Provider: "!AWS,IBMCOS,IDrive,TencentCOS,HuaweiOBS,Alibaba,ChinaMobile,ArvanCloud,Scaleway,StackPath,Storj,RackCorp", + Provider: "!AWS,IBMCOS,IDrive,IONOS,TencentCOS,HuaweiOBS,Alibaba,ChinaMobile,ArvanCloud,Scaleway,StackPath,Storj,RackCorp", Examples: []fs.OptionExample{{ Value: "objects-us-east-1.dream.io", Help: "Dream Objects endpoint", @@ -1411,7 +1442,7 @@ func init() { }, { Name: "location_constraint", Help: "Location constraint - must be set to match the Region.\n\nLeave blank if not sure. Used when creating buckets only.", - Provider: "!AWS,IBMCOS,IDrive,Alibaba,HuaweiOBS,ChinaMobile,Cloudflare,ArvanCloud,RackCorp,Scaleway,StackPath,Storj,TencentCOS", + Provider: "!AWS,Alibaba,HuaweiOBS,ChinaMobile,Cloudflare,IBMCOS,IDrive,IONOS,ArvanCloud,RackCorp,Scaleway,StackPath,Storj,TencentCOS", }, { Name: "acl", Help: `Canned ACL used when creating buckets and storing or copying objects. @@ -2537,6 +2568,10 @@ func setQuirks(opt *Options) { useMultipartEtag = false // untested case "IDrive": virtualHostStyle = false + case "IONOS": + // listObjectsV2 supported - https://api.ionos.com/docs/s3/#Basic-Operations-get-Bucket-list-type-2 + virtualHostStyle = false + urlEncodeListings = false case "LyveCloud": useMultipartEtag = false // LyveCloud seems to calculate multipart Etags differently from AWS case "Minio": diff --git a/docs/content/_index.md b/docs/content/_index.md index 9d0f86bf4..98bcd5784 100644 --- a/docs/content/_index.md +++ b/docs/content/_index.md @@ -135,6 +135,7 @@ WebDAV or S3, that work out of the box.) {{< provider name="Jottacloud" home="https://www.jottacloud.com/en/" config="/jottacloud/" >}} {{< provider name="IBM COS S3" home="http://www.ibm.com/cloud/object-storage" config="/s3/#ibm-cos-s3" >}} {{< provider name="IDrive e2" home="https://www.idrive.com/e2/" config="/s3/#idrive-e2" >}} +{{< provider name="IONOS Cloud" home="https://cloud.ionos.com/storage/object-storage" config="/s3/#ionos" >}} {{< provider name="Koofr" home="https://koofr.eu/" config="/koofr/" >}} {{< provider name="Mail.ru Cloud" home="https://cloud.mail.ru/" config="/mailru/" >}} {{< provider name="Memset Memstore" home="https://www.memset.com/cloud/storage/" config="/swift/" >}} diff --git a/docs/content/s3.md b/docs/content/s3.md index d09dd3592..e8b10aae5 100644 --- a/docs/content/s3.md +++ b/docs/content/s3.md @@ -19,6 +19,7 @@ The S3 backend can be used with a number of different providers: {{< provider name="Huawei OBS" home="https://www.huaweicloud.com/intl/en-us/product/obs.html" config="/s3/#huawei-obs" >}} {{< provider name="IBM COS S3" home="http://www.ibm.com/cloud/object-storage" config="/s3/#ibm-cos-s3" >}} {{< provider name="IDrive e2" home="https://www.idrive.com/e2/" config="/s3/#idrive-e2" >}} +{{< provider name="IONOS Cloud" home="https://cloud.ionos.com/storage/object-storage" config="/s3/#ionos" >}} {{< provider name="Minio" home="https://www.minio.io/" config="/s3/#minio" >}} {{< provider name="RackCorp Object Storage" home="https://www.rackcorp.com/" config="/s3/#RackCorp" >}} {{< provider name="Scaleway" home="https://www.scaleway.com/en/object-storage/" config="/s3/#scaleway" >}} @@ -3533,6 +3534,169 @@ d) Delete this remote y/e/d> y ``` +### IONOS Cloud {#ionos} + +[IONOS S3 Object Storage](https://cloud.ionos.com/storage/object-storage) is a service offered by IONOS for storing and accessing unstructured data. +To connect to the service, you will need an access key and a secret key. These can be found in the [Data Center Designer](https://dcd.ionos.com/), by selecting **Manager resources** > **Object Storage Key Manager**. + + +Here is an example of a configuration. First, run `rclone config`. This will walk you through an interactive setup process. Type `n` to add the new remote, and then enter a name: + +``` +Enter name for new remote. +name> ionos-fra +``` + +Type `s3` to choose the connection type: +``` +Option Storage. +Type of storage to configure. +Choose a number from below, or type in your own value. +[snip] +XX / Amazon S3 Compliant Storage Providers including AWS, Alibaba, Ceph, China Mobile, Cloudflare, ArvanCloud, Digital Ocean, Dreamhost, Huawei OBS, IBM COS, IDrive e2, IONOS Cloud, Lyve Cloud, Minio, Netease, RackCorp, Scaleway, SeaweedFS, StackPath, Storj, Tencent COS and Wasabi + \ (s3) +[snip] +Storage> s3 +``` + +Type `IONOS`: +``` +Option provider. +Choose your S3 provider. +Choose a number from below, or type in your own value. +Press Enter to leave empty. +[snip] +XX / IONOS Cloud + \ (IONOS) +[snip] +provider> IONOS +``` + +Press Enter to choose the default option `Enter AWS credentials in the next step`: +``` +Option env_auth. +Get AWS credentials from runtime (environment variables or EC2/ECS meta data if no env vars). +Only applies if access_key_id and secret_access_key is blank. +Choose a number from below, or type in your own boolean value (true or false). +Press Enter for the default (false). + 1 / Enter AWS credentials in the next step. + \ (false) + 2 / Get AWS credentials from the environment (env vars or IAM). + \ (true) +env_auth> +``` + +Enter your Access Key and Secret key. These can be retrieved in the [Data Center Designer](https://dcd.ionos.com/), click on the menu “Manager resources” / "Object Storage Key Manager". +``` +Option access_key_id. +AWS Access Key ID. +Leave blank for anonymous access or runtime credentials. +Enter a value. Press Enter to leave empty. +access_key_id> YOUR_ACCESS_KEY + +Option secret_access_key. +AWS Secret Access Key (password). +Leave blank for anonymous access or runtime credentials. +Enter a value. Press Enter to leave empty. +secret_access_key> YOUR_SECRET_KEY +``` + +Choose the region where your bucket is located: +``` +Option region. +Region where your bucket will be created and your data stored. +Choose a number from below, or type in your own value. +Press Enter to leave empty. + 1 / Frankfurt, Germany + \ (de) + 2 / Berlin, Germany + \ (eu-central-2) + 3 / Logrono, Spain + \ (eu-south-2) +region> 2 +``` + +Choose the endpoint from the same region: +``` +Option endpoint. +Endpoint for IONOS S3 Object Storage. +Specify the endpoint from the same region. +Choose a number from below, or type in your own value. +Press Enter to leave empty. + 1 / Frankfurt, Germany + \ (s3-eu-central-1.ionoscloud.com) + 2 / Berlin, Germany + \ (s3-eu-central-2.ionoscloud.com) + 3 / Logrono, Spain + \ (s3-eu-south-2.ionoscloud.com) +endpoint> 1 +``` + +Press Enter to choose the default option or choose the desired ACL setting: +``` +Option acl. +Canned ACL used when creating buckets and storing or copying objects. +This ACL is used for creating objects and if bucket_acl isn't set, for creating buckets too. +For more info visit https://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl +Note that this ACL is applied when server-side copying objects as S3 +doesn't copy the ACL from the source but rather writes a fresh one. +Choose a number from below, or type in your own value. +Press Enter to leave empty. + / Owner gets FULL_CONTROL. + 1 | No one else has access rights (default). + \ (private) + / Owner gets FULL_CONTROL. +[snip] +acl> +``` + +Press Enter to skip the advanced config: +``` +Edit advanced config? +y) Yes +n) No (default) +y/n> +``` + +Press Enter to save the configuration, and then `q` to quit the configuration process: +``` +Configuration complete. +Options: +- type: s3 +- provider: IONOS +- access_key_id: YOUR_ACCESS_KEY +- secret_access_key: YOUR_SECRET_KEY +- endpoint: s3-eu-central-1.ionoscloud.com +Keep this "ionos-fra" remote? +y) Yes this is OK (default) +e) Edit this remote +d) Delete this remote +y/e/d> y +``` + +Done! Now you can try some commands (for macOS, use `./rclone` instead of `rclone`). + +1) Create a bucket (the name must be unique within the whole IONOS S3) +``` +rclone mkdir ionos-fra:my-bucket +``` +2) List available buckets +``` +rclone lsd ionos-fra: +``` +4) Copy a file from local to remote +``` +rclone copy /Users/file.txt ionos-fra:my-bucket +``` +3) List contents of a bucket +``` +rclone ls ionos-fra:my-bucket +``` +5) Copy a file from remote to local +``` +rclone copy ionos-fra:my-bucket/file.txt +``` + ### Minio [Minio](https://minio.io/) is an object storage server built for cloud application developers and devops.