| « PreviousNext » | |
![]() ![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
The AWS::S3::Bucket type creates an Amazon S3 bucket.
You can set a deletion policy for your bucket to control how AWS CloudFormation handles the bucket when the stack is deleted. For S3 buckets, you can choose to retain the bucket or to delete the bucket. For more information, see DeletionPolicy Attribute.
Important
Only S3 buckets that are empty can be deleted. Deletion will fail for buckets that have contents.
{
"Type" : "AWS::S3::Bucket",
"Properties" : {
"AccessControl" : String,
"Tags" : [ Resource Tag, ... ],
"WebsiteConfiguration" : Website Configuration Type
}
} A canned access control list (ACL) that grants predefined permissions on the bucket. For more information about canned ACLs, see Canned ACLs in the Amazon S3 documentation.
Required: No. The default value is Private.
Type: String.
Valid values: Private | PublicRead |
PublicReadWrite | AuthenticatedRead |
BucketOwnerRead | BucketOwnerFullControl
An arbitrary set of tags (key/value pairs) for this S3 bucket.
Required: No.
Information used to configure the bucket as a static website. For more information, see Hosting Websites on Amazon S3.
Required: No.
Type: Website Configuration Type
Example:
"WebsiteConfiguration" : {
"IndexDocument" : "index.html", "ErrorDocument" : "error.html" }When the logical ID of this resource is provided to the Ref intrinsic
function, it returns the resource name.
Example: mystack-mybucket-kdwwxmddtr2g
For more information about using the Ref function, see Ref.
Fn::GetAtt returns a value for a specified attribute of this type.
This section lists the available attributes and corresponding return values.
Returns the DNS name of the specified bucket.
Example: mystack-mybucket-kdwwxmddtr2g.s3.amazonaws.com
Amazon S3 website endpoint for the specified bucket.
Example: http://mystack-mybucket-kdwwxmddtr2g.s3-website-us-east-1.amazonaws.com/
For more information about using Fn:GetAtt, see Fn::GetAtt.
Example Basic static website configuration with an index and error document
In this example, AWS::S3::Bucket's Fn::GetAtt values are used to provide
outputs.
"Resources" : {
"S3Bucket" : {
"Type" : "AWS::S3::Bucket",
"Properties" : {
"AccessControl" : "PublicRead",
"WebsiteConfiguration" : {
"IndexDocument" : "index.html",
"ErrorDocument" : "error.html"
}
},
"DeletionPolicy" : "Retain"
}
},
"Outputs" : {
"WebsiteURL" : {
"Value" : { "Fn::GetAtt" : [ "S3Bucket", "WebsiteURL" ] },
"Description" : "URL for website hosted on S3"
},
"S3BucketSecureURL" : {
"Value" : { "Fn::Join" : [
"", [ "https://", { "Fn::GetAtt" : [ "S3Bucket", "DomainName" ] } ]
] },
"Description" : "Name of S3 bucket to hold website content"
}
} For more examples, see Amazon S3 Template Snippets.
Access Control List (ACL) Overview in the Amazon Simple Storage Service Developer Guide
Hosting a Static Website on Amazon S3 in the Amazon Simple Storage Service Developer Guide