Skip to content

Commit 3be755c

Browse files
updated core doco
1 parent bf4ac22 commit 3be755c

File tree

2 files changed

+369
-4
lines changed

2 files changed

+369
-4
lines changed

AmazonQ.md

Lines changed: 203 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
# Deploying Coder on AWS EKS with Amazon Q
2+
3+
This document provides a step-by-step guide for deploying Coder on AWS EKS for workshops or demonstrations, based on the `deploy2eks.sh` script in this repository.
4+
5+
## Prerequisites
6+
7+
Before you begin, ensure you have:
8+
9+
- An AWS account with appropriate permissions
10+
- The following CLI tools installed:
11+
- AWS CLI (configured with your credentials)
12+
- eksctl
13+
- kubectl
14+
- helm
15+
16+
## Deployment Steps
17+
18+
### 1. Create an EKS Cluster
19+
20+
```bash
21+
# Create an EKS cluster with auto-mode enabled for simplicity
22+
eksctl create cluster --name=your-cluster-name --enable-auto-mode --region your-region
23+
```
24+
25+
Replace `your-cluster-name` with your desired cluster name and `your-region` with your preferred AWS region.
26+
27+
### 2. Configure Storage for the Cluster
28+
29+
Deploy a Kubernetes StorageClass for dynamic EBS volume provisioning:
30+
31+
```bash
32+
kubectl apply -f - <<EOF
33+
apiVersion: storage.k8s.io/v1
34+
kind: StorageClass
35+
metadata:
36+
name: gp3-csi
37+
annotations:
38+
storageclass.kubernetes.io/is-default-class: "true"
39+
provisioner: ebs.csi.eks.amazonaws.com
40+
volumeBindingMode: WaitForFirstConsumer
41+
parameters:
42+
type: gp3
43+
encrypted: "true"
44+
allowVolumeExpansion: true
45+
EOF
46+
```
47+
48+
### 3. Set Up Coder with PostgreSQL Database
49+
50+
```bash
51+
# Create Coder namespace
52+
kubectl create namespace coder
53+
54+
# Install PostgreSQL using Helm
55+
helm repo add bitnami https://charts.bitnami.com/bitnami
56+
helm install coder-db bitnami/postgresql \
57+
--namespace coder \
58+
--set auth.username=coder \
59+
--set auth.password=coder \
60+
--set auth.database=coder \
61+
--set persistence.size=10Gi
62+
63+
# Create database connection secret for Coder
64+
kubectl create secret generic coder-db-url -n coder \
65+
--from-literal=url="postgres://coder:coder@coder-db-postgresql.coder.svc.cluster.local:5432/coder?sslmode=disable"
66+
```
67+
68+
### 4. Install Coder
69+
70+
```bash
71+
# Add Coder Helm repository
72+
helm repo add coder-v2 https://helm.coder.com/v2
73+
74+
# Install Coder using the provided values file
75+
# Make sure the coder-core-values-v2.yaml file is in your current directory
76+
helm install coder coder-v2/coder \
77+
--namespace coder \
78+
--values coder-core-values-v2.yaml \
79+
--version 2.19.0
80+
```
81+
82+
### 5. Set Up Authentication with AWS Cognito (Optional)
83+
84+
```bash
85+
# Create Cognito User Pool
86+
aws cognito-idp create-user-pool \
87+
--pool-name your-user-pool-name \
88+
--auto-verified-attributes email
89+
90+
# Note the User Pool ID from the output for use in the next command
91+
92+
# Create Coder OIDC App Client
93+
aws cognito-idp create-user-pool-client \
94+
--user-pool-id your-user-pool-id \
95+
--client-name your-client-name \
96+
--generate-secret \
97+
--allowed-o-auth-flows code implicit \
98+
--allowed-o-auth-scopes openid email profile \
99+
--callback-urls "https://your-coder-domain.com/api/v2/users/oidc/callback" \
100+
--logout-urls "https://your-coder-domain.com/api/v2/users/oidc/logout"
101+
102+
# Create Kubernetes secrets for Cognito credentials
103+
kubectl create secret generic aws-cognito-id -n coder \
104+
--from-literal=client-id="your-client-id"
105+
106+
kubectl create secret generic aws-cognito-secret -n coder \
107+
--from-literal=client-secret="your-client-secret"
108+
```
109+
110+
### 6. Update Coder Configuration
111+
112+
Before updating Coder, modify the `coder-core-values-v2.yaml` file with your specific configuration:
113+
114+
- Update `CODER_ACCESS_URL` with your actual domain or load balancer URL
115+
- Update `CODER_WILDCARD_ACCESS_URL` with your wildcard domain
116+
- Update `CODER_OIDC_ISSUER_URL` with your Cognito User Pool URL
117+
- Update any other settings as needed
118+
119+
Then apply the updated configuration:
120+
121+
```bash
122+
helm upgrade coder coder-v2/coder \
123+
--namespace coder \
124+
--values coder-core-values-v2.yaml \
125+
--version 2.19.0
126+
```
127+
128+
### 7. Configure IAM for EC2 Workspace Support
129+
130+
```bash
131+
# Create IAM Role & Trust Relationship for EC2 Workspace Support
132+
# First, make sure you have the ekspodid-trust-policy.json file in your current directory
133+
aws iam create-role --role-name your-coder-ec2-workspace-role --assume-role-policy-document file://ekspodid-trust-policy.json
134+
135+
# Attach necessary policies to the role
136+
aws iam attach-role-policy \
137+
--role-name your-coder-ec2-workspace-role \
138+
--policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess
139+
140+
aws iam attach-role-policy \
141+
--role-name your-coder-ec2-workspace-role \
142+
--policy-arn arn:aws:iam::aws:policy/IAMReadOnlyAccess
143+
144+
# Add IAM Pod Identity association for EC2 Workspace support
145+
aws eks create-pod-identity-association \
146+
--cluster-name your-cluster-name \
147+
--namespace coder \
148+
--service-account coder \
149+
--role-arn arn:aws:iam::your-aws-account-id:role/your-coder-ec2-workspace-role
150+
```
151+
152+
### 8. Set Up CloudFront for HTTPS Access (Recommended)
153+
154+
For production use, it's recommended to:
155+
156+
1. Set up a CloudFront distribution in front of the Kubernetes Load Balancer
157+
2. Configure a custom domain name pointing to your CloudFront distribution
158+
3. Update the Coder configuration with your custom domain
159+
160+
## Customizing Your Deployment
161+
162+
### The coder-core-values-v2.yaml File
163+
164+
The `coder-core-values-v2.yaml` file contains various configuration options for your Coder deployment, including:
165+
166+
- Access URLs and wildcard domains
167+
- Authentication settings (password, OIDC)
168+
- Resource limits and requests
169+
- Service configurations
170+
- High availability settings
171+
172+
Review and modify this file to match your specific requirements before deploying or upgrading Coder.
173+
174+
### Trust Policy for EKS Pod Identity
175+
176+
The `ekspodid-trust-policy.json` file contains the IAM trust relationship that allows EKS pods to assume the IAM role for EC2 workspace provisioning:
177+
178+
```json
179+
{
180+
"Version": "2012-10-17",
181+
"Statement": [
182+
{
183+
"Sid": "AllowEksAuthToAssumeRoleForPodIdentity",
184+
"Effect": "Allow",
185+
"Principal": {
186+
"Service": "pods.eks.amazonaws.com"
187+
},
188+
"Action": [
189+
"sts:AssumeRole",
190+
"sts:TagSession"
191+
]
192+
}
193+
]
194+
}
195+
```
196+
197+
## Next Steps
198+
199+
After deploying Coder, you can:
200+
201+
1. Upload and configure templates from this repository
202+
2. Create standardized development environments for your workshops or demonstrations
203+
3. Invite users to your Coder instance

README.md

Lines changed: 166 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,169 @@
11
# aws-workshop-samples
2-
This project is currently underdevelopment, but meant to aid anyone that needs to quickly spin up Cloud Development Environments for Demos, Labs, Workshops, Hackathons, or simple POC's in AWS using [Coder](https://coder.com/cde). These templates and basic Coder admin scripts can be used in any Coder deployment, but are focused on using the [Coder AWS Marketplace](https://coder.com/docs/install/cloud/ec2) AWS EC2 single VM deployment.
2+
This project is designed to help you quickly spin up Cloud Development Environments for Demos, Labs, Workshops, Hackathons, or simple POC's in AWS using [Coder](https://coder.com/cde). These templates and basic Coder admin scripts can be used in any Coder deployment, but are focused on using either the [Coder AWS Marketplace](https://coder.com/docs/install/cloud/ec2) AWS EC2 single VM deployment or an AWS EKS deployment.
33

4-
1) Follow the steps in the [AWS EC2 Installation Guide](https://coder.com/docs/install/cloud/ec2). Complete the optional step to provide Developers EC2 Workspaces, as the AWS Specific templates provided rely on this capability. Login using the provided pubic IP, and setup your first Coder user.
5-
2) After successfully logging in, clone this Github repo locally so that the provided AWS Workshop Admin template can be uploaded.
4+
## Deployment Options
65

7-
[Under Development - Detailed Instructions for completing Setup]
6+
### Option 1: AWS EC2 Single VM Deployment
7+
8+
1) Follow the steps in the [AWS EC2 Installation Guide](https://coder.com/docs/install/cloud/ec2). Complete the optional step to provide Developers EC2 Workspaces, as the AWS Specific templates provided rely on this capability.
9+
2) Login using the provided public IP, and setup your first Coder user.
10+
3) After successfully logging in, clone this Github repo locally so that the provided AWS Workshop Admin template can be uploaded.
11+
12+
### Option 2: AWS EKS Deployment
13+
14+
This guide walks you through deploying Coder on AWS EKS for workshops or demonstrations.
15+
16+
#### Prerequisites
17+
- AWS Account with appropriate permissions
18+
- Latest versions of the following CLI tools installed:
19+
- AWS CLI
20+
- eksctl
21+
- kubectl
22+
- helm
23+
24+
#### Step 1: Create an EKS Cluster
25+
```bash
26+
# Create EKS Cluster (customize the cluster name and region as needed)
27+
eksctl create cluster --name=your-cluster-name --enable-auto-mode --region your-region
28+
```
29+
30+
#### Step 2: Configure Storage for the Cluster
31+
```bash
32+
# Deploy a K8S StorageClass for dynamic EBS volume provisioning
33+
kubectl apply -f - <<EOF
34+
apiVersion: storage.k8s.io/v1
35+
kind: StorageClass
36+
metadata:
37+
name: gp3-csi
38+
annotations:
39+
storageclass.kubernetes.io/is-default-class: "true"
40+
provisioner: ebs.csi.eks.amazonaws.com
41+
volumeBindingMode: WaitForFirstConsumer
42+
parameters:
43+
type: gp3
44+
encrypted: "true"
45+
allowVolumeExpansion: true
46+
EOF
47+
```
48+
49+
#### Step 3: Set Up Coder with PostgreSQL Database
50+
```bash
51+
# Create Coder namespace
52+
kubectl create namespace coder
53+
54+
# Install PostgreSQL using Helm
55+
helm repo add bitnami https://charts.bitnami.com/bitnami
56+
helm install coder-db bitnami/postgresql \
57+
--namespace coder \
58+
--set auth.username=coder \
59+
--set auth.password=coder \
60+
--set auth.database=coder \
61+
--set persistence.size=10Gi
62+
63+
# Create database connection secret for Coder
64+
kubectl create secret generic coder-db-url -n coder \
65+
--from-literal=url="postgres://coder:coder@coder-db-postgresql.coder.svc.cluster.local:5432/coder?sslmode=disable"
66+
```
67+
68+
#### Step 4: Install Coder
69+
```bash
70+
# Add Coder Helm repository
71+
helm repo add coder-v2 https://helm.coder.com/v2
72+
73+
# Install Coder using the provided values file
74+
# Make sure the coder-core-values-v2.yaml file is in your current directory
75+
helm install coder coder-v2/coder \
76+
--namespace coder \
77+
--values coder-core-values-v2.yaml \
78+
--version 2.19.0
79+
```
80+
81+
#### Step 5: Set Up Authentication with AWS Cognito (Optional)
82+
```bash
83+
# Create Cognito User Pool
84+
aws cognito-idp create-user-pool \
85+
--pool-name your-user-pool-name \
86+
--auto-verified-attributes email
87+
88+
# Note the User Pool ID from the output for use in the next command
89+
90+
# Create Coder OIDC App Client
91+
aws cognito-idp create-user-pool-client \
92+
--user-pool-id your-user-pool-id \
93+
--client-name your-client-name \
94+
--generate-secret \
95+
--allowed-o-auth-flows code implicit \
96+
--allowed-o-auth-scopes openid email profile \
97+
--callback-urls "https://your-coder-domain.com/api/v2/users/oidc/callback" \
98+
--logout-urls "https://your-coder-domain.com/api/v2/users/oidc/logout"
99+
100+
# Note the Client ID and Client Secret from the output
101+
102+
# Create Kubernetes secrets for Cognito credentials
103+
kubectl create secret generic aws-cognito-id -n coder \
104+
--from-literal=client-id="your-client-id"
105+
106+
kubectl create secret generic aws-cognito-secret -n coder \
107+
--from-literal=client-secret="your-client-secret"
108+
```
109+
110+
#### Step 6: Update Coder Configuration
111+
```bash
112+
# Update the coder-core-values-v2.yaml file with your specific configuration:
113+
# - Update CODER_ACCESS_URL with your actual domain or load balancer URL
114+
# - Update CODER_WILDCARD_ACCESS_URL with your wildcard domain
115+
# - Update CODER_OIDC_ISSUER_URL with your Cognito User Pool URL
116+
# - Update any other settings as needed
117+
118+
# Apply the updated configuration
119+
helm upgrade coder coder-v2/coder \
120+
--namespace coder \
121+
--values coder-core-values-v2.yaml \
122+
--version 2.19.0
123+
```
124+
125+
#### Step 7: Configure IAM for EC2 Workspace Support
126+
```bash
127+
# Create IAM Role & Trust Relationship for EC2 Workspace Support
128+
# First, make sure you have the ekspodid-trust-policy.json file in your current directory
129+
aws iam create-role --role-name your-coder-ec2-workspace-role --assume-role-policy-document file://ekspodid-trust-policy.json
130+
131+
# Attach necessary policies to the role
132+
aws iam attach-role-policy \
133+
--role-name your-coder-ec2-workspace-role \
134+
--policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess
135+
136+
aws iam attach-role-policy \
137+
--role-name your-coder-ec2-workspace-role \
138+
--policy-arn arn:aws:iam::aws:policy/IAMReadOnlyAccess
139+
140+
# Add IAM Pod Identity association for EC2 Workspace support
141+
aws eks create-pod-identity-association \
142+
--cluster-name your-cluster-name \
143+
--namespace coder \
144+
--service-account coder \
145+
--role-arn arn:aws:iam::your-aws-account-id:role/your-coder-ec2-workspace-role
146+
```
147+
148+
#### Step 8: Access Your Coder Deployment
149+
After completing the setup, you can access your Coder deployment using the Load Balancer URL provided by the Kubernetes service. For production use, it's recommended to:
150+
151+
1. Set up a CloudFront distribution in front of the Kubernetes Load Balancer to support HTTPS/SSL connections
152+
2. Configure a custom domain name pointing to your CloudFront distribution
153+
3. Update the Coder configuration with your custom domain
154+
155+
## Additional Configuration
156+
157+
### Customizing the Coder Deployment
158+
The `coder-core-values-v2.yaml` file contains various configuration options for your Coder deployment, including:
159+
160+
- Access URLs and wildcard domains
161+
- Authentication settings (password, OIDC)
162+
- Resource limits and requests
163+
- Service configurations
164+
- High availability settings
165+
166+
Review and modify this file to match your specific requirements before deploying or upgrading Coder.
167+
168+
### Template Management
169+
After deploying Coder, you can use the templates provided in this repository to create standardized development environments for your workshops or demonstrations.

0 commit comments

Comments
 (0)