-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add S3 Transfer Acceleration to AWS::S3::Bucket (#833)
* Add S3 Transfer Acceleration to AWS::S3::Bucket * Fix style issues * Add tests for AccelerateConfiguration * Use a custom validator to validate s3 transfer acceleration status values
- Loading branch information
1 parent
334ca16
commit 4bdf6c7
Showing
5 changed files
with
102 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Converted from S3_Bucket.template located at: | ||
# http://aws.amazon.com/cloudformation/aws-cloudformation-templates/ | ||
|
||
from troposphere import Output, Ref, Template | ||
from troposphere.s3 import Bucket, PublicRead, AccelerateConfiguration | ||
|
||
t = Template() | ||
|
||
t.add_description( | ||
"AWS CloudFormation Sample Template S3_Bucket: Sample template showing :" | ||
"How to create a publicly accessible S3 bucket. " | ||
"How to enable S3 Transfer Acceleration. " | ||
"**WARNING** This template creates an Amazon S3 Bucket. " | ||
"You will be billed for the AWS resources used if you create " | ||
"a stack from this template.") | ||
|
||
s3bucket = t.add_resource(Bucket( | ||
"S3Bucket", | ||
# Make public Read | ||
AccessControl=PublicRead, | ||
# Enable s3 Transfer Acceleration | ||
AccelerateConfiguration=AccelerateConfiguration( | ||
AccelerationStatus="Enabled", | ||
), | ||
)) | ||
|
||
t.add_output(Output( | ||
"BucketName", | ||
Value=Ref(s3bucket), | ||
Description="Name of S3 bucket with s3 transfer acceleration enabled", | ||
)) | ||
|
||
print(t.to_json()) |
22 changes: 22 additions & 0 deletions
22
tests/examples_output/S3_Bucket_With_AccelerateConfiguration.template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"Description": "AWS CloudFormation Sample Template S3_Bucket: Sample template showing :How to create a publicly accessible S3 bucket. How to enable S3 Transfer Acceleration. **WARNING** This template creates an Amazon S3 Bucket. You will be billed for the AWS resources used if you create a stack from this template.", | ||
"Outputs": { | ||
"BucketName": { | ||
"Description": "Name of S3 bucket with s3 transfer acceleration enabled", | ||
"Value": { | ||
"Ref": "S3Bucket" | ||
} | ||
} | ||
}, | ||
"Resources": { | ||
"S3Bucket": { | ||
"Properties": { | ||
"AccelerateConfiguration": { | ||
"AccelerationStatus": "Enabled" | ||
}, | ||
"AccessControl": "PublicRead" | ||
}, | ||
"Type": "AWS::S3::Bucket" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters