AWS Step-by-Step

Accessing Amazon S3 Buckets Through Visual Studio, Part 2

Now that you've laid the groundwork for linking Visual Studio to AWS, it's time to begin putting together the various pieces to access S3.

In Part 1 of this series, I began showing you what was necessary for linking Visual Studio to Amazon Web Services (AWS) for the purpose of accessing the Simple Storage Service (S3).

Now that we have laid the groundwork, it's time to begin putting together the various pieces.

The first step in doing so is to connect Visual Studio to AWS by using the keys that I showed you how to acquire in Part 1. To get started, open Visual Studio and select the AWS Explorer option from the View menu, as shown in Figure 1 below. If the AWS Explorer option does not exist on the View menu, it means that the AWS Toolkit for Visual Studio did not install correctly, and that you should completely remove it and re-attempt the installation.

Figure 1: Choose the AWS Explorer option from the View menu.

The next thing that you will need to do is to link your AWS access key and secret access key to a profile within Visual Studio. If you look in the upper-left portion of the screen, you will see a Profile field. Maybe it's just me, but I had a hard time locating this field the first time that I used it. It is located below the toolbar and above the console tree, just beneath a yellow banner that says AWS Explorer. You can see the Profile field in Figure 2.

Figure 2: You will need to locate the Profile field.

As you can see in the figure above, there are three icons located just to the right of the profile field. The leftmost of these icons is the New Account Profile icon. Click on this icon, and Visual Studio will open the New Account Profile dialog box, which you can see in Figure 3.

Figure 3: You will need to fill in the New Account Profile dialog box.

As you can see in the figure above, filling in this dialog box is a relatively straightforward process. The first thing that you will need to provide is a unique name for the profile. If you look back at Figure 2, you can see that I named my Profile AWS. You can, of course, call the profile anything that you want.

Next, you will need to provide your Access Key ID and your Secret Access Key. As you can see in the figure, you have the option of typing or pasting these values into the dialog box, but there is also an option to import the values from a .CSV file. As you may recall from the first installment, AWS gives you the option to export these values to a .CSV file when you create an IAM account. Therefore, you can generate the .CSV file at the time of account creation and use that same .CSV file within Visual Studio.

Finally, you will need to provide an account number. The account number is your AWS subscription number. You will also need to specify your account type before clicking OK.

At this point, you are just about ready to access your S3 buckets through Visual Studio. In fact, you may already be able to. However, you will need to make sure that your IAM account has the required permissions. At a minimum, the IAM account must have the following permissions:

S3:GetBucketAcl
S3:GetBucket
S3:ListBucket

You can set the required permissions by logging in to the AWS Console and going to the IAM dashboard, and then going to the Policies section. A comprehensive discussion of IAM policies is beyond the scope of this article, but I wrote a full article on the subject a few weeks ago called "Creating Policies for Amazon S3 Storage Buckets."

Once the permissions have been put into place, you should be able to access your S3 storage buckets through Visual Studio and AWS Explorer.

If you look at Figure 4, you can see that the console tree contains an S3 container. You can also see that I have expanded this container to reveal a storage bucket named VS Posey. When selected, Visual Studio provides icons for uploading files and folders, and for creating folders.

Figure 4: You can access a storage bucket through Visual Studio.

About the Author

Brien Posey is a seven time Microsoft MVP with over two decades of IT experience. As a freelance writer, Posey has written many thousands of articles and written or contributed to several dozen books on a wide variety of IT topics. Prior to going freelance, Posey was a CIO for a national chain of hospitals and healthcare facilities. He has also served as a network administrator for some of the country's largest insurance companies and for the Department of Defense at Fort Knox. When He isn't busy writing, Brien Posey enjoys exotic travel, scuba diving, and racing his Cigarette boat. You can visit his personal Web site at: www.brienposey.com.

Featured