예제 #1
0
파일: Program.cs 프로젝트: DaveCS1/SimpleS3
        private static async Task Main(string[] args)
        {
            //
            // Go here and login with your account to create an access key: https://console.aws.amazon.com/iam/home?#/security_credentials
            //

            //Uncomment this line if you want to use it against your own bucket
            using (S3Client client = SimpleClient.Create("MyKeyId", "MyAccessKey", AwsRegion.UsEast1))
            {
                const string bucketName = "simple-s3-test";
                const string objectName = "some-object";

                //First we create the a bucket named "simple-s3-test". It might already be there, so we ignore if the request was not a success
                await client.CreateBucketAsync(bucketName).ConfigureAwait(false);

                //Upload and download an object using the normal API
                await UploadDownloadWithNormalApi(client, bucketName, objectName).ConfigureAwait(false);

                //Upload and download an object using the fluent API
                await UploadDownloadWithFluent(client, bucketName, objectName).ConfigureAwait(false);
            }
        }