cdk-spot-one-2.0.99
2.0.99
2.0.98
2.0.97
2.0.96
2.0.95
2.0.94
2.0.93
2.0.92
2.0.91
2.0.90
2.0.9
2.0.89
2.0.88
2.0.87
2.0.86
2.0.85
2.0.84
2.0.83
2.0.82
2.0.81
2.0.80
2.0.8
2.0.79
2.0.78
2.0.77
2.0.76
2.0.75
2.0.74
2.0.73
2.0.72
2.0.71
2.0.70
2.0.7
2.0.69
2.0.68
2.0.67
2.0.66
2.0.65
2.0.64
2.0.63
2.0.62
2.0.61
2.0.60
2.0.6
2.0.59
2.0.58
2.0.57
2.0.56
2.0.55
2.0.54
2.0.53
2.0.52
2.0.51
2.0.50
2.0.5
2.0.49
2.0.48
2.0.47
2.0.46
2.0.45
2.0.44
2.0.43
2.0.42
2.0.41
2.0.40
2.0.4
2.0.39
2.0.38
2.0.37
2.0.36
2.0.35
2.0.34
2.0.33
2.0.328
2.0.327
2.0.326
2.0.325
2.0.324
2.0.323
2.0.322
2.0.321
2.0.320
2.0.32
2.0.319
2.0.318
2.0.317
2.0.316
2.0.315
2.0.314
2.0.313
2.0.312
2.0.311
2.0.310
2.0.31
2.0.309
2.0.308
2.0.307
2.0.306
2.0.305
2.0.304
2.0.303
2.0.302
2.0.301
2.0.300
2.0.30
2.0.3
2.0.299
2.0.298
2.0.297
2.0.296
2.0.295
2.0.294
2.0.293
2.0.292
2.0.291
2.0.290
2.0.29
2.0.289
2.0.288
2.0.287
2.0.286
2.0.285
2.0.284
2.0.283
2.0.282
2.0.281
2.0.280
2.0.28
2.0.279
2.0.278
2.0.277
2.0.276
2.0.275
2.0.274
2.0.273
2.0.272
2.0.271
2.0.270
2.0.27
2.0.269
2.0.268
2.0.267
2.0.266
2.0.265
2.0.264
2.0.263
2.0.262
2.0.261
2.0.260
2.0.26
2.0.259
2.0.258
2.0.257
2.0.256
2.0.255
2.0.254
2.0.253
2.0.252
2.0.251
2.0.250
2.0.25
2.0.249
2.0.248
2.0.247
2.0.246
2.0.245
2.0.244
2.0.243
2.0.242
2.0.241
2.0.240
2.0.24
2.0.239
2.0.238
2.0.237
2.0.236
2.0.235
2.0.234
2.0.233
2.0.232
2.0.231
2.0.230
2.0.23
2.0.229
2.0.228
2.0.227
2.0.226
2.0.225
2.0.224
2.0.223
2.0.222
2.0.221
2.0.220
2.0.22
2.0.219
2.0.218
2.0.217
2.0.216
2.0.215
2.0.214
2.0.213
2.0.212
2.0.211
2.0.210
2.0.21
2.0.209
2.0.208
2.0.207
2.0.206
2.0.205
2.0.204
2.0.203
2.0.202
2.0.201
2.0.200
2.0.20
2.0.2
2.0.199
2.0.198
2.0.197
2.0.196
2.0.195
2.0.194
2.0.193
2.0.192
2.0.191
2.0.190
2.0.19
2.0.189
2.0.188
2.0.187
2.0.186
2.0.185
2.0.184
2.0.183
2.0.182
2.0.181
2.0.180
2.0.18
2.0.179
2.0.178
2.0.177
2.0.176
2.0.175
2.0.174
2.0.173
2.0.172
2.0.171
2.0.170
2.0.17
2.0.169
2.0.168
2.0.167
2.0.166
2.0.165
2.0.164
2.0.163
2.0.162
2.0.161
2.0.160
2.0.16
2.0.159
2.0.158
2.0.157
2.0.156
2.0.155
2.0.154
2.0.153
2.0.152
2.0.151
2.0.150
2.0.15
2.0.149
2.0.148
2.0.147
2.0.146
2.0.145
2.0.144
2.0.143
2.0.142
2.0.141
2.0.140
2.0.14
2.0.139
2.0.138
2.0.137
2.0.136
2.0.135
2.0.134
2.0.133
2.0.132
2.0.131
2.0.130
2.0.13
2.0.129
2.0.128
2.0.127
2.0.126
2.0.125
2.0.124
2.0.123
2.0.122
2.0.121
2.0.120
2.0.12
2.0.119
2.0.118
2.0.117
2.0.116
2.0.115
2.0.114
2.0.113
2.0.112
2.0.111
2.0.110
2.0.11
2.0.109
2.0.108
2.0.107
2.0.106
2.0.105
2.0.104
2.0.103
2.0.102
2.0.101
2.0.100
2.0.10
2.0.1
2.0.0
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.30
1.0.3
1.0.29
1.0.28
1.0.27
1.0.26
1.0.25
1.0.24
1.0.23
1.0.22
1.0.21
1.0.2
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.1
1.0.0
0.6.99
0.6.98
0.6.97
0.6.96
0.6.95
0.6.94
0.6.93
0.6.92
0.6.91
0.6.90
0.6.9
0.6.89
0.6.88
0.6.87
0.6.86
0.6.85
0.6.84
0.6.83
0.6.82
0.6.81
0.6.80
0.6.8
0.6.79
0.6.78
0.6.77
0.6.76
0.6.75
0.6.74
0.6.73
0.6.72
0.6.71
0.6.70
0.6.69
0.6.68
0.6.67
0.6.66
0.6.65
0.6.64
0.6.63
0.6.62
0.6.61
0.6.60
0.6.6
0.6.59
0.6.58
0.6.57
0.6.56
0.6.55
0.6.54
0.6.53
0.6.52
0.6.51
0.6.50
0.6.5
0.6.49
0.6.48
0.6.47
0.6.46
0.6.45
0.6.44
0.6.43
0.6.42
0.6.41
0.6.40
0.6.4
0.6.39
0.6.38
0.6.37
0.6.36
0.6.35
0.6.346
0.6.345
0.6.344
0.6.343
0.6.342
0.6.341
0.6.340
0.6.34
0.6.339
0.6.338
0.6.337
0.6.336
0.6.335
0.6.334
0.6.333
0.6.332
0.6.331
0.6.330
0.6.33
0.6.329
0.6.328
0.6.327
0.6.326
0.6.325
0.6.324
0.6.323
0.6.322
0.6.321
0.6.320
0.6.32
0.6.319
0.6.318
0.6.317
0.6.316
0.6.315
0.6.314
0.6.313
0.6.312
0.6.311
0.6.310
0.6.31
0.6.309
0.6.308
0.6.307
0.6.306
0.6.305
0.6.304
0.6.303
0.6.302
0.6.301
0.6.300
0.6.30
0.6.3
0.6.299
0.6.298
0.6.297
0.6.296
0.6.295
0.6.294
0.6.293
0.6.292
0.6.291
0.6.290
0.6.29
0.6.289
0.6.288
0.6.287
0.6.286
0.6.285
0.6.284
0.6.283
0.6.282
0.6.281
0.6.280
0.6.28
0.6.279
0.6.278
0.6.277
0.6.276
0.6.275
0.6.274
0.6.273
0.6.272
0.6.271
0.6.270
0.6.27
0.6.269
0.6.268
0.6.267
0.6.266
0.6.265
0.6.264
0.6.263
0.6.262
0.6.261
0.6.260
0.6.26
0.6.259
0.6.258
0.6.257
0.6.256
0.6.255
0.6.254
0.6.253
0.6.252
0.6.251
0.6.250
0.6.25
0.6.249
0.6.248
0.6.247
0.6.246
0.6.245
0.6.244
0.6.243
0.6.242
0.6.241
0.6.240
0.6.24
0.6.239
0.6.238
0.6.237
0.6.236
0.6.235
0.6.234
0.6.233
0.6.232
0.6.231
0.6.230
0.6.23
0.6.229
0.6.228
0.6.227
0.6.226
0.6.225
0.6.224
0.6.223
0.6.222
0.6.221
0.6.220
0.6.22
0.6.219
0.6.218
0.6.217
0.6.216
0.6.215
0.6.214
0.6.213
0.6.212
0.6.211
0.6.210
0.6.21
0.6.209
0.6.208
0.6.207
0.6.206
0.6.205
0.6.204
0.6.203
0.6.202
0.6.201
0.6.200
0.6.20
0.6.2
0.6.199
0.6.198
0.6.197
0.6.196
0.6.195
0.6.194
0.6.193
0.6.192
0.6.191
0.6.190
0.6.19
0.6.189
0.6.188
0.6.187
0.6.186
0.6.185
0.6.184
0.6.183
0.6.182
0.6.181
0.6.180
0.6.18
0.6.179
0.6.178
0.6.177
0.6.176
0.6.175
0.6.174
0.6.173
0.6.172
0.6.171
0.6.170
0.6.17
0.6.169
0.6.168
0.6.167
0.6.166
0.6.165
0.6.164
0.6.163
0.6.162
0.6.161
0.6.160
0.6.16
0.6.159
0.6.158
0.6.157
0.6.156
0.6.155
0.6.154
0.6.153
0.6.152
0.6.151
0.6.150
0.6.15
0.6.149
0.6.148
0.6.147
0.6.146
0.6.145
0.6.144
0.6.143
0.6.142
0.6.141
0.6.140
0.6.139
0.6.138
0.6.137
0.6.136
0.6.135
0.6.134
0.6.133
0.6.132
0.6.131
0.6.130
0.6.13
0.6.129
0.6.128
0.6.127
0.6.126
0.6.125
0.6.124
0.6.123
0.6.122
0.6.121
0.6.120
0.6.12
0.6.119
0.6.118
0.6.117
0.6.116
0.6.115
0.6.114
0.6.113
0.6.112
0.6.111
0.6.110
0.6.11
0.6.109
0.6.108
0.6.107
0.6.106
0.6.105
0.6.104
0.6.103
0.6.102
0.6.101
0.6.100
0.6.10
0.6.1
0.5.0
0.4.3
0.4.2
0.4.1
0.3.2
0.3.1
0.3.0
0.1.6
0.0.1
2.0.99
2.0.98
2.0.97
2.0.96
2.0.95
2.0.94
2.0.93
2.0.92
2.0.91
2.0.90
2.0.9
2.0.89
2.0.88
2.0.87
2.0.86
2.0.85
2.0.84
2.0.83
2.0.82
2.0.81
2.0.80
2.0.8
2.0.79
2.0.78
2.0.77
2.0.76
2.0.75
2.0.74
2.0.73
2.0.72
2.0.71
2.0.70
2.0.7
2.0.69
2.0.68
2.0.67
2.0.66
2.0.65
2.0.64
2.0.63
2.0.62
2.0.61
2.0.60
2.0.6
2.0.59
2.0.58
2.0.57
2.0.56
2.0.55
2.0.54
2.0.53
2.0.52
2.0.51
2.0.50
2.0.5
2.0.49
2.0.48
2.0.47
2.0.46
2.0.45
2.0.44
2.0.43
2.0.42
2.0.41
2.0.40
2.0.4
2.0.39
2.0.38
2.0.37
2.0.36
2.0.35
2.0.34
2.0.33
2.0.328
2.0.327
2.0.326
2.0.325
2.0.324
2.0.323
2.0.322
2.0.321
2.0.320
2.0.32
2.0.319
2.0.318
2.0.317
2.0.316
2.0.315
2.0.314
2.0.313
2.0.312
2.0.311
2.0.310
2.0.31
2.0.309
2.0.308
2.0.307
2.0.306
2.0.305
2.0.304
2.0.303
2.0.302
2.0.301
2.0.300
2.0.30
2.0.3
2.0.299
2.0.298
2.0.297
2.0.296
2.0.295
2.0.294
2.0.293
2.0.292
2.0.291
2.0.290
2.0.29
2.0.289
2.0.288
2.0.287
2.0.286
2.0.285
2.0.284
2.0.283
2.0.282
2.0.281
2.0.280
2.0.28
2.0.279
2.0.278
2.0.277
2.0.276
2.0.275
2.0.274
2.0.273
2.0.272
2.0.271
2.0.270
2.0.27
2.0.269
2.0.268
2.0.267
2.0.266
2.0.265
2.0.264
2.0.263
2.0.262
2.0.261
2.0.260
2.0.26
2.0.259
2.0.258
2.0.257
2.0.256
2.0.255
2.0.254
2.0.253
2.0.252
2.0.251
2.0.250
2.0.25
2.0.249
2.0.248
2.0.247
2.0.246
2.0.245
2.0.244
2.0.243
2.0.242
2.0.241
2.0.240
2.0.24
2.0.239
2.0.238
2.0.237
2.0.236
2.0.235
2.0.234
2.0.233
2.0.232
2.0.231
2.0.230
2.0.23
2.0.229
2.0.228
2.0.227
2.0.226
2.0.225
2.0.224
2.0.223
2.0.222
2.0.221
2.0.220
2.0.22
2.0.219
2.0.218
2.0.217
2.0.216
2.0.215
2.0.214
2.0.213
2.0.212
2.0.211
2.0.210
2.0.21
2.0.209
2.0.208
2.0.207
2.0.206
2.0.205
2.0.204
2.0.203
2.0.202
2.0.201
2.0.200
2.0.20
2.0.2
2.0.199
2.0.198
2.0.197
2.0.196
2.0.195
2.0.194
2.0.193
2.0.192
2.0.191
2.0.190
2.0.19
2.0.189
2.0.188
2.0.187
2.0.186
2.0.185
2.0.184
2.0.183
2.0.182
2.0.181
2.0.180
2.0.18
2.0.179
2.0.178
2.0.177
2.0.176
2.0.175
2.0.174
2.0.173
2.0.172
2.0.171
2.0.170
2.0.17
2.0.169
2.0.168
2.0.167
2.0.166
2.0.165
2.0.164
2.0.163
2.0.162
2.0.161
2.0.160
2.0.16
2.0.159
2.0.158
2.0.157
2.0.156
2.0.155
2.0.154
2.0.153
2.0.152
2.0.151
2.0.150
2.0.15
2.0.149
2.0.148
2.0.147
2.0.146
2.0.145
2.0.144
2.0.143
2.0.142
2.0.141
2.0.140
2.0.14
2.0.139
2.0.138
2.0.137
2.0.136
2.0.135
2.0.134
2.0.133
2.0.132
2.0.131
2.0.130
2.0.13
2.0.129
2.0.128
2.0.127
2.0.126
2.0.125
2.0.124
2.0.123
2.0.122
2.0.121
2.0.120
2.0.12
2.0.119
2.0.118
2.0.117
2.0.116
2.0.115
2.0.114
2.0.113
2.0.112
2.0.111
2.0.110
2.0.11
2.0.109
2.0.108
2.0.107
2.0.106
2.0.105
2.0.104
2.0.103
2.0.102
2.0.101
2.0.100
2.0.10
2.0.1
2.0.0
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.30
1.0.3
1.0.29
1.0.28
1.0.27
1.0.26
1.0.25
1.0.24
1.0.23
1.0.22
1.0.21
1.0.2
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.1
1.0.0
0.6.99
0.6.98
0.6.97
0.6.96
0.6.95
0.6.94
0.6.93
0.6.92
0.6.91
0.6.90
0.6.9
0.6.89
0.6.88
0.6.87
0.6.86
0.6.85
0.6.84
0.6.83
0.6.82
0.6.81
0.6.80
0.6.8
0.6.79
0.6.78
0.6.77
0.6.76
0.6.75
0.6.74
0.6.73
0.6.72
0.6.71
0.6.70
0.6.69
0.6.68
0.6.67
0.6.66
0.6.65
0.6.64
0.6.63
0.6.62
0.6.61
0.6.60
0.6.6
0.6.59
0.6.58
0.6.57
0.6.56
0.6.55
0.6.54
0.6.53
0.6.52
0.6.51
0.6.50
0.6.5
0.6.49
0.6.48
0.6.47
0.6.46
0.6.45
0.6.44
0.6.43
0.6.42
0.6.41
0.6.40
0.6.4
0.6.39
0.6.38
0.6.37
0.6.36
0.6.35
0.6.346
0.6.345
0.6.344
0.6.343
0.6.342
0.6.341
0.6.340
0.6.34
0.6.339
0.6.338
0.6.337
0.6.336
0.6.335
0.6.334
0.6.333
0.6.332
0.6.331
0.6.330
0.6.33
0.6.329
0.6.328
0.6.327
0.6.326
0.6.325
0.6.324
0.6.323
0.6.322
0.6.321
0.6.320
0.6.32
0.6.319
0.6.318
0.6.317
0.6.316
0.6.315
0.6.314
0.6.313
0.6.312
0.6.311
0.6.310
0.6.31
0.6.309
0.6.308
0.6.307
0.6.306
0.6.305
0.6.304
0.6.303
0.6.302
0.6.301
0.6.300
0.6.30
0.6.3
0.6.299
0.6.298
0.6.297
0.6.296
0.6.295
0.6.294
0.6.293
0.6.292
0.6.291
0.6.290
0.6.29
0.6.289
0.6.288
0.6.287
0.6.286
0.6.285
0.6.284
0.6.283
0.6.282
0.6.281
0.6.280
0.6.28
0.6.279
0.6.278
0.6.277
0.6.276
0.6.275
0.6.274
0.6.273
0.6.272
0.6.271
0.6.270
0.6.27
0.6.269
0.6.268
0.6.267
0.6.266
0.6.265
0.6.264
0.6.263
0.6.262
0.6.261
0.6.260
0.6.26
0.6.259
0.6.258
0.6.257
0.6.256
0.6.255
0.6.254
0.6.253
0.6.252
0.6.251
0.6.250
0.6.25
0.6.249
0.6.248
0.6.247
0.6.246
0.6.245
0.6.244
0.6.243
0.6.242
0.6.241
0.6.240
0.6.24
0.6.239
0.6.238
0.6.237
0.6.236
0.6.235
0.6.234
0.6.233
0.6.232
0.6.231
0.6.230
0.6.23
0.6.229
0.6.228
0.6.227
0.6.226
0.6.225
0.6.224
0.6.223
0.6.222
0.6.221
0.6.220
0.6.22
0.6.219
0.6.218
0.6.217
0.6.216
0.6.215
0.6.214
0.6.213
0.6.212
0.6.211
0.6.210
0.6.21
0.6.209
0.6.208
0.6.207
0.6.206
0.6.205
0.6.204
0.6.203
0.6.202
0.6.201
0.6.200
0.6.20
0.6.2
0.6.199
0.6.198
0.6.197
0.6.196
0.6.195
0.6.194
0.6.193
0.6.192
0.6.191
0.6.190
0.6.19
0.6.189
0.6.188
0.6.187
0.6.186
0.6.185
0.6.184
0.6.183
0.6.182
0.6.181
0.6.180
0.6.18
0.6.179
0.6.178
0.6.177
0.6.176
0.6.175
0.6.174
0.6.173
0.6.172
0.6.171
0.6.170
0.6.17
0.6.169
0.6.168
0.6.167
0.6.166
0.6.165
0.6.164
0.6.163
0.6.162
0.6.161
0.6.160
0.6.16
0.6.159
0.6.158
0.6.157
0.6.156
0.6.155
0.6.154
0.6.153
0.6.152
0.6.151
0.6.150
0.6.15
0.6.149
0.6.148
0.6.147
0.6.146
0.6.145
0.6.144
0.6.143
0.6.142
0.6.141
0.6.140
0.6.139
0.6.138
0.6.137
0.6.136
0.6.135
0.6.134
0.6.133
0.6.132
0.6.131
0.6.130
0.6.13
0.6.129
0.6.128
0.6.127
0.6.126
0.6.125
0.6.124
0.6.123
0.6.122
0.6.121
0.6.120
0.6.12
0.6.119
0.6.118
0.6.117
0.6.116
0.6.115
0.6.114
0.6.113
0.6.112
0.6.111
0.6.110
0.6.11
0.6.109
0.6.108
0.6.107
0.6.106
0.6.105
0.6.104
0.6.103
0.6.102
0.6.101
0.6.100
0.6.10
0.6.1
0.5.0
0.4.3
0.4.2
0.4.1
0.3.2
0.3.1
0.3.0
0.1.6
0.0.1
توضیحات
One spot instance with EIP and defined duration. No interruption.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | cdk-spot-one-2.0.99 |
| نام | cdk-spot-one |
| نسخه کتابخانه | 2.0.99 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Pahud Hsieh<pahudnet@gmail.com> |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/pahud/cdk-spot-one.git |
| آدرس اینترنتی | https://pypi.org/project/cdk-spot-one/ |
| مجوز | Apache-2.0 |
[](https://badge.fury.io/js/cdk-spot-one)
[](https://badge.fury.io/py/cdk-spot-one)

# cdk-spot-one
One spot instance with EIP and defined duration. No interruption.
# Install
Use the npm dist tag to opt in CDKv1 or CDKv2:
```sh
// for CDKv2
npm install cdk-spot-one
or
npm install cdk-spot-one@latest
// for CDKv1
npm install cdk-spot-one@cdkv1
```
# Why
Sometimes we need an Amazon EC2 instance with static fixed IP for testing or development purpose for a duration of
time(probably hours). We need to make sure during this time, no interruption will occur and we don't want to pay
for on-demand rate. `cdk-spot-one` helps you reserve one single spot instance with pre-allocated or new
Elastic IP addresses(EIP) with defined `blockDuration`, during which time the spot instance will be secured with no spot interruption.
Behind the scene, `cdk-spot-one` provisions a spot fleet with capacity of single instance for you and it associates the EIP with this instance. The spot fleet is reserved as spot block with `blockDuration` from one hour up to six hours to ensure the high availability for your spot instance.
Multiple spot instances are possible by simply specifying the `targetCapacity` construct property, but we only associate the EIP with the first spot instance at this moment.
Enjoy your highly durable one spot instance with AWS CDK!
# Constructs
This library provides two major constructs:
## SpotInstance
* Create a spot instance **without** any fleet
* Does **NOT** support [Spot Block](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#fixed-duration-spot-instances)
* Support `stop` or `hibernate` instance
Scenario: To leverage the `stop` or `hibernate` capabilities of the spot instance to persist the data in the ebs volume.
## SpotFleet
* Create a spot instance with a [Spot Fleet](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet.html)
* Support [Spot Block](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#fixed-duration-spot-instances)
* Does **NOT** support `stop` or `hibernate` instance
Scenario: To ensure the availability with no disruption with defined period up to 6 hours.
# Sample
## SpotInstance
```python
import { SpotInstance, AmazonMachineImage } from 'cdk-spot-one';
// Default use Amazon Linux 2
new SpotInstance(stack, 'SpotInstance');
// Custom Id use Ubuntu 20.04 Arm64 Server.
new SpotInstance(stack, 'SpotInstanceUbuntu', {
vpc,
customAmiId: AmazonMachineImage.UBUNTU_20_04_ARM64.getImage(stack).imageId,
defaultInstanceType: new InstanceType('t4g.medium'),
keyName,
blockDeviceMappings: [{ deviceName: '/dev/sda1', ebs: { volumeSize: 20 } }],
additionalUserData: ['curl -fsSL https://get.docker.com -o get-docker.sh', 'sudo sh get-docker.sh'],
});
```
## SpotFleet
```python
import { SpotFleet } from 'cdk-spot-one';
// create the first fleet for one hour and associate with our existing EIP
const fleet = new SpotFleet(stack, 'SpotFleet')
// configure the expiration after 1 hour
fleet.expireAfter(Duration.hours(1))
// create the 2nd fleet with single Gravition 2 instance for 6 hours and associate with new EIP
const fleet2 = new SpotFleet(stack, 'SpotFleet2', {
blockDuration: BlockDuration.SIX_HOURS,
eipAllocationId: 'eipalloc-0d1bc6d85895a5410',
defaultInstanceType: new InstanceType('c6g.large'),
vpc: fleet.vpc,
})
// configure the expiration after 6 hours
fleet2.expireAfter(Duration.hours(6))
// print the instanceId from each spot fleet
new CfnOutput(stack, 'SpotFleetInstanceId', { value: fleet.instanceId })
new CfnOutput(stack, 'SpotFleet2InstanceId', { value: fleet2.instanceId })
```
# Create spot instances without duration block
```python
const fleet = new SpotFleet(stack, 'SpotFleet', {
blockDuration: BlockDuration.NONE,
})
```
NOTE: This kind of spot instance will be interrupted by AWS. However the fleet is using type [maintain](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-fleet.html#spot-fleet-allocation-strategy), the fleet can be refulfilled.
# ARM64 and Graviton 2 support
`cdk-spot-one` selects the latest Amazon Linux 2 AMI for your `ARM64` instances. Simply select the instance types with the `defaultInstanceType` property and the `SpotFleet` will auto configure correct AMI for the instance.
```python
defaultInstanceType: new InstanceType('c6g.large')
```
# ECS Cluster support
See https://github.com/pahud/cdk-spot-one/issues/270#issuecomment-877152685
# Connect with Session Manager(recommended)
You may connect to the spot instance with [Session Manager](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-working-with-sessions-start.html).
```sh
# make sure you have installed session-manager-plugin
$ session-manager-plugin
# start session
$ aws ssm start-session --target INSTANCE_ID
```
# Connect with EC2 SSH Connect
By default the `cdk-spot-one` does not bind any SSH public key for you on the instance. You are encouraged to use `ec2-instance-connect` to send your public key from local followed by one-time SSH connect.
For example:
```sh
pubkey="$HOME/.ssh/aws_2020_id_rsa.pub"
echo "sending public key to ${instanceId}"
aws ec2-instance-connect send-ssh-public-key --instance-id ${instanceId} --instance-os-user ec2-user \
--ssh-public-key file://${pubkey} --availability-zone ${az}
```
## npx ec2-connect INSTANCE_ID
To connect to the instance, run `npx ec2-connect` as below:
```sh
$ npx ec2-connect i-01f827ab9de7b93a9
```
or
```sh
$ npx ec2-connect i-01f827ab9de7b93a9 ~/.ssh/other_public_key_path
```
If you are using different SSH public key(default is ~/.ssh/id_rsa.pub)
نیازمندی
| مقدار | نام |
|---|---|
| <3.0.0,>=2.1.0 | aws-cdk-lib |
| <11.0.0,>=10.0.5 | constructs |
| <2.0.0,>=1.78.1 | jsii |
| >=0.0.3 | publication |
| ~=2.13.3 | typeguard |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| ~=3.7 | Python |
نحوه نصب
نصب پکیج whl cdk-spot-one-2.0.99:
pip install cdk-spot-one-2.0.99.whl
نصب پکیج tar.gz cdk-spot-one-2.0.99:
pip install cdk-spot-one-2.0.99.tar.gz