Difference between revisions of "Cloudformation AWS::S3::Bucket example"

From wikieduonline
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 2: Line 2:
 
  Description: Create an S3 bucket.
 
  Description: Create an S3 bucket.
 
   
 
   
  Parameters:
+
  [[Parameters:]]
 
   BucketName:
 
   BucketName:
 
     Type: String
 
     Type: String
Line 9: Line 9:
 
  Resources:
 
  Resources:
 
   TemplatesBucket:
 
   TemplatesBucket:
     Type: AWS::S3::Bucket
+
     Type: [[AWS::S3]]::Bucket
 
     DeletionPolicy: Retain
 
     DeletionPolicy: Retain
 
     UpdateReplacePolicy: Retain
 
     UpdateReplacePolicy: Retain
 
     Properties:
 
     Properties:
       BucketName: !Ref BucketName
+
       BucketName: [[!Ref]] BucketName
 
       PublicAccessBlockConfiguration:
 
       PublicAccessBlockConfiguration:
 
         BlockPublicAcls: true
 
         BlockPublicAcls: true
Line 26: Line 26:
  
 
== Related ==
 
== Related ==
 +
* https://s3.us-west-2.amazonaws.com/cloudformation-templates-us-west-2/S3_Website_Bucket_With_Retain_On_Delete.template
 +
 
* <code>[[aws cloudformation deploy]] --template-file  /path_to_template/template.json --stack-name my-new-stack-name --parameter-overrides BucketName={bucket_name}</code>
 
* <code>[[aws cloudformation deploy]] --template-file  /path_to_template/template.json --stack-name my-new-stack-name --parameter-overrides BucketName={bucket_name}</code>
 +
 +
"[[ResourceStatusReason]]": "Bad Request (Service: Amazon S3; Status Code: 400; Error Code: 400 Bad Request; Request ID: 1234567; S3 Extended Request ID: Ixxxxxxx=; Proxy: null)",
 +
 +
"[[ResourceStatusReason]]": "Bucket name should not contain uppercase characters"
 +
 +
"ResourceStatusReason": "yourbucketname [[already exists]]"
  
 
== Related ==
 
== Related ==
 
* <code>[[aws s3 mb]]</code>
 
* <code>[[aws s3 mb]]</code>
 
* <code>[[aws s3api create-bucket]]</code>
 
* <code>[[aws s3api create-bucket]]</code>
 +
* <code>[[aws cloudformation deploy]]</code>
 +
* <code>[[aws cloudformation describe-stack-events]]</code>
 +
* <code>[[Successfully created/updated stack]] - YOUR-STACK-NAME</code>
  
 
== See also ==
 
== See also ==
 +
* {{aws cloudformation deploy}}
 
* {{CloudFormation}}
 
* {{CloudFormation}}
 +
 +
[[Category:AWS]]

Latest revision as of 09:07, 9 May 2022

AWSTemplateFormatVersion: "2010-09-09"
Description: Create an S3 bucket.

Parameters:
  BucketName:
    Type: String
    Description: The name of the S3 bucket. 

Resources:
 TemplatesBucket:
    Type: AWS::S3::Bucket
    DeletionPolicy: Retain
    UpdateReplacePolicy: Retain
    Properties:
      BucketName: !Ref BucketName
      PublicAccessBlockConfiguration:
        BlockPublicAcls: true
        BlockPublicPolicy: true
        IgnorePublicAcls: true
        RestrictPublicBuckets: true
      BucketEncryption:
        ServerSideEncryptionConfiguration:
          - ServerSideEncryptionByDefault:
              SSEAlgorithm: AES256


Related[edit]

  • aws cloudformation deploy --template-file /path_to_template/template.json --stack-name my-new-stack-name --parameter-overrides BucketName={bucket_name}
"ResourceStatusReason": "Bad Request (Service: Amazon S3; Status Code: 400; Error Code: 400 Bad Request; Request ID: 1234567; S3 Extended Request ID: Ixxxxxxx=; Proxy: null)",
"ResourceStatusReason": "Bucket name should not contain uppercase characters"
"ResourceStatusReason": "yourbucketname already exists"

Related[edit]

See also[edit]

Advertising: