-
Notifications
You must be signed in to change notification settings - Fork 6
/
pipeline_bucket.yaml
52 lines (48 loc) · 1.41 KB
/
pipeline_bucket.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
AWSTemplateFormatVersion: '2010-09-09'
Resources:
PipelineBucket:
Type: 'AWS::S3::Bucket'
Properties:
AccessControl: 'Private'
BucketEncryption:
ServerSideEncryptionConfiguration:
-
ServerSideEncryptionByDefault:
SSEAlgorithm: 'AES256'
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
# https://docs.aws.amazon.com/codepipeline/latest/userguide/S3-artifact-encryption.html
PipelineBucketPolicy:
Type: 'AWS::S3::BucketPolicy'
Properties:
Bucket: !Ref PipelineBucket
PolicyDocument:
Statement:
-
Sid: DenyUnEncryptedArtifactUploads
Action:
- s3:PutObject
Condition:
StringNotEquals:
s3:x-amz-server-side-encryption: 'aws:kms'
Effect: Deny
Principal: '*'
Resource:
- !Sub "arn:aws:s3:::${PipelineBucket}/*"
-
Sid: DenyInsecureArtifactConnections
Action:
- 's3:*'
Condition:
Bool:
aws:SecureTransport: false
Effect: Deny
Principal: '*'
Resource:
- !Sub "arn:aws:s3:::${PipelineBucket}/*"
Outputs:
PipelineBucket:
Value: !Ref PipelineBucket