-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathaws-s3-crr-primary.yaml
79 lines (69 loc) · 1.83 KB
/
aws-s3-crr-primary.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
Description: >
s3 crr testing
Parameters:
NAME:
Type: String
REGIONDEST:
Type: String
Resources:
ReplicaRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: ['sts:AssumeRole']
Effect: Allow
Principal:
Service: [s3.amazonaws.com]
ReplicaPolicy:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- s3:Get*
- s3:ListBucket
Resource:
- !Sub arn:aws:s3:::${NAME}-${AWS::Region}
- !Sub arn:aws:s3:::${NAME}-${AWS::Region}/*
Effect: 'Allow'
- Action:
- s3:ReplicateObject
- s3:ReplicateDelete
- s3:ReplicateTags
- s3:GetObjectVersionTagging
Effect: 'Allow'
Resource: !Sub arn:aws:s3:::${NAME}-${REGIONDEST}/*
PolicyName: ReplicaPolicy
Roles: [!Ref 'ReplicaRole']
S3Bucket:
Type: AWS::S3::Bucket
DeletionPolicy: Delete
Properties:
BucketName: !Sub ${NAME}-${AWS::Region}
BucketEncryption:
ServerSideEncryptionConfiguration:
- ServerSideEncryptionByDefault:
SSEAlgorithm: AES256
ReplicationConfiguration:
Role: !GetAtt [ReplicaRole, Arn]
Rules:
- Destination:
Bucket: !Sub arn:aws:s3:::${NAME}-${REGIONDEST}
StorageClass: STANDARD
Id: Backup
Prefix: ''
Status: Enabled
VersioningConfiguration:
Status: Enabled
Outputs:
NAME:
Description: Full name of bucket created
Value: !Sub ${NAME}-${AWS::Region}
Export:
Name: !Sub ${NAME}-${AWS::Region}
NAMEREP:
Description: Full name of repication bucket
Value: !Sub ${NAME}-${REGIONDEST}
Export:
Name: !Sub ${NAME}-${REGIONDEST}