Skip to content

Commit fb2108c

Browse files
authored
Merge pull request #1 from mariflax/mariflax-patch-1
Create create-fleet
2 parents b99e11a + 94601a0 commit fb2108c

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

awscli/examples/ec2/create-fleet

+156
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
**To create an EC2 Fleet that launches Spot Instances as the default purchasing model**
2+
3+
This example creates an EC2 Fleet using the minimum parameters required to launch a fleet: a launch template, target capacity, and default purchasing model. The launch template is identified by its launch template ID and version number. The target capacity for the fleet is 2 instances, and the default purchasing model is ``spot``, which results in the fleet launching 2 Spot Instances.
4+
5+
When you create an EC2 Fleet, use a JSON file to specify information about the instances to launch.
6+
7+
Command::
8+
9+
aws ec2 create-fleet --cli-input-json file://file_name.json
10+
11+
Output::
12+
13+
{
14+
"FleetId": "fleet-12a34b55-67cd-8ef9-ba9b-9208dEXAMPLE"
15+
}
16+
17+
Where file_name.json contains the following::
18+
19+
{
20+
"LaunchTemplateConfigs": [
21+
{
22+
"LaunchTemplateSpecification": {
23+
"LaunchTemplateId": "lt-0e8c754449b27161c",
24+
"Version": "1"
25+
}
26+
27+
}
28+
],
29+
"TargetCapacitySpecification": {
30+
"TotalTargetCapacity": 2,
31+
"DefaultTargetCapacityType": "spot"
32+
}
33+
}
34+
35+
36+
**To create an EC2 Fleet that launches On-Demand Instances as the default purchasing model**
37+
38+
This example creates an EC2 Fleet using the minimum parameters required to launch a fleet: a launch template, target capacity, and default purchasing model. The launch template is identified by its launch template ID and version number. The target capacity for the fleet is 2 instances, and the default purchasing model is ``on-demand``, which results in the fleet launching 2 On-Demand Instances.
39+
40+
When you create an EC2 Fleet, use a JSON file to specify information about the instances to launch.
41+
42+
Command::
43+
44+
aws ec2 create-fleet --cli-input-json file://file_name.json
45+
46+
Output::
47+
48+
{
49+
"FleetId": "fleet-12a34b55-67cd-8ef9-ba9b-9208dEXAMPLE"
50+
}
51+
52+
Where file_name.json contains the following::
53+
54+
{
55+
"LaunchTemplateConfigs": [
56+
{
57+
"LaunchTemplateSpecification": {
58+
"LaunchTemplateId": "lt-0e8c754449b27161c",
59+
"Version": "1"
60+
}
61+
62+
}
63+
],
64+
"TargetCapacitySpecification": {
65+
"TotalTargetCapacity": 2,
66+
"DefaultTargetCapacityType": "on-demand"
67+
}
68+
}
69+
70+
71+
**To create an EC2 Fleet that launches On-Demand Instances as the primary capacity**
72+
73+
This example creates an EC2 Fleet that specifies the total target capacity of 2 instances for the fleet, and a target capacity of 1 On-Demand Instance. The default purchasing model is ``spot``. The fleet launches 1 On-Demand Instance as specified, but needs to launch one more instance to fulfil the total target capacity. The purchasing model for the difference is calculated as ``TotalTargetCapacity`` – ``OnDemandTargetCapacity`` = ``DefaultTargetCapacityType``, which results in the fleet launching 1 Spot Instance.
74+
75+
When you create an EC2 Fleet, use a JSON file to specify information about the instances to launch.
76+
77+
Command::
78+
79+
aws ec2 create-fleet --cli-input-json file://file_name.json
80+
81+
Output::
82+
83+
{
84+
"FleetId": "fleet-12a34b55-67cd-8ef9-ba9b-9208dEXAMPLE"
85+
}
86+
87+
Where file_name.json contains the following::
88+
89+
{
90+
"LaunchTemplateConfigs": [
91+
{
92+
"LaunchTemplateSpecification": {
93+
"LaunchTemplateId": "lt-0e8c754449b27161c",
94+
"Version": "1"
95+
}
96+
97+
}
98+
],
99+
"TargetCapacitySpecification": {
100+
"TotalTargetCapacity": 2,
101+
"OnDemandTargetCapacity":1,
102+
"DefaultTargetCapacityType": "spot"
103+
}
104+
}
105+
106+
107+
**To create an EC2 Fleet that launches Spot Instances using the lowest-price allocation strategy**
108+
109+
If the allocation strategy for Spot Instances is not specified, the default allocation strategy, which is ``lowest-price``, is used. This example creates an EC2 Fleet using the ``lowest-price`` allocation strategy. The three launch specifications, which override the launch template, have different instance types but the same weighted capacity and subnet. The total target capacity is 2 instances and the default purchasing model is ``spot``. The EC2 Fleet launches 2 Spot Instances using the instance type of the launch specification with the lowest price.
110+
111+
When you create an EC2 Fleet, use a JSON file to specify information about the instances to launch.
112+
113+
Command::
114+
115+
aws ec2 create-fleet --cli-input-json file://file_name.json
116+
117+
Output::
118+
119+
{
120+
"FleetId": "fleet-12a34b55-67cd-8ef9-ba9b-9208dEXAMPLE"
121+
}
122+
123+
Where file_name.json contains the following::
124+
125+
{
126+
"LaunchTemplateConfigs": [
127+
{
128+
"LaunchTemplateSpecification": {
129+
"LaunchTemplateId": "lt-0e8c754449b27161c",
130+
"Version": "1"
131+
}
132+
"Overrides": [
133+
{
134+
"InstanceType": "c4.large",
135+
"WeightedCapacity": 1,
136+
"SubnetId": "subnet-a4f6c5d3"
137+
},
138+
{
139+
"InstanceType": "c3.large",
140+
"WeightedCapacity": 1,
141+
"SubnetId": "subnet-a4f6c5d3"
142+
},
143+
{
144+
"InstanceType": "c5.large",
145+
"WeightedCapacity": 1,
146+
"SubnetId": "subnet-a4f6c5d3"
147+
}
148+
]
149+
150+
}
151+
],
152+
"TargetCapacitySpecification": {
153+
"TotalTargetCapacity": 2,
154+
"DefaultTargetCapacityType": "spot"
155+
}
156+
}

0 commit comments

Comments
 (0)