I want to Create the following resources using Terraform:
An S3 bucket
An IAM role
An IAM policy attached to the role that allows it to perform any S3 actions on that bucket and the objects in it
An EC2 instance with the IAM role attached
Create a README.md and document all assumptions made. Login to the EC2 instance and validate access to the bucket using the role.
What I have tried:
{
"Version":"2012-10-17",
"Statement":[
{
"Effect":"Allow",
"Action": "s3:ListAllMyBuckets",
"Resource":"arn:aws:s3:::*"
},
{
"Effect":"Allow",
"Action":["s3:ListBucket","s3:GetBucketLocation"],
"Resource":"arn:aws:s3:::awsexamplebucket1"
},
{
"Effect":"Allow",
"Action":[
"s3:PutObject",
"s3:PutObjectAcl",
"s3:GetObject",
"s3:GetObjectAcl",
"s3:DeleteObject"
],
"Resource":"arn:aws:s3:::awsexamplebucket1/*"
}
]
}