官术网_书友最值得收藏!

Creating your first stack

I'm sure you've done this before.

We begin by developing our template first. This is going to be a simple S3 bucket. I'm going to use YAML template formatting, but you may use JSON formatting if you wish:

MyBucket.yaml

AWSTemplateFormatVersion: "2010-09-09"

Description: This is my first bucket

Resources:

  MyBucket:

    Type: AWS::S3::Bucket

Now we just need to create the stack with awscli:

$ aws cloudformation create-stack \

                     --stack-name mybucket\

                     --template-body file://MyBucket.yaml

After a while, we will see our bucket created if we go to the AWS console or run aws s3 ls.

Now let's add some public access to our bucket:

MyBucket.yaml

AWSTemplateFormatVersion: "2010-09-09"

Description: This is my first bucket

Resources:

  MyBucket:

    Type: AWS::S3::Bucket

    Properties:

      AccessControl: PublicRead

Let's run the update operation:

$ aws cloudformation update-stack \

                     --stack-name mybucket \

                     --template-body file://MyBucket.yaml

To clean up your workspace, simply delete your stack using the following command:

$ aws cloudformation delete-stack --stack-name mybucket

Let's now look at the CloudFormation IAM permissions.

主站蜘蛛池模板: 稻城县| 平谷区| 荔波县| 天长市| 武鸣县| 临高县| 西林县| 黄陵县| 百色市| 如东县| 吴桥县| 田东县| 五常市| 游戏| 白沙| 客服| 大英县| 澎湖县| 花莲县| 涿州市| 松滋市| 丰顺县| 阿巴嘎旗| 泰兴市| 电白县| 古丈县| 若羌县| 克拉玛依市| 改则县| 富裕县| 浪卡子县| 盱眙县| 登封市| 南康市| 恩施市| 凤山县| 新兴县| 泰和县| 根河市| 奎屯市| 弥勒县|