Complete the code to define a simple AWS S3 bucket using Infrastructure as Code.
Resources:
MyBucket:
Type: [1]The resource type AWS::S3::Bucket defines an S3 bucket in AWS CloudFormation, which is a common Infrastructure as Code tool.
Complete the code to specify the bucket name property in the S3 bucket resource.
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: [1]The BucketName property sets the name of the S3 bucket. It should be a string representing the bucket's name.
Fix the error in the following CloudFormation snippet by selecting the correct property key for enabling versioning on the S3 bucket.
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
[1]:
Status: EnabledThe correct property to enable versioning on an S3 bucket is VersioningConfiguration with a nested Status key.
Fill both blanks to create a CloudFormation output that shows the bucket's ARN after deployment.
Outputs:
BucketArn:
Description: "The ARN of the S3 bucket"
Value: ![1] MyBucket.[2]The GetAtt function retrieves an attribute of a resource, and Arn is the attribute for the bucket's ARN.
Fill all three blanks to define an IAM role with a trust policy allowing Lambda service to assume it.
Resources:
LambdaExecutionRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Principal:
Service: [1]
Action: [2]
Policies:
- PolicyName: LambdaPolicy
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: [3]
Resource: '*'The Service principal for Lambda is lambda.amazonaws.com. The action to allow assuming the role is sts:AssumeRole. The policy action to allow creating logs is logs:CreateLogGroup.