First, we need to create an IAM user with programmatic access.
Let's get into the AWS Management Console and search for IAM. Go to the IAM and click "Add User" button.
Provide a username and click next and next. If you want to add any tags, you can add them here and click create. Now the user will be created.
Click the user. You'll see the permission tab. For our application to access the S3 storage, we need to provide this user with S3 permission. To do that, Click on the Add permission button and
choose the "Attach Policies Directly" option. Now choose "AmazonS3FullAccess" and click Next. Now review the policy and press Add Permission. The permission should be added now to the user.
Now it's time to configure the IAM user credentials on our pc. To do that, we need to create access key and secret for the user we created just now.
Go to the "Security Credentials" inside the IAM user. Click the "Create access key" button to create keys.
Now choose the "Application running outside AWS" option and click next. Add any description tag value if you want and press "Create access key"
You can see your access key in the console now. You can download the secrets in a CSV file by clicking "Download .csv file" at the bottom.
That's it. We have created the IAM user, provided the S3 permission, and created the access keys to access S3 from our application. Let's go and configure the credentials on our pc.
To configure the AWS Credentials, the latest AWS Cli must be installed on your machine. You can download the Cli on the official AWS website here
To make sure the AWS Cli is installed on your machine, run the below command in your command prompt.
aws --version
The response should be like this below except the version number might be different.
Now run the below command,
aws configure
The command prompt will ask for the access key, secret key, default regions, and output format. You can find the access key and secret key in the CSV file you downloaded just now. Provide the same.
For the default region, I'm providing us-east-2 and "json" as the default output format. But you can provide whatever region you're gonna use for other AWS services.
Top comments (0)