|
1 | 1 | # 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. |
3 | 3 |
|
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 |
6 | 5 |
|
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 | +Find the latest stable release from the [Coder Releases Page](https://github.com/coder/coder/releases) |
| 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 <Latest Stable Release> |
| 80 | +``` |
| 81 | + |
| 82 | +#### Step 5: Update Coder Configuration |
| 83 | +```bash |
| 84 | +# Update the coder-core-values-v2.yaml file with your specific configuration: |
| 85 | +# - Update CODER_ACCESS_URL with your actual domain or load balancer URL |
| 86 | +# - Update CODER_WILDCARD_ACCESS_URL with your wildcard domain |
| 87 | +# - Update CODER_OIDC_ISSUER_URL with your Cognito User Pool URL |
| 88 | +# - Update any other settings as needed |
| 89 | + |
| 90 | +# Apply the updated configuration |
| 91 | +helm upgrade coder coder-v2/coder \ |
| 92 | + --namespace coder \ |
| 93 | + --values coder-core-values-v2.yaml \ |
| 94 | + --version <Latest Stable Release> |
| 95 | +``` |
| 96 | + |
| 97 | +#### Step 6: Configure IAM for EC2 Workspace Support |
| 98 | +```bash |
| 99 | +# Create IAM Role & Trust Relationship for EC2 Workspace Support |
| 100 | +# First, make sure you have the ekspodid-trust-policy.json file in your current directory |
| 101 | +aws iam create-role --role-name your-coder-ec2-workspace-role --assume-role-policy-document file://ekspodid-trust-policy.json |
| 102 | + |
| 103 | +# Attach necessary policies to the role |
| 104 | +aws iam attach-role-policy \ |
| 105 | + --role-name your-coder-ec2-workspace-role \ |
| 106 | + --policy-arn arn:aws:iam::aws:policy/AmazonEC2FullAccess |
| 107 | + |
| 108 | +aws iam attach-role-policy \ |
| 109 | + --role-name your-coder-ec2-workspace-role \ |
| 110 | + --policy-arn arn:aws:iam::aws:policy/IAMReadOnlyAccess |
| 111 | + |
| 112 | +# Add IAM Pod Identity association for EC2 Workspace support |
| 113 | +aws eks create-pod-identity-association \ |
| 114 | + --cluster-name your-cluster-name \ |
| 115 | + --namespace coder \ |
| 116 | + --service-account coder \ |
| 117 | + --role-arn arn:aws:iam::your-aws-account-id:role/your-coder-ec2-workspace-role |
| 118 | +``` |
| 119 | + |
| 120 | +#### Step 7: Access Your Coder Deployment |
| 121 | +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: |
| 122 | + |
| 123 | +1. Set up a CloudFront distribution in front of the Kubernetes Load Balancer to support HTTPS/SSL connections |
| 124 | +2. Configure a custom domain name pointing to your CloudFront distribution |
| 125 | +3. Update the Coder configuration with your custom domain |
| 126 | + |
| 127 | +## Additional Configuration |
| 128 | + |
| 129 | +### Customizing the Coder Deployment |
| 130 | +The `coder-core-values-v2.yaml` file in the [coder-admin](./coder-admin) directory contains various configuration options for your Coder deployment, including: |
| 131 | + |
| 132 | +- Access URLs and wildcard domains |
| 133 | +- Authentication settings (password, OIDC) |
| 134 | +- Resource limits and requests |
| 135 | +- Service configurations |
| 136 | +- High availability settings |
| 137 | + |
| 138 | +Review and modify this file to match your specific requirements before deploying or upgrading Coder. |
| 139 | + |
| 140 | +### Template Management |
| 141 | +After accessing your Coder Deployment and setting up your Coder Admin account, tryout the [GitOps Demo](https://github.com/greg-the-coder/partner-demo-gitops) to review the different Coder CDE capabilities and test out a basic GitOps template management flow. |
0 commit comments