How to get buckets count in aws ( Amazon Web Services ) using C# in ASP.Net

Last Reply on Jun 16, 2017 11:58 PM By Babloo18v

Posted on Jun 16, 2017 02:40 AM

Guys how do i know how many buckets are there in amazon web services..?? Using c# i have access id , secret key , i need to get the list of buckets in aws 


please help??

Posted on Jun 16, 2017 11:58 PM


using (IAmazonS3 client = new AmazonS3Client(awsAccessKeyID,awsSecretAccessKEy, Amazon.RegionEndpoint.USEast1))
    ListBucketsResponse response = client.ListBuckets();
    List<S3Bucket> buckets = response.Buckets;
    foreach (S3Bucket bucket in buckets)
         Console.WriteLine("Found bucket name {0} created at {1}", bucket.BucketName, bucket.CreationDate);

This returns the buckets list in aws..

We can check how many buckets are present in aws...

Hope it helps.