scripts-misc/s3/newS3AccessPolicy.sh
2024-11-29 10:30:05 +01:00

45 lines
594 B
Bash
Executable file

#!/bin/bash
echo "Input user ARN: "
read userArn
echo ""
echo "Input bucket ARN: "
read bucketArn
echo ""
echo ""
cat << EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": "s3:*",
"Effect": "Allow",
"Resource": [
"$bucketArn",
"$bucketArn/*"
],
"Principal": {
"AWS": [
"$userArn"
]
}
},
{
"Action": [
"s3:ListAllMyBuckets"
],
"Effect": "Allow",
"Resource": "*",
"Principal": {
"AWS": [
"$userArn"
]
}
}
]
}
EOF