Sunday, 18 May 2014

How to work with S3 using the AWS Toolkit in Visual Studio

This is another in a series of videos that I am producing for my YouTube channel HowDoYouDoStuff.


In this video, I am going to show you how to work with S3 using the AWS Toolkit in Visual Studio


You can read the transcript below.


HTML 5 Player



Transcript

Hi guys. I'm Phil Stirpe.

In this video, I am going to show you how to work with S3 using the AWS Toolkit in Visual Studio.

In an earlier video I showed you how to download and install the AWS Toolkit into Visual Studio.

But this video I just want to focus on how we can use the AWS toolkit to access S3 whilst working away in Visual Studio.

In that video I showed you how to configure visual studio to use an IAM user called Frank to connect to Amazon web services. That involved entering Frank’s access key and secret key.

Will now we know that Visual Studio is configured let’s focus on using S3.

This video I don’t want to focus on how we might use the SDK to interact with S3 programmatically. I just want to look at how we would carry out management tasks such as creating buckets, dragging files into buckets, and deleting buckets.

Some just going to try and create a new bucket by right clicking on the S3 node in the AWS Explorer.

Going to call it demobucket. The thing to be aware of the S3 is that bucket names need to be globally unique stop and I have a strong feeling that demobucket will have gone by now.

Now. That name is not available. So I could try adding in a hyphen to create demo-bucket but am pretty sure that name will have gone also.

All right let me try a prefix of qa to come up with a bucket named of qa-demo-bucket.

Now here we are getting a different error message. What is interesting is that I did create that bucket earlier and then delete it. But when recording and other video I earlier to perform the same task in Eclipse, I created a Pre-signed URL that granted access to that bucket for an hour and because of that, Amazon web services is preventing me from creating a bucket with that same name.

I’m going to have to come up with another bucket name. How about my-demo-bucket?

No. That name has gone also. This is getting a bit tedious.

Okay. Let’s go for aws-toolkit-demo-bucket.

While that’s a relief. There we have the bucket.

So that’s a task you might perform in Visual Studio as a developer. It’s not worth writing code to create a bucket. You just want to go ahead and create one.

Good luck with the naming.

Another task that you might want to perform in Visual Studio is to simply drag a file and drop into a bucket to work with.

Once again it’s not worth writing the code to achieve this, you just want to get the job done.

So let’s say I want to drag a file into my bucket.

What are can’t do, is simply drag a file from Windows Explorer end to a bucket node in AWS Explorer. That will simply open the file in Visual Studio.

What I need to do, is to open or browse the bucket in AWS Explorer by right clicking the bucket name and selecting Browse.

The S3 browse window opens and offers me a number of options that let me manage my folders.

One thing I can do, is drag a file from Windows Explorer into this S3 browse window in Visual Studio.

This results in the upload settings dialog appearing where I am asked a number of questions.

There are a couple of flavours of S3 including standard and reduced redundancy storage. If I wanted to upload my file into reduced redundancy storage then I simply need to check this box. I could also request that my file be encrypted at rest. In other words whilst stored in S3.

I’m also able to specify that the file is publicly readable. I don’t want to do that.

If I click on the Permissions tab you can see that there are no permissions granted on this file

If I chose, I could add permissions in via this window which would result in an access control list or ACL. I would still probably want to create some IAM policies.

I don’t want to manage permissions from here. I would want to do that elsewhere. For example the AWS console.

So I’m just going to go ahead and click OK.

There we go, the file has been uploaded.

I was given an option to define an alternate key, but I’m happy to use the file name.

That’s how simple it is to upload a file into S3 whilst working in Visual Studio.

And if I can upload a file, I can just as easily download or delete a file.

Now although I didn’t want to manage permissions whilst in Visual Studio, I do want to look at how people might access assets in S3.

If I right click the file and copy the URL into the clipboard, I could open up an incognito window and paste it into the address bar. I’m using an incognito window by the way, because I am already logged in to Amazon web services in another browser window.

As you can see, when trying to access the file in S3 using this URL, I receive access denied. Which is to be expected as no permissions are granted.

In fact only the ceiling get that anyone that root account and the IAM user called Frank have access to that bucket and its contents.

A clever thing we can do whilst in Visual Studio, is to right click the file again choose a pre-signed URL.

This allows you to create a time stamped, pre-signed URL. By default I am being offered one hour’s access which I will accept.

I will generate the URL. By the way, note that this is for a GET action but I could also specify a PUT action.

Let me copied this URL and paste it into that same browser window.

Notice that it contains an access key has just been generated and expiry time.

When I press enter, the file and its contents are returned to this unauthenticated window using the signed URL.

So I’ll just pop back into Visual Studio stop using the AWS toolkit with been able to perform some simple management tasks with S3 such as creating a bucket, uploading a file and generate a pre-signed URL.

The last thing I want to do is simply delete the bucket and any objects within it as I want to tidy up after myself.

There is more that I could do with S3 and of course now we have the AWS toolkit installed, we also have access to the SDK and therefore could go ahead and write code to interact with the service. But I just wanted to give you a feel for some of the simple management tasks that you could carry out with S3 whilst using the AWS toolkit in Visual Studio.



There you have it.

In this video, I have shown you how easy it is to work with S3 using the AWS Toolkit in Visual Studio.

Thanks for watching and please feel free to comment on my blog (www.philipstirpe.com) and Facebook page (www.facebook.com/philip.stirpe.tutorials). Perhaps you could suggest more video topics? Most of all, don't forget to subscribe to keep up with my videos as I release them.

Bye for now.






Flash Player








See you soon

Phil Stirpé
"I don't do average!"






11 comments:

  1. The Information shared are very mush Useful my sincere thanks for sharing this post Please continue to share this kind of post
    AWS Training in Marathahalli

    ReplyDelete
  2. Thanks for taking time to share this post. It is really useful. Continue sharing more like this.
    Regards,
    Amazon Web Services Training in Chennai

    ReplyDelete
  3. Thank you for your post. This is excellent information about the how to work with s3 using aws tool kit.it is amazing
    AWS Training in Hyderabad

    ReplyDelete
  4. This is excellent information. It is amazing and wonderful to visit your site.Thanks for sharing this information, this is useful to me…
    No.1 IOS Training Institute in Chennai | Best Android Training Institute in Chennai | Java Training Institute in Chennai

    ReplyDelete
  5. Hi, I have read your blog. Really very informative and excellent post..
    Final Year Project Center in Chennai | IEEE Project Center in Chennai

    ReplyDelete
  6. Excellent sharing..the blog you uploaded was very gud. best bigdata training in bangalore.

    ReplyDelete
  7. Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru ASP.NET Essential Training Online . Nowadays Dot Net has tons of job opportunities on various vertical industry.
    or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

    ReplyDelete
  8. Hi dear, I like your post so much, and it is very good. Hope that we can communicate with each other. I want to introduce an aso services, I try it and I feel it is so good to us beginners.

    ReplyDelete
  9. Thanks for splitting your comprehension with us. It’s really useful to me & I hope it helps the people who in need of this vital information. Amazon Web Services Training in Chennai

    ReplyDelete
  10. Thank you so much for sharing this informative blog. Your technical information is really useful for me. Keep update your blog.
    Regards..
    Amazon Web Services Training in Chennai
    Amazon Web Services Training Institute in Chennai

    ReplyDelete