-
Couldn't load subscription status.
- Fork 166
Document creating stacker bucket with CloudFormation. #571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| from stacker.blueprints.base import Blueprint | ||
|
|
||
| from troposphere import Ref | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'd replace |
||
| from troposphere import s3 | ||
|
|
||
|
|
||
| class StackerBucket(Blueprint): | ||
| VARIABLES = { | ||
| "BucketName": { | ||
| "type": str, | ||
| "default": "", | ||
| "description": "When provided, specifies an explicit bucket name " | ||
| "to use when creating the bucket. If none is " | ||
| "specified, CloudFormation will create a random " | ||
| "name." | ||
| }, | ||
| } | ||
|
|
||
| @property | ||
| def bucket(self): | ||
| bucket_name = self.get_variables()["BucketName"] or Ref("AWS::NoValue") | ||
| aes = s3.ServerSideEncryptionRule( | ||
| ServerSideEncryptionByDefault=s3.ServerSideEncryptionByDefault( | ||
| SSEAlgorithm="AES256")) | ||
|
|
||
| return s3.Bucket( | ||
| "StackerBucket", | ||
| BucketName=bucket_name, | ||
| BucketEncryption=s3.BucketEncryption( | ||
| ServerSideEncryptionConfiguration=[aes])) | ||
|
|
||
| def create_template(self): | ||
| self.template.add_resource(self.bucket) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably have the bucket name as an output. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe mention that if they want more control over creation of the bucket, they can use the
Bucketblueprint fromstacker_blueprintsas well.