Create Image Template to create s3 Bucket with Role and AWS Policy
................................................................................................................................
AWSTemplateFormatVersion: '2010-09-09'
Description: Create an S3 Bucket and Attach IAM Policy
Resources:
MyS3Bucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-kangaroo-bucket-07-03-2024
MyIAMRole:
Type: AWS::IAM::Role
Properties:
RoleName: MyS3BucketRole
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: Allow
Principal:
Service: s3.amazonaws.com
Action: sts:AssumeRole
MyIAMPolicy:
Type: AWS::IAM::Policy
Properties:
PolicyName: MyS3BucketPolicy
PolicyDocument:
Version: "2012-10-17"
Statement:
- Effect: "Allow"
Action:
- "s3:CreateBucket"
Resource: "arn:aws:s3:::*"
Roles:
- Ref: MyIAMRole
Create EC2 Instance using Cloud Formation Template:-
"Resources": {
"EC2IH62B": {
"Type": "AWS::EC2::Instance",
"Properties": {
"AvailabilityZone": "us-east-1a",
"ImageId": "ami-0f403e3180720dd7e",
"InstanceType": "t2.micro"
},
"Metadata": {
"AWS::CloudFormation::Designer": {
"id": "bb8313f4-0d45-43dc-b4ba-591dff7a9829"
}
}
}
}
POST Answer of Questions and ASK to Doubt