Amazon Web Services (AWS): Enabling API Access
The First step of enabling API access is to get your AWS Access keys properly created and defined.
Step 1 - Login to AWS console and Navigate to IAM
Step 2 - Navigate to users and select user which you want to have the access key
Step 3 - Go to Security Credentials and Click on Create Access Key.
Remember, you will get a pop-up and this is the only time you will able to see the Secret Access Key, so it is a good choice to download and save it somewhere and probably somewhere safe as it gives access to your account.
However, if you loose it, contact your admin and the admin can delete it or make it inactive
Okay, Now that you have 2 parts of Key
Access Key and Secret Access Key.
You should now configure your environment
In your home directory create a folder named .aws and create the credentials file as below.
cat ~/.aws/credentials
[default]
aws_access_key_id=xxxxxxxx
aws_secret_access_key=xxxxx
Now this will be used as your default credentials.
You should also create a config file which specifies default region
Example Below
cat ~.aws/config
[default]
region=us-east-1
The other option can be to set it as your environment variables or set it as your environment variables in the Code Editor you use.
I use pycharm, so go to Run and Edit Configurations, you will see environment variables there which you can configure.
Also, you can use boto3 quick start for your help as well.
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html
Step 1 - Login to AWS console and Navigate to IAM
Step 2 - Navigate to users and select user which you want to have the access key
Step 3 - Go to Security Credentials and Click on Create Access Key.
Remember, you will get a pop-up and this is the only time you will able to see the Secret Access Key, so it is a good choice to download and save it somewhere and probably somewhere safe as it gives access to your account.
However, if you loose it, contact your admin and the admin can delete it or make it inactive
Okay, Now that you have 2 parts of Key
Access Key and Secret Access Key.
You should now configure your environment
In your home directory create a folder named .aws and create the credentials file as below.
cat ~/.aws/credentials
[default]
aws_access_key_id=xxxxxxxx
aws_secret_access_key=xxxxx
Now this will be used as your default credentials.
You should also create a config file which specifies default region
Example Below
cat ~.aws/config
[default]
region=us-east-1
The other option can be to set it as your environment variables or set it as your environment variables in the Code Editor you use.
I use pycharm, so go to Run and Edit Configurations, you will see environment variables there which you can configure.
Also, you can use boto3 quick start for your help as well.
https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html