Skip to content

Commit a34ceb5

Browse files
authored
Create README.md
1 parent 72e42ad commit a34ceb5

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
display_name: AWS EC2 (Devcontainer)
3+
description: Provision AWS EC2 VMs with a devcontainer as Coder workspaces
4+
icon: ../../../site/static/icon/aws.png
5+
maintainer_github: coder
6+
verified: true
7+
tags: [vm, linux, aws, persistent, devcontainer]
8+
---
9+
10+
# Remote Development on AWS EC2 VMs using a Devcontainer
11+
12+
Provision AWS EC2 VMs as [Coder workspaces](https://coder.com/docs/v2/latest) 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
29+
instances provisioned by Coder:
30+
31+
```json
32+
{
33+
"Version": "2012-10-17",
34+
"Statement": [
35+
{
36+
"Sid": "VisualEditor0",
37+
"Effect": "Allow",
38+
"Action": [
39+
"ec2:GetDefaultCreditSpecification",
40+
"ec2:DescribeIamInstanceProfileAssociations",
41+
"ec2:DescribeTags",
42+
"ec2:DescribeInstances",
43+
"ec2:DescribeInstanceTypes",
44+
"ec2:CreateTags",
45+
"ec2:RunInstances",
46+
"ec2:DescribeInstanceCreditSpecifications",
47+
"ec2:DescribeImages",
48+
"ec2:ModifyDefaultCreditSpecification",
49+
"ec2:DescribeVolumes"
50+
],
51+
"Resource": "*"
52+
},
53+
{
54+
"Sid": "CoderResources",
55+
"Effect": "Allow",
56+
"Action": [
57+
"ec2:DescribeInstanceAttribute",
58+
"ec2:UnmonitorInstances",
59+
"ec2:TerminateInstances",
60+
"ec2:StartInstances",
61+
"ec2:StopInstances",
62+
"ec2:DeleteTags",
63+
"ec2:MonitorInstances",
64+
"ec2:CreateTags",
65+
"ec2:RunInstances",
66+
"ec2:ModifyInstanceAttribute",
67+
"ec2:ModifyInstanceCreditSpecification"
68+
],
69+
"Resource": "arn:aws:ec2:*:*:instance/*",
70+
"Condition": {
71+
"StringEquals": {
72+
"aws:ResourceTag/Coder_Provisioned": "true"
73+
}
74+
}
75+
}
76+
]
77+
}
78+
```
79+
80+
## Architecture
81+
82+
This template provisions the following resources:
83+
84+
- AWS Instance
85+
86+
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. See this [community example](https://github.com/bpmct/coder-templates/tree/main/aws-linux-ephemeral) of an ephemeral AWS instance.
87+
88+
> **Note**
89+
> This template is designed to be a starting point! Edit the Terraform to extend the template to support your use case.
90+
91+
## code-server
92+
93+
`code-server` is installed via the [`code-server`](https://registry.coder.com/modules/code-server) registry module. For a list of all modules and templates pplease check [Coder Registry](https://registry.coder.com).

0 commit comments

Comments
 (0)