Last updated: 06.13.2020
The purpose of this document is to show how to work with AWS.
- Click on Services menu
- Click on IAM link
- Click on the Users link on the left menu.
- Click the Add User button
- In the User Name text box, enter the user name
- Under the Access Type section, select the checkbox Progammatic Access
- Click the Next: Permissions button
- Click the Create Group button
- In the Group Name text box, enter EC2Editor
- Give the group the AmazonEC2FullAccess policy
- Click on the Create Group button
- Click on the Next: Tags button
- Click on the Next: Review button
- Click on the Create User button
- Click on the Download .csv button.
- Download the executable for Python 3.8.0 here.
- Run the executable.
- Open up a terminal
- Type
python3.8 --version - The output should show you are running Python 3.8.0.
- If you see a different version, you might have to set the PATH variable
- Open up a terminal
- sudo dnf install python3.8
- Type
python3.8 --version - The output should show you are running Python 3.8.0
-
Open up a terminal
-
export AWS_ACCESS_KEY_ID="<Your Access Key Id in your credentials.csv>"
-
export AWS_SECRET_ACCESS_KEY="<Your Secret Access Key Id in your credentials.csv>"
-
Navigate to a directory where you plan on putting your python virtual environments.
⚠️ You must always work out of a virtual environment. Virtual environments prevent you from corrupting your default system virtual environment and allow users to install different software for each virtual environment. -
Run
python3.8 -m venv venv_aws -
To activate your virtual environment on Windows, you run
./venv_aws/Scripts/activate -
To activate your virtual environment on Fedora, you run
source ./venv_aws/bin/activate -
Run
python --version. This is the version of Python running in your virtual environment. -
Run
pip install --upgrade pip -
Run
pip list. This should list the modules currently installed in your environment. Notice how aws-shell is not present. -
Run
pip install aws-shell==0.2.1. The command installs the aws-shell with the version of 0.2.1 in the virtual environment. -
Run
pip listto confirm aws-shell is installed. -
Configure the aws-shell environment:
-
Type aws-shell. The aws-shell will launch.
-
Type configure. You will be prompted for several values:
-
AWS Access Key ID = This is the Access key ID in your credentials.csv file. Do not enter any value as this is provided by your AWS_ACCESS_KEY_ID environment variable.
-
AWS Secret Access Key = This is the Secret access key in your credentials.csv file. Do not enter any value as this is provided by your AWS_SECRET_ACCESS_KEY environment variable.
-
Default region name = This is the AWS Region the aws-shell will use by default. A listing of AWS regions are described here.
Here are a couple of examples:
- us-east-1 = Located in the US East Region in the state of Ohio.
- us-west-1 = Located in the US West Region in the state of California.
- eu-central-1 = Located in Frankfurt, Germany.
-
Default output format = This is the output format when running commands on the shell. You do not have to enter a value here.
-
You are now ready to start working with the aws-shell.
-
-
Run
ec2 describe-regionsThe output provides all the details of the listed AWS Regions.
-
Run
.exitto exit the aws shell -
Run the following by replacing us-east-1 with the AWS region you want to use:
aws ec2 describe-images --region "us-east-1" > images_in_my_region.txt
- Open the file images_in_my_region.txt and search for an image.
- Once you find the image you want to use, copy the ImageId to a safe location. The ImageId can be used in Terraform to launch an AWS instance. The ImageId is the same as the ami.Take a look at the [terraform-for-beginners](https://github.com/bretmullinix/terraform-for-beginne rs) repo to start working with Terraform and use the ImageId you found.