To manage the resources in AWS through terraform, you should have ACCESS_KEY and SECRET_ACCESS_KEY.
Follow below steps to get the credentials.
Click on “Users” and click on “Add user”
Provide username and Select Access type as “Programmatic access”
Click on “Next: Tags” and Click on “Next: Review”
Review the permissions and Click on “Create user”
Download the CSV file and keep it safe and secure. It contains Access key ID and Secret access key.
Finally, click on “Close”.
If you lose the credentials accidentally, Follow the below steps to create new credentials.
Goto Users and Click on the username.
In the next page, Click on “Security credentials”.
Here you can found Access key details.
Click on create “Create access key” to create a new access key and download the CSV file or copy the credentials.
Make sure to inactive the unused or old access key.
Click on Make inactive or delete the key.
You are not allowed to have more than keys. So delete unused keys.
Note: Both Access Key Id and Secret access key will change every time when you create a new Access key.
If you have aws cli installed in your machine, you can also execute “aws configure” command to add credentials.
$ aws configure AWS Access Key ID : XXXXXXXXXXXXXXXXXXX AWS Secret Access Key : XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX Default region name [us-east-1]: Default output format [json]: