Reputation:
I have a Django project (deployed on AWS Elastic Beanstalk) that uses several AWS services (SES, S3, etc.) through an IAM user. I am wondering what the best way to store this IAM user's credentials in the Django project is.
I have thought of a few approaches and have a few questions for each:
.env
file with the credentials. Can this be hacked though? Is this the most secure way?Amazon Secrets Manager
to create a secret with the credentials. I tried this, but then realized that you need to supply credentials to use it (😅).Is there a better method? What would you recommend?
Upvotes: 1
Views: 585
Reputation: 78573
Don't use IAM user credentials on AWS compute services (EC2, Elastic Beanstalk, Lambda, etc.)
Instead, use an IAM role. See Managing Elastic Beanstalk instance profiles.
Per What is the difference between an IAM role and an IAM user?
An IAM user has permanent long-term credentials and is used to directly interact with AWS services. IAM roles are meant to be assumed by authorized entities, such as applications ...
Upvotes: 1