APS
APS

Reputation: 13

upload file to s3 from local using AWS CLI without hard-coded credentials(access id and secret access key)

My requirement to upload file from local to s3 using aws cli but don't want to use access ID and secret access key while running in command line.

Any suggestions!

Upvotes: 0

Views: 1319

Answers (1)

John Rotenstein
John Rotenstein

Reputation: 269101

It is recommended that you never put AWS credentials in program code.

If the code is running on an Amazon EC2 instance, assign an IAM Role to the instance. The code will automatically detect and use these credentials.

If the code is running on your own computer, run the AWS Command-Line Interface (CLI) aws configure command and enter your IAM credentials (Access Key + Secret Key). They will be stored in the ~/.aws/credentials file and will be automatically accessed by your code.

Upvotes: 1

Related Questions