AWS SDK for .NET
The AWS SDK for NET
Getting started
- Create a service account.
- Assign the service account the roles required for your project. For more information about roles, see the Identity and Access Management documentation.
- Create a static access key.
Note
A service account is only allowed to view a list of buckets in the folder it was created in.
A service account can perform actions with objects in buckets that are created in folders different from the service account folder. To enable this, assign the service account roles for the appropriate folder or its bucket.
Installation
To install the AWS SDK for.NET, follow the instructions
Setup
-
Go to the
~/.aws/
directory (for macOS and Linux) orC:\Users\<username>\.aws\
(for Windows). -
Create a file named
credentials
with the credentials for Object Storage and copy the following information to it:[default] aws_access_key_id = <static_key_ID> aws_secret_access_key = <secret_key>
-
Create a file named
config
with the default region settings and copy the following information to it:[default] region=ru-central1
Note
Some apps designed to work with Amazon S3 do not allow you to specify the region; this is why Object Storage may also accept the
us-east-1
value.
Specifics
- The AWS SDK for .NET incorrectly handles lifecycle configurations that contain no rule description (ID). Make sure to add a description to each lifecycle rule.
- To access Object Storage, for example, when working with the
AmazonS3Config
class, use thes3.yandexcloud.net
address.
Code samples
To connect to Object Storage, use this code:
AmazonS3Config configsS3 = new AmazonS3Config {
ServiceURL = "https://s3.yandexcloud.net"
};
AmazonS3Client s3client = new AmazonS3Client(configsS3);