-
Notifications
You must be signed in to change notification settings - Fork 2
/
cf_ssm.template
85 lines (85 loc) · 2.87 KB
/
cf_ssm.template
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
{
"Parameters":{
"OksoftAmiId":{
"Type":"AWS::SSM::Parameter::Value<String>",
"Default":"ubuntu1804"
},
"OksoftInstanceType":{
"Type":"AWS::SSM::Parameter::Value<String>",
"Default":"myEC2TypeDev"
},
"OksoftRole":{
"Type":"AWS::SSM::Parameter::Value<String>",
"Default":"myRole"
},
"OksoftSubnet":{
"Type":"AWS::SSM::Parameter::Value<String>",
"Default":"mysubnet"
},
"OksoftSG":{
"Type":"AWS::SSM::Parameter::Value<String>",
"Default":"mygroups"
},
"Oksoftaccess":{
"Type":"AWS::SSM::Parameter::Value<String>",
"Default":"myaccess"
},
"Oksoftsecret":{
"Type":"AWS::SSM::Parameter::Value<String>",
"Default":"mysecret"
}
},
"Resources":{
"MySpotFleet":{
"Type":"AWS::EC2::SpotFleet",
"Properties":{
"SpotFleetRequestConfigData":{
"IamFleetRole":!Ref OksoftRole,
"AllocationStrategy":"lowestPrice",
"TargetCapacity":1,
"SpotPrice":"1.105",
"LaunchSpecifications":[
{
"ImageId":!Ref OksoftAmiId,
"InstanceType":!Ref OksoftInstanceType,
"SpotPrice":"0.105",
"NetworkInterfaces":[
{
"DeviceIndex":0,
"SubnetId":!Ref OksoftSubnet,
"Groups":[
!Ref OksoftSG
],
"AssociatePublicIpAddress":true
}
],
"KeyName":"dec15a",
"BlockDeviceMappings":[
{
"DeviceName":"/dev/xvda",
"Ebs":{
"DeleteOnTermination":true,
"VolumeType":"standard",
"VolumeSize":400
}
}
],
"UserData":{
"Fn::Base64":{
"Fn::Sub":"#!/bin/bash -xe\n
yum install -y docker mysql git python-pip\n
pip install aws-ec2-assign-elastic-ip\n
sudo amazon-linux-extras install -y docker\n
aws-ec2-assign-elastic-ip --access-key !Ref Oksoftaccess --secret-key !Ref Oksoftsecret --valid-ips 35.174.198.170\n
service docker start\n
docker run -d -p 8887:8888 -v /tmp:/tmp shantanuo/notebook\n"
}
}
}
],
"Type":"request"
}
}
}
}
}