Skip to content

Commit 32adc83

Browse files
committed
chore: appends logs
Signed-off-by: Sammy Huang <sammy.huang@zilliz.com>
1 parent 4db963e commit 32adc83

File tree

1 file changed

+224
-0
lines changed

1 file changed

+224
-0
lines changed
Lines changed: 224 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,224 @@
1+
# Configuring AWS Client-Side Encryption for BYOC
2+
3+
This guide demonstrates how to configure AWS Client-Side Encryption (CSE) for your Bring Your Own Cloud (BYOC) infrastructure using Terraform.
4+
5+
CSE requires two steps:
6+
7+
1. **Configure CSE infrastructure in the BYOC project** - Set up IAM roles and default KMS key that enables CSE capability
8+
2. **Opt-in individual clusters to use CSE** - Specify `aws_cse_key_arn` on clusters that should use encryption
9+
10+
**Important**: Clusters do NOT use CSE by default. Each cluster must explicitly opt-in by specifying an `aws_cse_key_arn`. Different clusters within the same project can choose whether to use CSE or not.
11+
12+
By enabling CSE, you can encrypt your data using your own AWS KMS keys, providing enhanced security and control over your encryption keys.
13+
14+
## Understanding AWS Client-Side Encryption
15+
16+
### What is Client-Side Encryption (CSE)?
17+
18+
Client-Side Encryption allows you to encrypt your data before it's sent to storage using your own AWS KMS (Key Management Service) keys. This provides:
19+
20+
- **Enhanced Security**: Data is encrypted using keys you control
21+
- **Compliance**: Meet regulatory requirements for data encryption
22+
- **Key Control**: Full ownership and management of encryption keys
23+
- **Audit Trail**: Track KMS key usage through AWS CloudTrail
24+
25+
### How CSE Works in BYOC
26+
27+
CSE configuration in Zilliz Cloud BYOC involves two components:
28+
29+
#### 1. Project CSE Infrastructure (Automatic Setup)
30+
31+
The CSE infrastructure is automatically configured during the BYOC project creation process. This sets up the necessary AWS resources:
32+
33+
- **CSE Role ARN**: IAM role used for encryption/decryption operations
34+
- **Default CSE Key ARN**: Default KMS key available for clusters to use
35+
- **External ID**: Security token for secure cross-account access
36+
37+
**Note**: This automatic configuration does NOT enable encryption for clusters. It only makes CSE capability available for clusters to opt-in.
38+
39+
#### 2. Cluster CSE Opt-In (Per-Cluster)
40+
41+
Each cluster must explicitly opt-in to use CSE by specifying an `aws_cse_key_arn`. This allows flexibility:
42+
43+
- **Selective Encryption**: Only clusters that need encryption use it
44+
- **Different Keys**: Different clusters can use different KMS keys for data segregation
45+
- **Mixed Mode**: Within the same project, some clusters use CSE while others don't
46+
- **No Default Encryption**: Clusters without `aws_cse_key_arn` will NOT use CSE
47+
48+
### AWS KMS Key ARN Format
49+
50+
KMS key ARNs follow this format:
51+
52+
```
53+
arn:aws:kms:REGION:ACCOUNT_ID:key/KEY_ID
54+
```
55+
56+
Example:
57+
```
58+
arn:aws:kms:us-west-2:123456789012:key/12345678-1234-1234-1234-123456789012
59+
```
60+
61+
### Important Constraints
62+
63+
- **BYOC Only**: CSE configuration is only applicable to BYOC projects and clusters
64+
- **Immutable**: Once configured, CSE settings cannot be changed. Any attempt to modify CSE configuration after creation will require resource replacement.
65+
- **Create-time Configuration**: CSE must be specified during resource creation
66+
- **Optional**: If not specified, standard encryption methods will be used
67+
68+
## Configuration Examples
69+
70+
### Step 1: Configure CSE Infrastructure in BYOC Project
71+
72+
First, set up the CSE infrastructure in your BYOC project. This makes CSE capability available but doesn't automatically encrypt any clusters:
73+
74+
```hcl
75+
resource "zillizcloud_byoc_i_project" "aws_project_with_cse" {
76+
project_name = "production-byoc-project"
77+
cloud_id = "aws"
78+
region = "us-west-2"
79+
80+
aws {
81+
# Network configuration
82+
network = {
83+
vpc_id = "vpc-0123456789abcdef0"
84+
subnet_ids = ["subnet-111", "subnet-222", "subnet-333"]
85+
security_group_ids = ["sg-0123456789abcdef0"]
86+
}
87+
88+
# Storage configuration
89+
storage = {
90+
bucket_id = "my-production-bucket"
91+
}
92+
93+
# IAM role configuration
94+
role_arn = {
95+
storage = "arn:aws:iam::123456789012:role/ZillizStorageRole"
96+
eks = "arn:aws:iam::123456789012:role/ZillizEKSRole"
97+
bootstrap = "arn:aws:iam::123456789012:role/ZillizBootstrapRole"
98+
}
99+
100+
# CSE infrastructure - enables CSE capability for the project
101+
# Note: This does NOT automatically encrypt clusters
102+
cse = {
103+
aws_cse_role_arn = "arn:aws:iam::123456789012:role/ZillizCSERole"
104+
default_aws_cse_key_arn = "arn:aws:kms:us-west-2:123456789012:key/default-cse-key-id"
105+
external_id = "unique-external-id-for-security"
106+
}
107+
}
108+
}
109+
```
110+
111+
### Step 2: Create Clusters with CSE Opt-In
112+
113+
Now you can create clusters. Each cluster independently decides whether to use CSE:
114+
115+
#### Example A: Cluster WITHOUT CSE (Default Behavior)
116+
117+
This cluster will NOT use encryption, even though the project has CSE configured:
118+
119+
```hcl
120+
resource "zillizcloud_cluster" "cluster_without_cse" {
121+
cluster_name = "development-cluster"
122+
region_id = "aws-us-west-2"
123+
plan = "Enterprise"
124+
cu_size = 2
125+
cu_type = "Performance-optimized"
126+
project_id = zillizcloud_byoc_i_project.aws_project_with_cse.id
127+
128+
# No aws_cse_key_arn specified = No CSE encryption
129+
}
130+
```
131+
132+
#### Example B: Cluster WITH CSE Using the Key
133+
134+
This cluster opts-in to CSE and uses the key from the project:
135+
136+
```hcl
137+
resource "zillizcloud_cluster" "cluster_with_default_cse" {
138+
cluster_name = "production-cluster-1"
139+
region_id = "aws-us-west-2"
140+
plan = "Enterprise"
141+
cu_size = 2
142+
cu_type = "Performance-optimized"
143+
project_id = zillizcloud_byoc_i_project.aws_project_with_cse.id
144+
145+
# Opt-in to CSE using the project's default key
146+
aws_cse_key_arn = "arn:aws:kms:us-west-2:123456789012:key/default-cse-key-id"
147+
}
148+
```
149+
150+
## AWS KMS Key Setup
151+
152+
### Creating a KMS Key
153+
154+
Before using CSE with your cluster, you need to create a KMS key in AWS:
155+
156+
1. Navigate to AWS KMS in the AWS Console
157+
2. Click "Create key"
158+
3. Choose "Symmetric" key type
159+
4. Configure key administrative and usage permissions
160+
5. Note the ARN of the created key
161+
162+
### Required IAM Permissions
163+
164+
Ensure your Zilliz Cloud BYOC infrastructure has permissions to use the KMS key. The key policy should allow:
165+
166+
- `kms:Encrypt`
167+
- `kms:Decrypt`
168+
- `kms:GenerateDataKey`
169+
- `kms:DescribeKey`
170+
171+
## Common Errors and Troubleshooting
172+
173+
### Error: "Cannot change AWS CSE key ARN after cluster is created"
174+
175+
**Cause**: You attempted to modify the `aws_cse_key_arn` attribute after the cluster was already created.
176+
177+
**Solution**: The AWS CSE key configuration is immutable. If you need to use a different KMS key:
178+
179+
1. Destroy the existing cluster:
180+
```bash
181+
terraform destroy -target=zillizcloud_cluster.your_cluster_name
182+
```
183+
184+
2. Update the `aws_cse_key_arn` in your Terraform configuration
185+
186+
3. Recreate the cluster:
187+
```bash
188+
terraform apply
189+
```
190+
191+
**Note**: This will result in data loss. Ensure you have backups before destroying the cluster.
192+
193+
### Error: "Invalid KMS key ARN format"
194+
195+
**Cause**: The provided KMS key ARN is not in the correct format.
196+
197+
**Solution**: Verify your KMS key ARN follows this format:
198+
```
199+
arn:aws:kms:REGION:ACCOUNT_ID:key/KEY_ID
200+
```
201+
202+
### Error: "Access denied to KMS key"
203+
204+
**Cause**: The BYOC infrastructure doesn't have permission to use the specified KMS key.
205+
206+
**Solution**:
207+
1. Check the KMS key policy in AWS Console
208+
2. Ensure the BYOC service role has the required permissions
209+
3. Update the key policy to grant necessary permissions
210+
211+
## Best Practices
212+
213+
1. **Key Management**: Implement proper key rotation policies in AWS KMS
214+
2. **Access Control**: Use least privilege principle when granting KMS key permissions
215+
3. **Monitoring**: Enable CloudTrail logging for KMS key usage auditing
216+
4. **Backup**: Ensure your KMS key backup and disaster recovery procedures are in place
217+
5. **Regional Alignment**: Use a KMS key in the same AWS region as your cluster for optimal performance
218+
6. **Documentation**: Document which KMS keys are used by which clusters for operational clarity
219+
220+
## Related Resources
221+
222+
- [Configuring Custom Bucket for BYOC Clusters](./configure-custom-bucket-for-byoc-cluster.md)
223+
- [Creating a BYOC Project](./create-a-byoc-project.md)
224+
- [AWS KMS Documentation](https://docs.aws.amazon.com/kms/)

0 commit comments

Comments
 (0)