amazon s3 - Access S3 in cron job in docker on Elastic Beanstalk -
i have cron job in docker image deploy elastic beanstalk. in job wish include read , write operations on s3 , have included aws cli tools purpose.
but aws cli isn't useful without credentials. how can securely include aws credentials in docker image, such that aws cli work? or should take other approach?
always try avoid setting credentials on machines if run within aws.
do following:
- go iam console , create iam role, edit policy of role have appropriate s3 read/write permissions.
- then go elastic beanstalk console, find environment , go the configuration/instances section. set "instance profile" use role created (a profile associated role, can see in iam console when you're viewing role).
this mean each beanstalk ec2 instance have permissions set in iam role (the aws cli automatically use instance profile of current machine if available).
more info: