Complete the code to define a resource in AWS CloudFormation.
Resources:
MyBucket:
Type: [1]The Resources section defines AWS resources. To create an S3 bucket, use AWS::S3::Bucket as the resource type.
Complete the code to add a property to the S3 bucket resource.
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
[1]:
Status: EnabledTo enable versioning on an S3 bucket, use the VersioningConfiguration property with Status set to Enabled.
Fix the error in the resource definition by completing the missing property key.
Resources:
MyInstance:
Type: AWS::EC2::Instance
Properties:
[1]: t2.microThe property to specify the EC2 instance size is InstanceType. Using other keys will cause errors.
Fill both blanks to define an IAM role with a trust policy.
Resources:
MyRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: [1]
Action: [2]The trust policy for an EC2 role uses ec2.amazonaws.com as the service principal and sts:AssumeRole as the action.
Fill all three blanks to define an S3 bucket policy allowing public read access.
Resources:
PublicBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: [1]
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal: [2]
Action: [3]
Resource: arn:aws:s3:::my-public-bucket/*The bucket property must be the bucket name. The principal '*' means everyone. The action s3:GetObject allows public read access to objects.