Last active
November 6, 2020 01:30
-
-
Save yuyasugano/e3943b8d6f636b415132ecb6ac2627ac to your computer and use it in GitHub Desktop.
s3 cross region replication destination 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
--- | |
AWSTemplateFormatVersion: '2010-09-09' | |
Description: S3 Secondary bucket for cross region replication | |
Parameters: | |
Environment: | |
Type: String | |
Default: dev | |
AllowedValues: | |
- dev | |
- prod | |
- uat | |
ReplicationBucketName: | |
Type: String | |
Default: secondary-test-1 | |
RepRegion: | |
Type: String | |
Default: us-east-1 | |
AllowedValues: | |
- us-east-1 | |
ReplicationBucketObjectVersioning: | |
Type: String | |
Default: Enabled | |
AllowedValues: | |
- Suspend | |
- Enabled | |
ReplicationBucketObjectVersioningLength: | |
Type: Number | |
Default: 21 | |
Conditions: | |
ReplicationBucketObjectVersioningEnabled: | |
Fn::Equals: | |
- Ref: ReplicationBucketObjectVersioning | |
- Enabled | |
Resources: | |
ReplicationBucket: | |
Type: AWS::S3::Bucket | |
Properties: | |
VersioningConfiguration: | |
Status: | |
Ref: ReplicationBucketObjectVersioning | |
BucketEncryption: | |
ServerSideEncryptionConfiguration: | |
- ServerSideEncryptionByDefault: | |
SSEAlgorithm: AES256 | |
BucketName: !Sub "${ReplicationBucketName}-${Environment}-bucket" | |
LifecycleConfiguration: | |
Fn::If: | |
- ReplicationBucketObjectVersioningEnabled | |
- Rules: | |
- Id: Lifecycle for replication bucket | |
AbortIncompleteMultipartUpload: | |
DaysAfterInitiation: !Ref ReplicationBucketObjectVersioningLength | |
NoncurrentVersionExpirationInDays: !Ref ReplicationBucketObjectVersioningLength | |
Prefix: '' | |
Status: Enabled | |
- Ref: AWS::NoValue | |
Outputs: | |
ReplicationBucket: | |
Value: !Ref ReplicationBucket |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment