Author: Kirk Davis, Dean Suzuki (4/22/20)
Self-Paced Lab Duration: ~45 minutes
The purpose of this lab is to install and configure the AWS Toolkit for Microsoft Visual Studio (2017+, 2019 preferred), create an IAM user with console and programmatic access, and configure the AWS Toolkit to use the programmatic access credentials. You will use this IAM user to access the AWS console for the remainder of today’s labs.
Follow the steps below to install the AWS Toolkit for Visual Studio
Launch Visual Studio. Select Continue without code if Visual Studio prompts.
Select the Online node in the left-panel and then in the search box enter: “AWS Toolkit” (without quotations). Then press ENTER to search.
Click the Download button for the AWS Toolkit for Visual Studio 2017 and 2019.
Once the AWS Toolkit for Visual Studio has downloaded, a message will appear at the bottom of the Extensions and Updates dialog window letting you know that your changes will be scheduled. Press Close to close the Extensions and Updates dialog window and Exit Visual Studio.
Upon exiting Visual Studio, a VSIX Installer screen will appear to install the AWS Toolkit. To proceed with the installation, click Modify.
Once the installation has successfully completed, close the VSIX Installer and re-launch Visual Studio. In Visual Studio, go to View. You should see AWS Explorer as an option and click that option.
Follow the steps below to create a new AWS IAM user, which you will use for both the AWS Toolkit for Visual Studio, and to use the AWS Management Console for the remainder of the day.
On the machine that you are running Visual Studio, login to the IAM Users page in the AWS Console. You can access this page by visiting https://console.aws.amazon.com/iam/home#/users. Please note that in the Immersion Day lab experience, we provide a virtual machine running Visual Studio. If you are using this environment, please ensure that you are opening the AWS Management console on this machine.
Click the Add User button at the top of the page.
On the initial Add User screen, select a username.
Note: If you are working in a shared AWS account, please use your initials followed by a period and “awstoolkit”. For instance, jd.toolkitforvisualstudio for John Doe. If you are in an EventEngine account, choose whatever username you wish - note it down so that you don’t forget it later.
Under Select AWS Access Type, select both checkboxes, for Programmatic Access and AWS Management Console access.
For ‘Console password’ (which appears when you check the second checkbox above), select ‘Custom password’, and enter in a password. Make a note of your password, or commit it to memory.
Uncheck the box for ‘Require password reset’. If you do not uncheck the box, you will need to create a new password on first login.
Click Next: Permissions
Under Set Permissions, select Attach Existing Policies Directly, and check the box next to AdministratorAccess, then click Next: Tags.
Click Next: Review. On the Review page, review the details on the Review screen to ensure that everything is correct before clicking the Create User button.
On the Success screen, click Download .csv to download a CSV file containing your newly created Access Key ID and Secret Access Key. You will need these credentials later. Please note the location of the csv file. It should be in your Downloads folder.
Note: You can also manually copy/paste the Access Key ID and Secret Access Key into the New Profile dialog box. You don’t need to enter the AWS Account ID, that’s just for you to identify the account later.
You have successfully configured the default profile for authenticating and accessing AWS through the AWS Toolkit for Visual Studio.
Note: Installing and configuring the AWS CLI is optional, and is not required to complete the labs when using Visual Studio and the AWS Toolkit.
If you want to interact with the AWS APIs via the Windows command prompt, install the AWS CLI for Windows. The easiest way to install this is to use the MSI installer, available here:
After running the installer, you need to configure AWS credentials in order to use the CLI. Open a command prompt, and ensure the CLI is installed with the following command:
If the CLI is installed, the version of the CLI, Python and botocore (the AWS library for Python) will be displayed.
Note: Before configuring your credentials below, if you are unsure at all whether to use the
aws configure command or to manually create or edit the .aws\credentials file, please check with your AWS Solution Architect.
You will be prompted for your AWS Access Key ID, AWS Secret Access Key, Default region name, and Default output format. You can leave the default output blank. For default region, please use the region specified for the day (for instance, us-west-2).
Note - if you already have an AWS credentials file, skip steps 1 - 5, and start with step 6
In a command prompt window, change directory to your user profile directory with the following command:
dir for a list of files in your profile folder. If there is a folder named
.aws already present, skip ahead to step 3.
Create a new directory in your user profile folder, called, “.aws” with the following command. Note the period (“.”) at the start of the folder name:
Change directory into the newly created .aws folder:
.aws folder already existed, and you did not just create it, type
dir again to see if the
credentials file already exists. If it does already exist, skip to step 6.
Create a blank text file called, “credentials” using the following command:
copy NUL credentials
Next, open the file in Notepad by typing the following command:
(Note: you can use another text editor if you prefer)
Copy the temporary credentials you were provided (from AWS Event Engine, or as provided by your Solutions Architect) and paste them into the credentials file.
Add a profile name at the top of the file surrounded by square brackets. For today’s lab, use [labs] to create a profile called, “labs”. See the example below.
Format the keys, token and region like this example below. Note that the aws_access_key_id, aws_secret_access_key, etc, are in lower case:
[labs] aws_access_key_id=ASIAX6K6DW3D7Z7XKWXK aws_secret_access_key=Z1Q9rEirqxvn9Tah5XL41Evb9ynkoBgJb5SBoiJJ aws_session_token=FQoGZXIvYXdzEDEaDD6qwfjdOxYjwDQGOCLuAXBwDtz+aHvKp33/CD6gU... aws_default_region=us-west-2
*Note: Do not copy the actual key values or token value from this lab guide. These are just examples to show you how to format your credentials in the credentials file. Also, note that there is no, “export” at the start of each line.*
Save the file.
Now that your temporary credentials are configured, the labs profile will show up in the AWS Explorer pane in Visual Studio. Select this profile to ensure it is the default for deploying applications from Visual Studio to AWS.
Note: Installing and configuring the AWS Toolkit for VS Code is optional, and is not required to complete the labs when using Visual Studio and the AWS Toolkit.
Start the VS Code editor.
In the Activity Bar on the side of the VS Code editor, choose the Extensions icon. This opens the Extensions view, which allows you to access the VS Code Marketplace.
In the search box for Extensions, search for AWS Toolkit for Visual Studio Code. Choose the entry to see its details in the right pane.
In the right pane, choose Install.
Once installed, if you’re prompted to restart the editor, choose Reload Required to finish installation.
After you install the Toolkit for VS Code, you should configure your credentials to enable you to access your AWS resources from within VS Code.
Restart VS Code
AWS credentials can be provided to the AWS Toolkit for VS Code by using your shared AWS credentials file. The methods for using these files are the same as those for the AWS CLI.
You should have already created a
credentials file in the prior section, “Install AWS CLI”. Now, you just need to tell the AWS Toolkit for VS Code which profile to use.
The AWS Toolkit for VS Code is now installed and configured.