forked from awslabs/aws-cicd-workshop-cpt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathc9-template.yaml
93 lines (86 loc) · 2.17 KB
/
c9-template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
AWSTemplateFormatVersion: 2010-09-09
Description: Create a Cloud9 environment and EC2 Admin role (create the stack in the AWS Console)
Parameters:
EC2InstanceType:
Description: EC2 instance type on which IDE runs
Type: String
Default: t2.small
AllowedValues:
- t2.micro
- t2.small
- t2.medium
- t2.large
- m3.medium
- m3.large
- m4.large
- c3.large
- c4.large
AutoHibernateTimeout:
Description: How many minutes idle before shutting down the IDE. Options, 30min, 1hr, 4hr, 1day, 1week, Never (0)
Type: Number
Default: 30
AllowedValues:
- 30
- 60
- 240
- 1440
Subnet:
Description: Subnet to launch Cloud 9 instance in
Type: AWS::EC2::Subnet::Id
Resources:
CICDCloud9:
Type: AWS::Cloud9::EnvironmentEC2
DependsOn:
- "AdminInstanceProfile"
Properties:
AutomaticStopTimeMinutes: !Ref AutoHibernateTimeout
Description: "EKS Cloud9 environment"
InstanceType: !Ref 'EC2InstanceType'
Name: cicd-workshop-c9
SubnetId: !Ref 'Subnet'
AdminRole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Principal:
Service:
- "ec2.amazonaws.com"
Action:
- "sts:AssumeRole"
Path: "/"
RolePolicy:
Type: "AWS::IAM::Policy"
Properties:
PolicyName: "Admin"
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Action: "*"
Resource: "*"
Roles:
-
Ref: "AdminRole"
AdminInstanceProfile:
Type: "AWS::IAM::InstanceProfile"
Properties:
Path: "/"
Roles:
-
Ref: "AdminRole"
Outputs:
InstanceProfile:
Description: EC2 instance profile for the Cloud9 instance
Value: !Ref "AdminInstanceProfile"
Cloud9URL:
Description: Cloud9 Environment URL
Value:
Fn::Join:
- ''
- - !Sub https://${AWS::Region}.console.aws.amazon.com/cloud9/ide/
- !Ref 'CICDCloud9'