Anwesh Mohapatra
Anwesh Mohapatra

Reputation: 127

How to get AWS credentails from custom source/location?

I am following: AWS Docs to setup the credentials. The problem is that it requires me to create a .aws folder in the machine. I want to get the keys and other secrets from a custom location. How can it be achieved?
P.S. If I follow the tutorial recommendation then all machines running the project would have to setup that .aws folder which would be a big hassle for everyone.

Upvotes: 0

Views: 291

Answers (2)

Mark B
Mark B

Reputation: 200850

Where exactly would you suggest getting the credentials from? You could store them somewhere else, like a HashiCorp Vault server, and write a script or something to pull the values and set them as environment variables, but then you'll need to figure out how to give each computer secure credentials to access the Vault server.

If by "custom location" you simply mean a different local file system location, like a mapped drive or something, then you can specify that using the AWS_CREDENTIAL_PROFILES_FILE environment variable. Although it sounds like you want to do this on multiple people's workstations, and I would caution against sharing credentials files in that scenario. You really want to assign each person different AWS access keys so that you can track each person's AWS API actions, and revoke one person's access if they leave the company or something.

I recommend reading this page for understanding all the options to configure credentials for the AWS SDK.

Upvotes: 1

Teddy Aryono
Teddy Aryono

Reputation: 366

Assuming you are using Amazon EC2 to host your application, then you can use IAM role to grant permissions, by attaching IAM role to your EC2 instances.

Furthermore, using IAM role avoid storing sensitive credential file in your instances.

Read this document, or watch this video to implement it.

Upvotes: 1

Related Questions