Credentials
<cfscript>(In credential.cfm)
   s3.name ="Object Operations";
   s3.accessKeyId = " wJalrXUtnFEMI";
   s3.awsSecretKey = "K7MDENG/bPxRfiCYEXAMPLEKEY";
   s3.defaultLocation = "us-west-2";
</cfscript>


<cfscript>(In Applications.cfc)
   this.s3.name ="Object Operations";
   this.s3.accessKeyId = " wJalrXUtnFEMI";
   this.s3.awsSecretKey = "K7MDENG/bPxRfiCYEXAMPLEKEY";
   this.s3.defaultLocation = "us-west-2";
</cfscript>


In our cffile and cfdirectory examples we will need to provide credentials to access the S3 bucket "keens-bucket" due to the fact that it is a private bucket as are all the objects in the bucket. Here I have created a credentials.cfm file that I then include in the templates that need to utilize the credentials. This could just have easily been done by adding the variables in the Application.cfc.

If you have set the accessKeyID and awsSecretKey in both the URL and Application.cfc, the value provided in the URL takes precedence.

You manage the access key for root in the AWS Management Console. It is recommended to create a user in AWS Identity and Access Management (IAM) which can be assigned individual permissions so that if your credentials become compromised they do not provide root access. IAM (AWS Identity and Access Management) is a web service that helps you securely control access to AWS resources for your users. You use IAM to control who can use your AWS resources (authentication) and how they can use resources (authorization).



CREDENTIALS   CFDIRECTORY   CFFILE   COLDFUSION INTERFACING WITH AWS