-
Notifications
You must be signed in to change notification settings - Fork 0
/
crowleycloud.yml
99 lines (99 loc) · 2.61 KB
/
crowleycloud.yml
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
94
95
96
97
98
99
AWSTemplateFormatVersion: "2010-09-09"
Description: Crowley.cloud Cloudformation Template
Parameters:
ElasticIP:
Description: ParameterDescription
Type: String
Default: ParameterDefault
Resources:
crowleycloud:
Type: AWS::EC2::Instance
Properties:
ImageId: ami-02eac2c0129f6376b
InstanceType: t2.micro
KeyName: crowley.cloud
IamInstanceProfile: !Ref crowleycloudiaminstanceprofile
SecurityGroupIds:
- !GetAtt crowleycloudsecuritygroup.GroupId
UserData:
!Base64 |
#!bin/bash -x
sudo yum -y update
sudo yum -y install python
echo ALLDONE
crowleycloudsecuritygroup:
Type: AWS::EC2::SecurityGroup
Properties:
GroupDescription: Allow http/https to client host
VpcId: vpc-c7ff8ea3
SecurityGroupIngress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
SecurityGroupEgress:
- IpProtocol: tcp
FromPort: 80
ToPort: 80
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: 443
ToPort: 443
CidrIp: 0.0.0.0/0
- IpProtocol: tcp
FromPort: 22
ToPort: 22
CidrIp: 0.0.0.0/0
crowleycloudEIPAssociation:
Type: AWS::EC2::EIPAssociation
Properties:
EIP: !Ref ElasticIP
InstanceId: !Ref crowleycloud
crowleycloudiaminstanceprofile:
Type: AWS::IAM::InstanceProfile
Properties:
Path: "/"
Roles:
- !Ref crowleycloudrole
crowleycloudrole:
Type: "AWS::IAM::Role"
Properties:
AssumeRolePolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Principal:
Service:
- "ec2.amazonaws.com"
- "s3.amazonaws.com"
Action:
- "sts:AssumeRole"
Path: "/"
crowleycloudpolicy:
Type: "AWS::IAM::Policy"
Properties:
PolicyName: "crowleycloudpolicy"
PolicyDocument:
Version: "2012-10-17"
Statement:
-
Effect: "Allow"
Action: "s3:*"
Resource:
- !GetAtt crowleycloudbucket.Arn
- !Join [ '/', [ !GetAtt crowleycloudbucket.Arn, '*' ] ]
Roles:
- !Ref crowleycloudrole
crowleycloudbucket:
Type: AWS::S3::Bucket
Properties:
BucketName: crowley.cloud