-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshared-ui-bucket.yaml
More file actions
89 lines (83 loc) · 2.28 KB
/
Copy pathshared-ui-bucket.yaml
File metadata and controls
89 lines (83 loc) · 2.28 KB
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
80
81
82
83
84
85
86
87
88
89
# Shared UI Bucket
# Hosts all application UIs with prefix-based isolation
# CloudFront accesses this bucket via OAC
#
# Structure:
# s3://hkc-sample-shared-ui/
# ├── john-inventory-dev/ # Developer instance
# │ ├── index.html
# │ ├── app.js
# │ └── styles.css
# ├── team-inventory-staging/ # Staging instance
# │ └── ...
# └── team-inventory-prod/ # Production instance
# └── ...
#
apiVersion: s3.services.k8s.aws/v1alpha1
kind: Bucket
metadata:
name: hkc-sample-shared-ui
namespace: kro-serverless-stack
labels:
app.kubernetes.io/name: hkc-sample
app.kubernetes.io/component: s3
app.kubernetes.io/part-of: shared-platform
spec:
name: hkc-sample-shared-ui-${AWS_ACCOUNT_ID}
# Versioning for rollback capability
versioning:
status: Enabled
# Server-side encryption
encryption:
rules:
- applyServerSideEncryptionByDefault:
sseAlgorithm: AES256
# Block public access (CloudFront uses OAC)
# Note: blockPublicPolicy must be false to allow the CloudFront OAC bucket policy
publicAccessBlock:
blockPublicACLs: true
blockPublicPolicy: false
ignorePublicACLs: true
restrictPublicBuckets: false
# Bucket policy for CloudFront OAC access
# Uses SourceAccount condition to restrict to your AWS account only
policy: |
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowCloudFrontOAC",
"Effect": "Allow",
"Principal": {
"Service": "cloudfront.amazonaws.com"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::hkc-sample-shared-ui-${AWS_ACCOUNT_ID}/*",
"Condition": {
"StringEquals": {
"AWS:SourceAccount": "${AWS_ACCOUNT_ID}"
}
}
}
]
}
# CORS configuration for API calls from UI
cors:
corsRules:
- allowedHeaders:
- "*"
allowedMethods:
- GET
- HEAD
allowedOrigins:
- "https://*.${DOMAIN_NAME}"
maxAgeSeconds: 3000
# Tags
tagging:
tagSet:
- key: Application
value: hkc-sample
- key: Component
value: shared-ui
- key: ManagedBy
value: ACK