Skip to Content
Hybrid Cloud for Developers
book

Hybrid Cloud for Developers

by Manoj Hirway
April 2018
Intermediate to advanced content levelIntermediate to advanced
280 pages
8h 37m
English
Packt Publishing
Content preview from Hybrid Cloud for Developers

Downloading files from the S3 bucket

Let's add a function to download the file from the S3 bucket:

static void downloadfile(){    try    {        IAmazonS3 s3Client = new AmazonS3Client();      /* create an S3 client object */        GetObjectRequest request = new GetObjectRequest()  /* create a request object */        {            BucketName = "packt-pub",                      /* parameters to the constructor */            Key = "myfile"                             };        using (GetObjectResponse response = s3Client.GetObject(request)) */ capture the response*/        {            string title = response.Metadata["x-amz-meta-title"];            Console.WriteLine("The title of the file is : {0}", title);            /* set the location of the destination file */            string destination_file = "D:\\download\\downloaded_file";               if (!File.Exists(destination_file))             { response.WriteResponseStreamToFile(dest); ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Hybrid Cloud for Architects

Hybrid Cloud for Architects

Alok Shrivastwa
OpenStack: Building a Cloud Environment

OpenStack: Building a Cloud Environment

Alok Shrivastwa, Sunil Sarat, Kevin Jackson, Cody Bunch, Egle Sigler, Tony Campbell

Publisher Resources

ISBN: 9781788830874Supplemental Content