amazon web services - Best practice for obtaining the credentials when executing a Redshift copy command -
what's best practice obtaining aws credentials needed executing redshift copy command s3? i'm automating ingestion process s3 redshift having machine trigger copy command.
i know it's recommended use iam roles on ec2 hosts not need store aws credentials. how work though redshift copy command? not particularly want credentials in source code. hosts being provisioned chef , if wanted set credentials environment variables available in chef scripts.
you need credentials use copy command, if question around, how credentials, host running program, can metadata of iam role , use access key, secret key , token. can parameterize on fly before copy command , use them in copy command.
export accesskey=curl -s http://169.254.169.254/iamrole | grep '"accesskeyid" : *' | cut -f5 -d " " | cut -b2- | rev | cut -b3- | rev
command extrct secret key , create parameter
export secretkey=curl -s http://169.254.169.254/iamrole | grep '"secretaccesskey" : *' | cut -f5 -d " " | cut -b2- | rev | cut -b3- | rev
command extract token , create parameter
export token=curl -s http://169.254.169.254/iamrole | grep '"token" : *' | cut -f5 -d " " | rev | cut -b2- | rev
Comments
Post a Comment