cat << EOF > ${FILE_IAM_POLICY_DOC}
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ListObjectsInBucket",
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:ListBucketVersions",
"s3:GetBucketLocation"
],
"Resource": ["arn:aws:s3:::${S3_BUCKET_NAME}"]
},
{
"Sid": "AllObjectActions",
"Effect": "Allow",
"Action": [
"s3:*Object",
"s3:*ObjectVersion"
],
"Resource": ["arn:aws:s3:::${S3_BUCKET_NAME}/*"]
}
]
}
EOF
cat ${FILE_IAM_POLICY_DOC}