Amazon AWS
Creating Amazon S3 Bucket:
-Go to aws.amazon.com and log in using Amazon credentials.
-Once logged in, go to "Services" and click "S3" under the "Storage" section. You can also user the search bar in the top left.
-Click "Create Bucket" on the top right.
-There are Five buckets needing to be created:
"pdx-(companyname)-distributorimages"
"pdx-(companyname)-documents"
"pdx-(companyname)-productimages" (Location for SC images)
"pdx-(companyname)-videos"
"pdx-(companyname)-images"
-While creating the buckets in the Object Ownership section turn on the "ACLs Enabled" with the Bucket Owner Preferred option and uncheck the Block All Public Access to allow public access.
-After all buckets have been created, open a bucket and select the "Permissions" tab.
-In the permissions tab you will want to add a Bucket Policy and CORS policy by "Editing" both.
-Copy and paste the following Bucket Policy. Replace "companyname" and "bucketname".
NOTE: Make sure to include both { } brackets
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject",
"s3:PutObjectAcl"
],
"Resource": [
"arn:aws:s3:::pdx-(companyname)-(bucketname)/*",
"arn:aws:s3:::pdx-(companyname)-(bucketname)"
]
}
]
}
-Paste the following CORS policy into the CORS section of the Permissions tab, you will need to replace "BUCKET_NAME" with the client's bucket names (i.e. pdx-prodigix-productimages), then click "Save Changes".
NOTE: Make sure to include both [ ] brackets
[
{
"AllowedHeaders": [
"*"
],
"AllowedMethods": [
"GET",
"PUT",
"POST",
"DELETE"
],
"AllowedOrigins": [
"*"
],
"ExposeHeaders": [],
"MaxAgeSeconds": 3000
}
]
-Once the bucket policies are added, click on the account name at the top right and in the drop down select "Security Credentials".
-Find the Access Keys section and click "Create Access Key". This will generate an Access Key and a Secret Key, make sure to save the Secret key as you will not see this key again.
-Copy both keys and go to the "ClientSettings" table on the client's SQL server.
-Paste the Access Key into the "AmazonS3AccessKey" setting string value.
-Paste the Secret Key into the "AmazonS3SecretKey" setting string value.
-Change "AmazonS3Enabled" setting numeric value = 1
-Change the "AmazonS3BucketName" setting string value to match the "companyname" from the buckets created.
- Verify that Amazon S3 Buckets have been set up for the client*
(Link to Amazon Instructions - https://docs.aws.amazon.com/sdk-for-javascript/v2/developer-guide/s3-example-photo-album.html)
-Once buckets have been set up for the client, go into the "Cognito" section under the Services --> Security, Identity, & Compliance in the top left.
-Verify that the region in the top right of the screen matches the region of the buckets. (This will almost always be US-West-2)
-Once in the Cognito section, Click "Create Identity Pool" to create a new identity pool. (If it states to create user pool you will need to change the drop down above the button to Create Identity Pool. This will be in the top right corner of the page.)
-The next page you will Enable the "Authenticated Access" and "Guest Access", then select the Amazon Cognito User Pool in the section that displays below.
-Enter name for the Authenticated Role and Guest Role (i.e. pdx_uploader and pdx_uploader_guest).
-"Skip for now through" the Amazon Cognito User Pool page without changing anything.
-Give the Identity pool name (i.e. Prodigix Uploader) you do not need to "active basic flow" or "add a tag ".
-On the review and create page you will double check everything you entered and then "Create Identity Pool" at the bottom.
-After the Identity pool creation you will be redirected to the Identity Pools page, Copy the Identity Pool ID you created. (looks like "us-west-2:xxxxxxxx-8717-4fcc-xxxx-92765cab85cd")
-Add the Identity Pool ID into the Clients settings, DC and Shopping Cart.
-Client settings will have a column named "AmazonS3IdentityPoolId", only add the numbers after us-west-2:. (IE xxxxxxxx-8717-4fcc-xxxx-92765cab85cd)
-Head into the clients Distributor Center 60 folder, in DistributorCenter60/includes/config_settings.asp under "Amazon Upload Fields" add the Identity Pool ID and update the rest of the Amazon fields as needed.
-Head into the clients shopping cart 70 folder, in ShoppingCart70/functions/constants_settings.asp, add the Identity Pool ID and update all Amazon fields as necessary
-You will need to test 2 items to make sure the buckets were setup correct.
Shopping Cart, Test the upload image button in the shopping cart under ID 2.
Distributor Center, login to the DC and upload an distributor image.