|
| 1 | +--- |
| 2 | +display_name: AWS EC2 (Windows with DCV) |
| 3 | +description: Provision AWS EC2 Windows VMs with NICE DCV as Coder workspaces |
| 4 | +icon: ../../../site/static/icon/aws.svg |
| 5 | +maintainer_github: coder |
| 6 | +verified: true |
| 7 | +tags: [vm, windows, aws, dcv, persistent-vm] |
| 8 | +--- |
| 9 | + |
| 10 | +# Remote Development on AWS EC2 VMs (Windows with DCV) |
| 11 | + |
| 12 | +Provision AWS EC2 Windows VMs with NICE DCV remote desktop as [Coder workspaces](https://coder.com/docs/workspaces) with this example template. |
| 13 | + |
| 14 | +<!-- TODO: Add screenshot --> |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +### Authentication |
| 19 | + |
| 20 | +By default, this template authenticates to AWS using the provider's default [authentication methods](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication-and-configuration). |
| 21 | + |
| 22 | +The simplest way (without making changes to the template) is via environment variables (e.g. `AWS_ACCESS_KEY_ID`) or a [credentials file](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html#cli-configure-files-format). If you are running Coder on a VM, this file must be in `/home/coder/aws/credentials`. |
| 23 | + |
| 24 | +To use another [authentication method](https://registry.terraform.io/providers/hashicorp/aws/latest/docs#authentication), edit the template. |
| 25 | + |
| 26 | +## Required permissions / policy |
| 27 | + |
| 28 | +The following sample policy allows Coder to create EC2 instances and modify instances provisioned by Coder: |
| 29 | + |
| 30 | +```json |
| 31 | +{ |
| 32 | + "Version": "2012-10-17", |
| 33 | + "Statement": [ |
| 34 | + { |
| 35 | + "Sid": "VisualEditor0", |
| 36 | + "Effect": "Allow", |
| 37 | + "Action": [ |
| 38 | + "ec2:GetDefaultCreditSpecification", |
| 39 | + "ec2:DescribeIamInstanceProfileAssociations", |
| 40 | + "ec2:DescribeTags", |
| 41 | + "ec2:DescribeInstances", |
| 42 | + "ec2:DescribeInstanceTypes", |
| 43 | + "ec2:CreateTags", |
| 44 | + "ec2:RunInstances", |
| 45 | + "ec2:DescribeInstanceCreditSpecifications", |
| 46 | + "ec2:DescribeImages", |
| 47 | + "ec2:ModifyDefaultCreditSpecification", |
| 48 | + "ec2:DescribeVolumes" |
| 49 | + ], |
| 50 | + "Resource": "*" |
| 51 | + }, |
| 52 | + { |
| 53 | + "Sid": "CoderResources", |
| 54 | + "Effect": "Allow", |
| 55 | + "Action": [ |
| 56 | + "ec2:DescribeInstanceAttribute", |
| 57 | + "ec2:UnmonitorInstances", |
| 58 | + "ec2:TerminateInstances", |
| 59 | + "ec2:StartInstances", |
| 60 | + "ec2:StopInstances", |
| 61 | + "ec2:DeleteTags", |
| 62 | + "ec2:MonitorInstances", |
| 63 | + "ec2:CreateTags", |
| 64 | + "ec2:RunInstances", |
| 65 | + "ec2:ModifyInstanceAttribute", |
| 66 | + "ec2:ModifyInstanceCreditSpecification" |
| 67 | + ], |
| 68 | + "Resource": "arn:aws:ec2:*:*:instance/*", |
| 69 | + "Condition": { |
| 70 | + "StringEquals": { |
| 71 | + "aws:ResourceTag/Coder_Provisioned": "true" |
| 72 | + } |
| 73 | + } |
| 74 | + } |
| 75 | + ] |
| 76 | +} |
| 77 | +``` |
| 78 | + |
| 79 | +## Architecture |
| 80 | + |
| 81 | +This template provisions the following resources: |
| 82 | + |
| 83 | +- AWS EC2 Windows Instance (Windows Server 2022) |
| 84 | +- NICE DCV remote desktop server |
| 85 | +- VS Code integration for Windows |
| 86 | + |
| 87 | +Coder uses `aws_ec2_instance_state` to start and stop the VM. This example template is fully persistent, meaning the full filesystem is preserved when the workspace restarts. |
| 88 | + |
| 89 | +## Features |
| 90 | + |
| 91 | +- **NICE DCV**: High-performance remote desktop access to Windows workspaces |
| 92 | +- **VS Code on Windows**: Integrated VS Code experience |
| 93 | +- **Configurable Resources**: Choose instance type and disk size |
| 94 | +- **Multi-Region Support**: Deploy in various AWS regions |
| 95 | + |
| 96 | +## Parameters |
| 97 | + |
| 98 | +- **Region**: AWS region for deployment |
| 99 | +- **Instance Type**: EC2 instance type (m5a.large or m5dn.xlarge) |
| 100 | +- **Home Disk Size**: Root volume size in GB (50-300 GB) |
| 101 | + |
| 102 | +## NICE DCV Access |
| 103 | + |
| 104 | +NICE DCV provides high-performance remote desktop access to your Windows workspace. Connection details including username, password, and port forwarding instructions are available in the workspace metadata. |
| 105 | + |
| 106 | +To connect: |
| 107 | +1. Run `coder port-forward <workspace-name> -p <dcv-port>` |
| 108 | +2. Connect to `localhost:<dcv-port><web-url-path>` in your browser |
| 109 | +3. Use the provided username and password |
| 110 | + |
| 111 | +> **Note** |
| 112 | +> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case. |
0 commit comments