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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.
#[allow(missing_docs)] // documentation missing in model
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq)]
pub struct RunInstancesInput {
/// <p>The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html">Block device mappings</a> in the <i>Amazon EC2 User Guide</i>.</p>
#[doc(hidden)]
pub block_device_mappings: std::option::Option<std::vec::Vec<crate::types::BlockDeviceMapping>>,
/// <p>The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.</p>
#[doc(hidden)]
pub image_id: std::option::Option<std::string::String>,
/// <p>The instance type. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html">Instance types</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>Default: <code>m1.small</code> </p>
#[doc(hidden)]
pub instance_type: std::option::Option<crate::types::InstanceType>,
/// <p>[EC2-VPC] The number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
#[doc(hidden)]
pub ipv6_address_count: std::option::Option<i32>,
/// <p>[EC2-VPC] The IPv6 addresses from the range of the subnet to associate with the primary network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
#[doc(hidden)]
pub ipv6_addresses: std::option::Option<std::vec::Vec<crate::types::InstanceIpv6Address>>,
/// <p>The ID of the kernel.</p> <important>
/// <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">PV-GRUB</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// </important>
#[doc(hidden)]
pub kernel_id: std::option::Option<std::string::String>,
/// <p>The name of the key pair. You can create a key pair using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html">CreateKeyPair</a> or <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html">ImportKeyPair</a>.</p> <important>
/// <p>If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.</p>
/// </important>
#[doc(hidden)]
pub key_name: std::option::Option<std::string::String>,
/// <p>The maximum number of instances to launch. If you specify more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches the largest possible number of instances above <code>MinCount</code>.</p>
/// <p>Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see <a href="http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2">How many instances can I run in Amazon EC2</a> in the Amazon EC2 FAQ.</p>
#[doc(hidden)]
pub max_count: std::option::Option<i32>,
/// <p>The minimum number of instances to launch. If you specify a minimum that is more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches no instances.</p>
/// <p>Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see <a href="http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2">How many instances can I run in Amazon EC2</a> in the Amazon EC2 General FAQ.</p>
#[doc(hidden)]
pub min_count: std::option::Option<i32>,
/// <p>Specifies whether detailed monitoring is enabled for the instance.</p>
#[doc(hidden)]
pub monitoring: std::option::Option<crate::types::RunInstancesMonitoringEnabled>,
/// <p>The placement for the instance.</p>
#[doc(hidden)]
pub placement: std::option::Option<crate::types::Placement>,
/// <p>The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the Amazon Web Services Resource Center and search for the kernel ID.</p> <important>
/// <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">PV-GRUB</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// </important>
#[doc(hidden)]
pub ramdisk_id: std::option::Option<std::string::String>,
/// <p>The IDs of the security groups. You can create a security group using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html">CreateSecurityGroup</a>.</p>
/// <p>If you specify a network interface, you must specify any security groups as part of the network interface.</p>
#[doc(hidden)]
pub security_group_ids: std::option::Option<std::vec::Vec<std::string::String>>,
/// <p>[EC2-Classic, default VPC] The names of the security groups.</p>
/// <p>If you specify a network interface, you must specify any security groups as part of the network interface.</p>
/// <p>Default: Amazon EC2 uses the default security group.</p>
#[doc(hidden)]
pub security_groups: std::option::Option<std::vec::Vec<std::string::String>>,
/// <p>[EC2-VPC] The ID of the subnet to launch the instance into.</p>
/// <p>If you specify a network interface, you must specify any subnets as part of the network interface.</p>
#[doc(hidden)]
pub subnet_id: std::option::Option<std::string::String>,
/// <p>The user data script to make available to the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Run commands on your Linux instance at launch</a> and <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html">Run commands on your Windows instance at launch</a>. If you are using a command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. User data is limited to 16 KB.</p>
#[doc(hidden)]
pub user_data: std::option::Option<std::string::String>,
/// <p>Reserved.</p>
#[doc(hidden)]
pub additional_info: std::option::Option<std::string::String>,
/// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring Idempotency</a>.</p>
/// <p>Constraints: Maximum 64 ASCII characters</p>
#[doc(hidden)]
pub client_token: std::option::Option<std::string::String>,
/// <p>If you set this parameter to <code>true</code>, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute after launch, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html">ModifyInstanceAttribute</a>. Alternatively, if you set <code>InstanceInitiatedShutdownBehavior</code> to <code>terminate</code>, you can terminate the instance by running the shutdown command from the instance.</p>
/// <p>Default: <code>false</code> </p>
#[doc(hidden)]
pub disable_api_termination: std::option::Option<bool>,
/// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
#[doc(hidden)]
pub dry_run: std::option::Option<bool>,
/// <p>Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.</p>
/// <p>Default: <code>false</code> </p>
#[doc(hidden)]
pub ebs_optimized: std::option::Option<bool>,
/// <p>The name or Amazon Resource Name (ARN) of an IAM instance profile.</p>
#[doc(hidden)]
pub iam_instance_profile: std::option::Option<crate::types::IamInstanceProfileSpecification>,
/// <p>Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).</p>
/// <p>Default: <code>stop</code> </p>
#[doc(hidden)]
pub instance_initiated_shutdown_behavior: std::option::Option<crate::types::ShutdownBehavior>,
/// <p>The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.</p>
#[doc(hidden)]
pub network_interfaces:
std::option::Option<std::vec::Vec<crate::types::InstanceNetworkInterfaceSpecification>>,
/// <p>[EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.</p>
/// <p>Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
#[doc(hidden)]
pub private_ip_address: std::option::Option<std::string::String>,
/// <p>An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html">Amazon EC2 Elastic GPUs</a> in the <i>Amazon EC2 User Guide</i>.</p>
#[doc(hidden)]
pub elastic_gpu_specification:
std::option::Option<std::vec::Vec<crate::types::ElasticGpuSpecification>>,
/// <p>An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.</p>
/// <p>You cannot specify accelerators from different generations in the same request.</p> <note>
/// <p>Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.</p>
/// </note>
#[doc(hidden)]
pub elastic_inference_accelerators:
std::option::Option<std::vec::Vec<crate::types::ElasticInferenceAccelerator>>,
/// <p>The tags to apply to the resources that are created during instance launch.</p>
/// <p>You can specify tags for the following resources only:</p>
/// <ul>
/// <li> <p>Instances</p> </li>
/// <li> <p>Volumes</p> </li>
/// <li> <p>Elastic graphics</p> </li>
/// <li> <p>Spot Instance requests</p> </li>
/// <li> <p>Network interfaces</p> </li>
/// </ul>
/// <p>To tag a resource after it has been created, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html">CreateTags</a>.</p>
#[doc(hidden)]
pub tag_specifications: std::option::Option<std::vec::Vec<crate::types::TagSpecification>>,
/// <p>The launch template to use to launch the instances. Any parameters that you specify in <code>RunInstances</code> override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.</p>
#[doc(hidden)]
pub launch_template: std::option::Option<crate::types::LaunchTemplateSpecification>,
/// <p>The market (purchasing) option for the instances.</p>
/// <p>For <code>RunInstances</code>, persistent Spot Instance requests are only supported when <b>InstanceInterruptionBehavior</b> is set to either <code>hibernate</code> or <code>stop</code>.</p>
#[doc(hidden)]
pub instance_market_options: std::option::Option<crate::types::InstanceMarketOptionsRequest>,
/// <p>The credit option for CPU usage of the burstable performance instance. Valid values are <code>standard</code> and <code>unlimited</code>. To change this attribute after launch, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceCreditSpecification.html"> ModifyInstanceCreditSpecification</a>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html">Burstable performance instances</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>Default: <code>standard</code> (T2 instances) or <code>unlimited</code> (T3/T3a/T4g instances)</p>
/// <p>For T3 instances with <code>host</code> tenancy, only <code>standard</code> is supported.</p>
#[doc(hidden)]
pub credit_specification: std::option::Option<crate::types::CreditSpecificationRequest>,
/// <p>The CPU options for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html">Optimize CPU options</a> in the <i>Amazon EC2 User Guide</i>.</p>
#[doc(hidden)]
pub cpu_options: std::option::Option<crate::types::CpuOptionsRequest>,
/// <p>Information about the Capacity Reservation targeting option. If you do not specify this parameter, the instance's Capacity Reservation preference defaults to <code>open</code>, which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).</p>
#[doc(hidden)]
pub capacity_reservation_specification:
std::option::Option<crate::types::CapacityReservationSpecification>,
/// <p>Indicates whether an instance is enabled for hibernation. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.</p>
#[doc(hidden)]
pub hibernation_options: std::option::Option<crate::types::HibernationOptionsRequest>,
/// <p>The license configurations.</p>
#[doc(hidden)]
pub license_specifications:
std::option::Option<std::vec::Vec<crate::types::LicenseConfigurationRequest>>,
/// <p>The metadata options for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html">Instance metadata and user data</a>.</p>
#[doc(hidden)]
pub metadata_options: std::option::Option<crate::types::InstanceMetadataOptionsRequest>,
/// <p>Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more information, see <a href="https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html"> What is Amazon Web Services Nitro Enclaves?</a> in the <i>Amazon Web Services Nitro Enclaves User Guide</i>.</p>
/// <p>You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.</p>
#[doc(hidden)]
pub enclave_options: std::option::Option<crate::types::EnclaveOptionsRequest>,
/// <p>The options for the instance hostname. The default values are inherited from the subnet.</p>
#[doc(hidden)]
pub private_dns_name_options: std::option::Option<crate::types::PrivateDnsNameOptionsRequest>,
/// <p>The maintenance and recovery options for the instance.</p>
#[doc(hidden)]
pub maintenance_options: std::option::Option<crate::types::InstanceMaintenanceOptionsRequest>,
/// <p>Indicates whether an instance is enabled for stop protection. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection">Stop protection</a>. </p>
#[doc(hidden)]
pub disable_api_stop: std::option::Option<bool>,
}
impl RunInstancesInput {
/// <p>The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html">Block device mappings</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn block_device_mappings(
&self,
) -> std::option::Option<&[crate::types::BlockDeviceMapping]> {
self.block_device_mappings.as_deref()
}
/// <p>The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.</p>
pub fn image_id(&self) -> std::option::Option<&str> {
self.image_id.as_deref()
}
/// <p>The instance type. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html">Instance types</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>Default: <code>m1.small</code> </p>
pub fn instance_type(&self) -> std::option::Option<&crate::types::InstanceType> {
self.instance_type.as_ref()
}
/// <p>[EC2-VPC] The number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn ipv6_address_count(&self) -> std::option::Option<i32> {
self.ipv6_address_count
}
/// <p>[EC2-VPC] The IPv6 addresses from the range of the subnet to associate with the primary network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn ipv6_addresses(&self) -> std::option::Option<&[crate::types::InstanceIpv6Address]> {
self.ipv6_addresses.as_deref()
}
/// <p>The ID of the kernel.</p> <important>
/// <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">PV-GRUB</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// </important>
pub fn kernel_id(&self) -> std::option::Option<&str> {
self.kernel_id.as_deref()
}
/// <p>The name of the key pair. You can create a key pair using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html">CreateKeyPair</a> or <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html">ImportKeyPair</a>.</p> <important>
/// <p>If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.</p>
/// </important>
pub fn key_name(&self) -> std::option::Option<&str> {
self.key_name.as_deref()
}
/// <p>The maximum number of instances to launch. If you specify more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches the largest possible number of instances above <code>MinCount</code>.</p>
/// <p>Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see <a href="http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2">How many instances can I run in Amazon EC2</a> in the Amazon EC2 FAQ.</p>
pub fn max_count(&self) -> std::option::Option<i32> {
self.max_count
}
/// <p>The minimum number of instances to launch. If you specify a minimum that is more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches no instances.</p>
/// <p>Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see <a href="http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2">How many instances can I run in Amazon EC2</a> in the Amazon EC2 General FAQ.</p>
pub fn min_count(&self) -> std::option::Option<i32> {
self.min_count
}
/// <p>Specifies whether detailed monitoring is enabled for the instance.</p>
pub fn monitoring(&self) -> std::option::Option<&crate::types::RunInstancesMonitoringEnabled> {
self.monitoring.as_ref()
}
/// <p>The placement for the instance.</p>
pub fn placement(&self) -> std::option::Option<&crate::types::Placement> {
self.placement.as_ref()
}
/// <p>The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the Amazon Web Services Resource Center and search for the kernel ID.</p> <important>
/// <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">PV-GRUB</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// </important>
pub fn ramdisk_id(&self) -> std::option::Option<&str> {
self.ramdisk_id.as_deref()
}
/// <p>The IDs of the security groups. You can create a security group using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html">CreateSecurityGroup</a>.</p>
/// <p>If you specify a network interface, you must specify any security groups as part of the network interface.</p>
pub fn security_group_ids(&self) -> std::option::Option<&[std::string::String]> {
self.security_group_ids.as_deref()
}
/// <p>[EC2-Classic, default VPC] The names of the security groups.</p>
/// <p>If you specify a network interface, you must specify any security groups as part of the network interface.</p>
/// <p>Default: Amazon EC2 uses the default security group.</p>
pub fn security_groups(&self) -> std::option::Option<&[std::string::String]> {
self.security_groups.as_deref()
}
/// <p>[EC2-VPC] The ID of the subnet to launch the instance into.</p>
/// <p>If you specify a network interface, you must specify any subnets as part of the network interface.</p>
pub fn subnet_id(&self) -> std::option::Option<&str> {
self.subnet_id.as_deref()
}
/// <p>The user data script to make available to the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Run commands on your Linux instance at launch</a> and <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html">Run commands on your Windows instance at launch</a>. If you are using a command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. User data is limited to 16 KB.</p>
pub fn user_data(&self) -> std::option::Option<&str> {
self.user_data.as_deref()
}
/// <p>Reserved.</p>
pub fn additional_info(&self) -> std::option::Option<&str> {
self.additional_info.as_deref()
}
/// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring Idempotency</a>.</p>
/// <p>Constraints: Maximum 64 ASCII characters</p>
pub fn client_token(&self) -> std::option::Option<&str> {
self.client_token.as_deref()
}
/// <p>If you set this parameter to <code>true</code>, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute after launch, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html">ModifyInstanceAttribute</a>. Alternatively, if you set <code>InstanceInitiatedShutdownBehavior</code> to <code>terminate</code>, you can terminate the instance by running the shutdown command from the instance.</p>
/// <p>Default: <code>false</code> </p>
pub fn disable_api_termination(&self) -> std::option::Option<bool> {
self.disable_api_termination
}
/// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
pub fn dry_run(&self) -> std::option::Option<bool> {
self.dry_run
}
/// <p>Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.</p>
/// <p>Default: <code>false</code> </p>
pub fn ebs_optimized(&self) -> std::option::Option<bool> {
self.ebs_optimized
}
/// <p>The name or Amazon Resource Name (ARN) of an IAM instance profile.</p>
pub fn iam_instance_profile(
&self,
) -> std::option::Option<&crate::types::IamInstanceProfileSpecification> {
self.iam_instance_profile.as_ref()
}
/// <p>Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).</p>
/// <p>Default: <code>stop</code> </p>
pub fn instance_initiated_shutdown_behavior(
&self,
) -> std::option::Option<&crate::types::ShutdownBehavior> {
self.instance_initiated_shutdown_behavior.as_ref()
}
/// <p>The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.</p>
pub fn network_interfaces(
&self,
) -> std::option::Option<&[crate::types::InstanceNetworkInterfaceSpecification]> {
self.network_interfaces.as_deref()
}
/// <p>[EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.</p>
/// <p>Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn private_ip_address(&self) -> std::option::Option<&str> {
self.private_ip_address.as_deref()
}
/// <p>An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html">Amazon EC2 Elastic GPUs</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn elastic_gpu_specification(
&self,
) -> std::option::Option<&[crate::types::ElasticGpuSpecification]> {
self.elastic_gpu_specification.as_deref()
}
/// <p>An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.</p>
/// <p>You cannot specify accelerators from different generations in the same request.</p> <note>
/// <p>Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.</p>
/// </note>
pub fn elastic_inference_accelerators(
&self,
) -> std::option::Option<&[crate::types::ElasticInferenceAccelerator]> {
self.elastic_inference_accelerators.as_deref()
}
/// <p>The tags to apply to the resources that are created during instance launch.</p>
/// <p>You can specify tags for the following resources only:</p>
/// <ul>
/// <li> <p>Instances</p> </li>
/// <li> <p>Volumes</p> </li>
/// <li> <p>Elastic graphics</p> </li>
/// <li> <p>Spot Instance requests</p> </li>
/// <li> <p>Network interfaces</p> </li>
/// </ul>
/// <p>To tag a resource after it has been created, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html">CreateTags</a>.</p>
pub fn tag_specifications(&self) -> std::option::Option<&[crate::types::TagSpecification]> {
self.tag_specifications.as_deref()
}
/// <p>The launch template to use to launch the instances. Any parameters that you specify in <code>RunInstances</code> override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.</p>
pub fn launch_template(
&self,
) -> std::option::Option<&crate::types::LaunchTemplateSpecification> {
self.launch_template.as_ref()
}
/// <p>The market (purchasing) option for the instances.</p>
/// <p>For <code>RunInstances</code>, persistent Spot Instance requests are only supported when <b>InstanceInterruptionBehavior</b> is set to either <code>hibernate</code> or <code>stop</code>.</p>
pub fn instance_market_options(
&self,
) -> std::option::Option<&crate::types::InstanceMarketOptionsRequest> {
self.instance_market_options.as_ref()
}
/// <p>The credit option for CPU usage of the burstable performance instance. Valid values are <code>standard</code> and <code>unlimited</code>. To change this attribute after launch, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceCreditSpecification.html"> ModifyInstanceCreditSpecification</a>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html">Burstable performance instances</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>Default: <code>standard</code> (T2 instances) or <code>unlimited</code> (T3/T3a/T4g instances)</p>
/// <p>For T3 instances with <code>host</code> tenancy, only <code>standard</code> is supported.</p>
pub fn credit_specification(
&self,
) -> std::option::Option<&crate::types::CreditSpecificationRequest> {
self.credit_specification.as_ref()
}
/// <p>The CPU options for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html">Optimize CPU options</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn cpu_options(&self) -> std::option::Option<&crate::types::CpuOptionsRequest> {
self.cpu_options.as_ref()
}
/// <p>Information about the Capacity Reservation targeting option. If you do not specify this parameter, the instance's Capacity Reservation preference defaults to <code>open</code>, which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).</p>
pub fn capacity_reservation_specification(
&self,
) -> std::option::Option<&crate::types::CapacityReservationSpecification> {
self.capacity_reservation_specification.as_ref()
}
/// <p>Indicates whether an instance is enabled for hibernation. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.</p>
pub fn hibernation_options(
&self,
) -> std::option::Option<&crate::types::HibernationOptionsRequest> {
self.hibernation_options.as_ref()
}
/// <p>The license configurations.</p>
pub fn license_specifications(
&self,
) -> std::option::Option<&[crate::types::LicenseConfigurationRequest]> {
self.license_specifications.as_deref()
}
/// <p>The metadata options for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html">Instance metadata and user data</a>.</p>
pub fn metadata_options(
&self,
) -> std::option::Option<&crate::types::InstanceMetadataOptionsRequest> {
self.metadata_options.as_ref()
}
/// <p>Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more information, see <a href="https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html"> What is Amazon Web Services Nitro Enclaves?</a> in the <i>Amazon Web Services Nitro Enclaves User Guide</i>.</p>
/// <p>You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.</p>
pub fn enclave_options(&self) -> std::option::Option<&crate::types::EnclaveOptionsRequest> {
self.enclave_options.as_ref()
}
/// <p>The options for the instance hostname. The default values are inherited from the subnet.</p>
pub fn private_dns_name_options(
&self,
) -> std::option::Option<&crate::types::PrivateDnsNameOptionsRequest> {
self.private_dns_name_options.as_ref()
}
/// <p>The maintenance and recovery options for the instance.</p>
pub fn maintenance_options(
&self,
) -> std::option::Option<&crate::types::InstanceMaintenanceOptionsRequest> {
self.maintenance_options.as_ref()
}
/// <p>Indicates whether an instance is enabled for stop protection. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection">Stop protection</a>. </p>
pub fn disable_api_stop(&self) -> std::option::Option<bool> {
self.disable_api_stop
}
}
impl std::fmt::Debug for RunInstancesInput {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("RunInstancesInput");
formatter.field("block_device_mappings", &self.block_device_mappings);
formatter.field("image_id", &self.image_id);
formatter.field("instance_type", &self.instance_type);
formatter.field("ipv6_address_count", &self.ipv6_address_count);
formatter.field("ipv6_addresses", &self.ipv6_addresses);
formatter.field("kernel_id", &self.kernel_id);
formatter.field("key_name", &self.key_name);
formatter.field("max_count", &self.max_count);
formatter.field("min_count", &self.min_count);
formatter.field("monitoring", &self.monitoring);
formatter.field("placement", &self.placement);
formatter.field("ramdisk_id", &self.ramdisk_id);
formatter.field("security_group_ids", &self.security_group_ids);
formatter.field("security_groups", &self.security_groups);
formatter.field("subnet_id", &self.subnet_id);
formatter.field("user_data", &"*** Sensitive Data Redacted ***");
formatter.field("additional_info", &self.additional_info);
formatter.field("client_token", &self.client_token);
formatter.field("disable_api_termination", &self.disable_api_termination);
formatter.field("dry_run", &self.dry_run);
formatter.field("ebs_optimized", &self.ebs_optimized);
formatter.field("iam_instance_profile", &self.iam_instance_profile);
formatter.field(
"instance_initiated_shutdown_behavior",
&self.instance_initiated_shutdown_behavior,
);
formatter.field("network_interfaces", &self.network_interfaces);
formatter.field("private_ip_address", &self.private_ip_address);
formatter.field("elastic_gpu_specification", &self.elastic_gpu_specification);
formatter.field(
"elastic_inference_accelerators",
&self.elastic_inference_accelerators,
);
formatter.field("tag_specifications", &self.tag_specifications);
formatter.field("launch_template", &self.launch_template);
formatter.field("instance_market_options", &self.instance_market_options);
formatter.field("credit_specification", &self.credit_specification);
formatter.field("cpu_options", &self.cpu_options);
formatter.field(
"capacity_reservation_specification",
&self.capacity_reservation_specification,
);
formatter.field("hibernation_options", &self.hibernation_options);
formatter.field("license_specifications", &self.license_specifications);
formatter.field("metadata_options", &self.metadata_options);
formatter.field("enclave_options", &self.enclave_options);
formatter.field("private_dns_name_options", &self.private_dns_name_options);
formatter.field("maintenance_options", &self.maintenance_options);
formatter.field("disable_api_stop", &self.disable_api_stop);
formatter.finish()
}
}
impl RunInstancesInput {
/// Creates a new builder-style object to manufacture [`RunInstancesInput`](crate::operation::run_instances::RunInstancesInput).
pub fn builder() -> crate::operation::run_instances::builders::RunInstancesInputBuilder {
crate::operation::run_instances::builders::RunInstancesInputBuilder::default()
}
}
/// A builder for [`RunInstancesInput`](crate::operation::run_instances::RunInstancesInput).
#[non_exhaustive]
#[derive(std::clone::Clone, std::cmp::PartialEq, std::default::Default)]
pub struct RunInstancesInputBuilder {
pub(crate) block_device_mappings:
std::option::Option<std::vec::Vec<crate::types::BlockDeviceMapping>>,
pub(crate) image_id: std::option::Option<std::string::String>,
pub(crate) instance_type: std::option::Option<crate::types::InstanceType>,
pub(crate) ipv6_address_count: std::option::Option<i32>,
pub(crate) ipv6_addresses:
std::option::Option<std::vec::Vec<crate::types::InstanceIpv6Address>>,
pub(crate) kernel_id: std::option::Option<std::string::String>,
pub(crate) key_name: std::option::Option<std::string::String>,
pub(crate) max_count: std::option::Option<i32>,
pub(crate) min_count: std::option::Option<i32>,
pub(crate) monitoring: std::option::Option<crate::types::RunInstancesMonitoringEnabled>,
pub(crate) placement: std::option::Option<crate::types::Placement>,
pub(crate) ramdisk_id: std::option::Option<std::string::String>,
pub(crate) security_group_ids: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) security_groups: std::option::Option<std::vec::Vec<std::string::String>>,
pub(crate) subnet_id: std::option::Option<std::string::String>,
pub(crate) user_data: std::option::Option<std::string::String>,
pub(crate) additional_info: std::option::Option<std::string::String>,
pub(crate) client_token: std::option::Option<std::string::String>,
pub(crate) disable_api_termination: std::option::Option<bool>,
pub(crate) dry_run: std::option::Option<bool>,
pub(crate) ebs_optimized: std::option::Option<bool>,
pub(crate) iam_instance_profile:
std::option::Option<crate::types::IamInstanceProfileSpecification>,
pub(crate) instance_initiated_shutdown_behavior:
std::option::Option<crate::types::ShutdownBehavior>,
pub(crate) network_interfaces:
std::option::Option<std::vec::Vec<crate::types::InstanceNetworkInterfaceSpecification>>,
pub(crate) private_ip_address: std::option::Option<std::string::String>,
pub(crate) elastic_gpu_specification:
std::option::Option<std::vec::Vec<crate::types::ElasticGpuSpecification>>,
pub(crate) elastic_inference_accelerators:
std::option::Option<std::vec::Vec<crate::types::ElasticInferenceAccelerator>>,
pub(crate) tag_specifications:
std::option::Option<std::vec::Vec<crate::types::TagSpecification>>,
pub(crate) launch_template: std::option::Option<crate::types::LaunchTemplateSpecification>,
pub(crate) instance_market_options:
std::option::Option<crate::types::InstanceMarketOptionsRequest>,
pub(crate) credit_specification: std::option::Option<crate::types::CreditSpecificationRequest>,
pub(crate) cpu_options: std::option::Option<crate::types::CpuOptionsRequest>,
pub(crate) capacity_reservation_specification:
std::option::Option<crate::types::CapacityReservationSpecification>,
pub(crate) hibernation_options: std::option::Option<crate::types::HibernationOptionsRequest>,
pub(crate) license_specifications:
std::option::Option<std::vec::Vec<crate::types::LicenseConfigurationRequest>>,
pub(crate) metadata_options: std::option::Option<crate::types::InstanceMetadataOptionsRequest>,
pub(crate) enclave_options: std::option::Option<crate::types::EnclaveOptionsRequest>,
pub(crate) private_dns_name_options:
std::option::Option<crate::types::PrivateDnsNameOptionsRequest>,
pub(crate) maintenance_options:
std::option::Option<crate::types::InstanceMaintenanceOptionsRequest>,
pub(crate) disable_api_stop: std::option::Option<bool>,
}
impl RunInstancesInputBuilder {
/// Appends an item to `block_device_mappings`.
///
/// To override the contents of this collection use [`set_block_device_mappings`](Self::set_block_device_mappings).
///
/// <p>The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html">Block device mappings</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn block_device_mappings(mut self, input: crate::types::BlockDeviceMapping) -> Self {
let mut v = self.block_device_mappings.unwrap_or_default();
v.push(input);
self.block_device_mappings = Some(v);
self
}
/// <p>The block device mapping, which defines the EBS volumes and instance store volumes to attach to the instance at launch. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html">Block device mappings</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn set_block_device_mappings(
mut self,
input: std::option::Option<std::vec::Vec<crate::types::BlockDeviceMapping>>,
) -> Self {
self.block_device_mappings = input;
self
}
/// <p>The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.</p>
pub fn image_id(mut self, input: impl Into<std::string::String>) -> Self {
self.image_id = Some(input.into());
self
}
/// <p>The ID of the AMI. An AMI ID is required to launch an instance and must be specified here or in a launch template.</p>
pub fn set_image_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.image_id = input;
self
}
/// <p>The instance type. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html">Instance types</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>Default: <code>m1.small</code> </p>
pub fn instance_type(mut self, input: crate::types::InstanceType) -> Self {
self.instance_type = Some(input);
self
}
/// <p>The instance type. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html">Instance types</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>Default: <code>m1.small</code> </p>
pub fn set_instance_type(
mut self,
input: std::option::Option<crate::types::InstanceType>,
) -> Self {
self.instance_type = input;
self
}
/// <p>[EC2-VPC] The number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn ipv6_address_count(mut self, input: i32) -> Self {
self.ipv6_address_count = Some(input);
self
}
/// <p>[EC2-VPC] The number of IPv6 addresses to associate with the primary network interface. Amazon EC2 chooses the IPv6 addresses from the range of your subnet. You cannot specify this option and the option to assign specific IPv6 addresses in the same request. You can specify this option if you've specified a minimum number of instances to launch.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn set_ipv6_address_count(mut self, input: std::option::Option<i32>) -> Self {
self.ipv6_address_count = input;
self
}
/// Appends an item to `ipv6_addresses`.
///
/// To override the contents of this collection use [`set_ipv6_addresses`](Self::set_ipv6_addresses).
///
/// <p>[EC2-VPC] The IPv6 addresses from the range of the subnet to associate with the primary network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn ipv6_addresses(mut self, input: crate::types::InstanceIpv6Address) -> Self {
let mut v = self.ipv6_addresses.unwrap_or_default();
v.push(input);
self.ipv6_addresses = Some(v);
self
}
/// <p>[EC2-VPC] The IPv6 addresses from the range of the subnet to associate with the primary network interface. You cannot specify this option and the option to assign a number of IPv6 addresses in the same request. You cannot specify this option if you've specified a minimum number of instances to launch.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn set_ipv6_addresses(
mut self,
input: std::option::Option<std::vec::Vec<crate::types::InstanceIpv6Address>>,
) -> Self {
self.ipv6_addresses = input;
self
}
/// <p>The ID of the kernel.</p> <important>
/// <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">PV-GRUB</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// </important>
pub fn kernel_id(mut self, input: impl Into<std::string::String>) -> Self {
self.kernel_id = Some(input.into());
self
}
/// <p>The ID of the kernel.</p> <important>
/// <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">PV-GRUB</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// </important>
pub fn set_kernel_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.kernel_id = input;
self
}
/// <p>The name of the key pair. You can create a key pair using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html">CreateKeyPair</a> or <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html">ImportKeyPair</a>.</p> <important>
/// <p>If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.</p>
/// </important>
pub fn key_name(mut self, input: impl Into<std::string::String>) -> Self {
self.key_name = Some(input.into());
self
}
/// <p>The name of the key pair. You can create a key pair using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateKeyPair.html">CreateKeyPair</a> or <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ImportKeyPair.html">ImportKeyPair</a>.</p> <important>
/// <p>If you do not specify a key pair, you can't connect to the instance unless you choose an AMI that is configured to allow users another way to log in.</p>
/// </important>
pub fn set_key_name(mut self, input: std::option::Option<std::string::String>) -> Self {
self.key_name = input;
self
}
/// <p>The maximum number of instances to launch. If you specify more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches the largest possible number of instances above <code>MinCount</code>.</p>
/// <p>Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see <a href="http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2">How many instances can I run in Amazon EC2</a> in the Amazon EC2 FAQ.</p>
pub fn max_count(mut self, input: i32) -> Self {
self.max_count = Some(input);
self
}
/// <p>The maximum number of instances to launch. If you specify more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches the largest possible number of instances above <code>MinCount</code>.</p>
/// <p>Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see <a href="http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2">How many instances can I run in Amazon EC2</a> in the Amazon EC2 FAQ.</p>
pub fn set_max_count(mut self, input: std::option::Option<i32>) -> Self {
self.max_count = input;
self
}
/// <p>The minimum number of instances to launch. If you specify a minimum that is more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches no instances.</p>
/// <p>Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see <a href="http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2">How many instances can I run in Amazon EC2</a> in the Amazon EC2 General FAQ.</p>
pub fn min_count(mut self, input: i32) -> Self {
self.min_count = Some(input);
self
}
/// <p>The minimum number of instances to launch. If you specify a minimum that is more instances than Amazon EC2 can launch in the target Availability Zone, Amazon EC2 launches no instances.</p>
/// <p>Constraints: Between 1 and the maximum number you're allowed for the specified instance type. For more information about the default limits, and how to request an increase, see <a href="http://aws.amazon.com/ec2/faqs/#How_many_instances_can_I_run_in_Amazon_EC2">How many instances can I run in Amazon EC2</a> in the Amazon EC2 General FAQ.</p>
pub fn set_min_count(mut self, input: std::option::Option<i32>) -> Self {
self.min_count = input;
self
}
/// <p>Specifies whether detailed monitoring is enabled for the instance.</p>
pub fn monitoring(mut self, input: crate::types::RunInstancesMonitoringEnabled) -> Self {
self.monitoring = Some(input);
self
}
/// <p>Specifies whether detailed monitoring is enabled for the instance.</p>
pub fn set_monitoring(
mut self,
input: std::option::Option<crate::types::RunInstancesMonitoringEnabled>,
) -> Self {
self.monitoring = input;
self
}
/// <p>The placement for the instance.</p>
pub fn placement(mut self, input: crate::types::Placement) -> Self {
self.placement = Some(input);
self
}
/// <p>The placement for the instance.</p>
pub fn set_placement(mut self, input: std::option::Option<crate::types::Placement>) -> Self {
self.placement = input;
self
}
/// <p>The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the Amazon Web Services Resource Center and search for the kernel ID.</p> <important>
/// <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">PV-GRUB</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// </important>
pub fn ramdisk_id(mut self, input: impl Into<std::string::String>) -> Self {
self.ramdisk_id = Some(input.into());
self
}
/// <p>The ID of the RAM disk to select. Some kernels require additional drivers at launch. Check the kernel requirements for information about whether you need to specify a RAM disk. To find kernel requirements, go to the Amazon Web Services Resource Center and search for the kernel ID.</p> <important>
/// <p>We recommend that you use PV-GRUB instead of kernels and RAM disks. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/UserProvidedkernels.html">PV-GRUB</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// </important>
pub fn set_ramdisk_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.ramdisk_id = input;
self
}
/// Appends an item to `security_group_ids`.
///
/// To override the contents of this collection use [`set_security_group_ids`](Self::set_security_group_ids).
///
/// <p>The IDs of the security groups. You can create a security group using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html">CreateSecurityGroup</a>.</p>
/// <p>If you specify a network interface, you must specify any security groups as part of the network interface.</p>
pub fn security_group_ids(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.security_group_ids.unwrap_or_default();
v.push(input.into());
self.security_group_ids = Some(v);
self
}
/// <p>The IDs of the security groups. You can create a security group using <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateSecurityGroup.html">CreateSecurityGroup</a>.</p>
/// <p>If you specify a network interface, you must specify any security groups as part of the network interface.</p>
pub fn set_security_group_ids(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.security_group_ids = input;
self
}
/// Appends an item to `security_groups`.
///
/// To override the contents of this collection use [`set_security_groups`](Self::set_security_groups).
///
/// <p>[EC2-Classic, default VPC] The names of the security groups.</p>
/// <p>If you specify a network interface, you must specify any security groups as part of the network interface.</p>
/// <p>Default: Amazon EC2 uses the default security group.</p>
pub fn security_groups(mut self, input: impl Into<std::string::String>) -> Self {
let mut v = self.security_groups.unwrap_or_default();
v.push(input.into());
self.security_groups = Some(v);
self
}
/// <p>[EC2-Classic, default VPC] The names of the security groups.</p>
/// <p>If you specify a network interface, you must specify any security groups as part of the network interface.</p>
/// <p>Default: Amazon EC2 uses the default security group.</p>
pub fn set_security_groups(
mut self,
input: std::option::Option<std::vec::Vec<std::string::String>>,
) -> Self {
self.security_groups = input;
self
}
/// <p>[EC2-VPC] The ID of the subnet to launch the instance into.</p>
/// <p>If you specify a network interface, you must specify any subnets as part of the network interface.</p>
pub fn subnet_id(mut self, input: impl Into<std::string::String>) -> Self {
self.subnet_id = Some(input.into());
self
}
/// <p>[EC2-VPC] The ID of the subnet to launch the instance into.</p>
/// <p>If you specify a network interface, you must specify any subnets as part of the network interface.</p>
pub fn set_subnet_id(mut self, input: std::option::Option<std::string::String>) -> Self {
self.subnet_id = input;
self
}
/// <p>The user data script to make available to the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Run commands on your Linux instance at launch</a> and <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html">Run commands on your Windows instance at launch</a>. If you are using a command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. User data is limited to 16 KB.</p>
pub fn user_data(mut self, input: impl Into<std::string::String>) -> Self {
self.user_data = Some(input.into());
self
}
/// <p>The user data script to make available to the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/user-data.html">Run commands on your Linux instance at launch</a> and <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html">Run commands on your Windows instance at launch</a>. If you are using a command line tool, base64-encoding is performed for you, and you can load the text from a file. Otherwise, you must provide base64-encoded text. User data is limited to 16 KB.</p>
pub fn set_user_data(mut self, input: std::option::Option<std::string::String>) -> Self {
self.user_data = input;
self
}
/// <p>Reserved.</p>
pub fn additional_info(mut self, input: impl Into<std::string::String>) -> Self {
self.additional_info = Some(input.into());
self
}
/// <p>Reserved.</p>
pub fn set_additional_info(mut self, input: std::option::Option<std::string::String>) -> Self {
self.additional_info = input;
self
}
/// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring Idempotency</a>.</p>
/// <p>Constraints: Maximum 64 ASCII characters</p>
pub fn client_token(mut self, input: impl Into<std::string::String>) -> Self {
self.client_token = Some(input.into());
self
}
/// <p>Unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you do not specify a client token, a randomly generated token is used for the request to ensure idempotency.</p>
/// <p>For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html">Ensuring Idempotency</a>.</p>
/// <p>Constraints: Maximum 64 ASCII characters</p>
pub fn set_client_token(mut self, input: std::option::Option<std::string::String>) -> Self {
self.client_token = input;
self
}
/// <p>If you set this parameter to <code>true</code>, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute after launch, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html">ModifyInstanceAttribute</a>. Alternatively, if you set <code>InstanceInitiatedShutdownBehavior</code> to <code>terminate</code>, you can terminate the instance by running the shutdown command from the instance.</p>
/// <p>Default: <code>false</code> </p>
pub fn disable_api_termination(mut self, input: bool) -> Self {
self.disable_api_termination = Some(input);
self
}
/// <p>If you set this parameter to <code>true</code>, you can't terminate the instance using the Amazon EC2 console, CLI, or API; otherwise, you can. To change this attribute after launch, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceAttribute.html">ModifyInstanceAttribute</a>. Alternatively, if you set <code>InstanceInitiatedShutdownBehavior</code> to <code>terminate</code>, you can terminate the instance by running the shutdown command from the instance.</p>
/// <p>Default: <code>false</code> </p>
pub fn set_disable_api_termination(mut self, input: std::option::Option<bool>) -> Self {
self.disable_api_termination = input;
self
}
/// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
pub fn dry_run(mut self, input: bool) -> Self {
self.dry_run = Some(input);
self
}
/// <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
pub fn set_dry_run(mut self, input: std::option::Option<bool>) -> Self {
self.dry_run = input;
self
}
/// <p>Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.</p>
/// <p>Default: <code>false</code> </p>
pub fn ebs_optimized(mut self, input: bool) -> Self {
self.ebs_optimized = Some(input);
self
}
/// <p>Indicates whether the instance is optimized for Amazon EBS I/O. This optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal Amazon EBS I/O performance. This optimization isn't available with all instance types. Additional usage charges apply when using an EBS-optimized instance.</p>
/// <p>Default: <code>false</code> </p>
pub fn set_ebs_optimized(mut self, input: std::option::Option<bool>) -> Self {
self.ebs_optimized = input;
self
}
/// <p>The name or Amazon Resource Name (ARN) of an IAM instance profile.</p>
pub fn iam_instance_profile(
mut self,
input: crate::types::IamInstanceProfileSpecification,
) -> Self {
self.iam_instance_profile = Some(input);
self
}
/// <p>The name or Amazon Resource Name (ARN) of an IAM instance profile.</p>
pub fn set_iam_instance_profile(
mut self,
input: std::option::Option<crate::types::IamInstanceProfileSpecification>,
) -> Self {
self.iam_instance_profile = input;
self
}
/// <p>Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).</p>
/// <p>Default: <code>stop</code> </p>
pub fn instance_initiated_shutdown_behavior(
mut self,
input: crate::types::ShutdownBehavior,
) -> Self {
self.instance_initiated_shutdown_behavior = Some(input);
self
}
/// <p>Indicates whether an instance stops or terminates when you initiate shutdown from the instance (using the operating system command for system shutdown).</p>
/// <p>Default: <code>stop</code> </p>
pub fn set_instance_initiated_shutdown_behavior(
mut self,
input: std::option::Option<crate::types::ShutdownBehavior>,
) -> Self {
self.instance_initiated_shutdown_behavior = input;
self
}
/// Appends an item to `network_interfaces`.
///
/// To override the contents of this collection use [`set_network_interfaces`](Self::set_network_interfaces).
///
/// <p>The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.</p>
pub fn network_interfaces(
mut self,
input: crate::types::InstanceNetworkInterfaceSpecification,
) -> Self {
let mut v = self.network_interfaces.unwrap_or_default();
v.push(input);
self.network_interfaces = Some(v);
self
}
/// <p>The network interfaces to associate with the instance. If you specify a network interface, you must specify any security groups and subnets as part of the network interface.</p>
pub fn set_network_interfaces(
mut self,
input: std::option::Option<
std::vec::Vec<crate::types::InstanceNetworkInterfaceSpecification>,
>,
) -> Self {
self.network_interfaces = input;
self
}
/// <p>[EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.</p>
/// <p>Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn private_ip_address(mut self, input: impl Into<std::string::String>) -> Self {
self.private_ip_address = Some(input.into());
self
}
/// <p>[EC2-VPC] The primary IPv4 address. You must specify a value from the IPv4 address range of the subnet.</p>
/// <p>Only one private IP address can be designated as primary. You can't specify this option if you've specified the option to designate a private IP address as the primary IP address in a network interface specification. You cannot specify this option if you're launching more than one instance in the request.</p>
/// <p>You cannot specify this option and the network interfaces option in the same request.</p>
pub fn set_private_ip_address(
mut self,
input: std::option::Option<std::string::String>,
) -> Self {
self.private_ip_address = input;
self
}
/// Appends an item to `elastic_gpu_specification`.
///
/// To override the contents of this collection use [`set_elastic_gpu_specification`](Self::set_elastic_gpu_specification).
///
/// <p>An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html">Amazon EC2 Elastic GPUs</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn elastic_gpu_specification(
mut self,
input: crate::types::ElasticGpuSpecification,
) -> Self {
let mut v = self.elastic_gpu_specification.unwrap_or_default();
v.push(input);
self.elastic_gpu_specification = Some(v);
self
}
/// <p>An elastic GPU to associate with the instance. An Elastic GPU is a GPU resource that you can attach to your Windows instance to accelerate the graphics performance of your applications. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-graphics.html">Amazon EC2 Elastic GPUs</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn set_elastic_gpu_specification(
mut self,
input: std::option::Option<std::vec::Vec<crate::types::ElasticGpuSpecification>>,
) -> Self {
self.elastic_gpu_specification = input;
self
}
/// Appends an item to `elastic_inference_accelerators`.
///
/// To override the contents of this collection use [`set_elastic_inference_accelerators`](Self::set_elastic_inference_accelerators).
///
/// <p>An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.</p>
/// <p>You cannot specify accelerators from different generations in the same request.</p> <note>
/// <p>Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.</p>
/// </note>
pub fn elastic_inference_accelerators(
mut self,
input: crate::types::ElasticInferenceAccelerator,
) -> Self {
let mut v = self.elastic_inference_accelerators.unwrap_or_default();
v.push(input);
self.elastic_inference_accelerators = Some(v);
self
}
/// <p>An elastic inference accelerator to associate with the instance. Elastic inference accelerators are a resource you can attach to your Amazon EC2 instances to accelerate your Deep Learning (DL) inference workloads.</p>
/// <p>You cannot specify accelerators from different generations in the same request.</p> <note>
/// <p>Starting April 15, 2023, Amazon Web Services will not onboard new customers to Amazon Elastic Inference (EI), and will help current customers migrate their workloads to options that offer better price and performance. After April 15, 2023, new customers will not be able to launch instances with Amazon EI accelerators in Amazon SageMaker, Amazon ECS, or Amazon EC2. However, customers who have used Amazon EI at least once during the past 30-day period are considered current customers and will be able to continue using the service.</p>
/// </note>
pub fn set_elastic_inference_accelerators(
mut self,
input: std::option::Option<std::vec::Vec<crate::types::ElasticInferenceAccelerator>>,
) -> Self {
self.elastic_inference_accelerators = input;
self
}
/// Appends an item to `tag_specifications`.
///
/// To override the contents of this collection use [`set_tag_specifications`](Self::set_tag_specifications).
///
/// <p>The tags to apply to the resources that are created during instance launch.</p>
/// <p>You can specify tags for the following resources only:</p>
/// <ul>
/// <li> <p>Instances</p> </li>
/// <li> <p>Volumes</p> </li>
/// <li> <p>Elastic graphics</p> </li>
/// <li> <p>Spot Instance requests</p> </li>
/// <li> <p>Network interfaces</p> </li>
/// </ul>
/// <p>To tag a resource after it has been created, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html">CreateTags</a>.</p>
pub fn tag_specifications(mut self, input: crate::types::TagSpecification) -> Self {
let mut v = self.tag_specifications.unwrap_or_default();
v.push(input);
self.tag_specifications = Some(v);
self
}
/// <p>The tags to apply to the resources that are created during instance launch.</p>
/// <p>You can specify tags for the following resources only:</p>
/// <ul>
/// <li> <p>Instances</p> </li>
/// <li> <p>Volumes</p> </li>
/// <li> <p>Elastic graphics</p> </li>
/// <li> <p>Spot Instance requests</p> </li>
/// <li> <p>Network interfaces</p> </li>
/// </ul>
/// <p>To tag a resource after it has been created, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_CreateTags.html">CreateTags</a>.</p>
pub fn set_tag_specifications(
mut self,
input: std::option::Option<std::vec::Vec<crate::types::TagSpecification>>,
) -> Self {
self.tag_specifications = input;
self
}
/// <p>The launch template to use to launch the instances. Any parameters that you specify in <code>RunInstances</code> override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.</p>
pub fn launch_template(mut self, input: crate::types::LaunchTemplateSpecification) -> Self {
self.launch_template = Some(input);
self
}
/// <p>The launch template to use to launch the instances. Any parameters that you specify in <code>RunInstances</code> override the same parameters in the launch template. You can specify either the name or ID of a launch template, but not both.</p>
pub fn set_launch_template(
mut self,
input: std::option::Option<crate::types::LaunchTemplateSpecification>,
) -> Self {
self.launch_template = input;
self
}
/// <p>The market (purchasing) option for the instances.</p>
/// <p>For <code>RunInstances</code>, persistent Spot Instance requests are only supported when <b>InstanceInterruptionBehavior</b> is set to either <code>hibernate</code> or <code>stop</code>.</p>
pub fn instance_market_options(
mut self,
input: crate::types::InstanceMarketOptionsRequest,
) -> Self {
self.instance_market_options = Some(input);
self
}
/// <p>The market (purchasing) option for the instances.</p>
/// <p>For <code>RunInstances</code>, persistent Spot Instance requests are only supported when <b>InstanceInterruptionBehavior</b> is set to either <code>hibernate</code> or <code>stop</code>.</p>
pub fn set_instance_market_options(
mut self,
input: std::option::Option<crate::types::InstanceMarketOptionsRequest>,
) -> Self {
self.instance_market_options = input;
self
}
/// <p>The credit option for CPU usage of the burstable performance instance. Valid values are <code>standard</code> and <code>unlimited</code>. To change this attribute after launch, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceCreditSpecification.html"> ModifyInstanceCreditSpecification</a>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html">Burstable performance instances</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>Default: <code>standard</code> (T2 instances) or <code>unlimited</code> (T3/T3a/T4g instances)</p>
/// <p>For T3 instances with <code>host</code> tenancy, only <code>standard</code> is supported.</p>
pub fn credit_specification(mut self, input: crate::types::CreditSpecificationRequest) -> Self {
self.credit_specification = Some(input);
self
}
/// <p>The credit option for CPU usage of the burstable performance instance. Valid values are <code>standard</code> and <code>unlimited</code>. To change this attribute after launch, use <a href="https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_ModifyInstanceCreditSpecification.html"> ModifyInstanceCreditSpecification</a>. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html">Burstable performance instances</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>Default: <code>standard</code> (T2 instances) or <code>unlimited</code> (T3/T3a/T4g instances)</p>
/// <p>For T3 instances with <code>host</code> tenancy, only <code>standard</code> is supported.</p>
pub fn set_credit_specification(
mut self,
input: std::option::Option<crate::types::CreditSpecificationRequest>,
) -> Self {
self.credit_specification = input;
self
}
/// <p>The CPU options for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html">Optimize CPU options</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn cpu_options(mut self, input: crate::types::CpuOptionsRequest) -> Self {
self.cpu_options = Some(input);
self
}
/// <p>The CPU options for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-optimize-cpu.html">Optimize CPU options</a> in the <i>Amazon EC2 User Guide</i>.</p>
pub fn set_cpu_options(
mut self,
input: std::option::Option<crate::types::CpuOptionsRequest>,
) -> Self {
self.cpu_options = input;
self
}
/// <p>Information about the Capacity Reservation targeting option. If you do not specify this parameter, the instance's Capacity Reservation preference defaults to <code>open</code>, which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).</p>
pub fn capacity_reservation_specification(
mut self,
input: crate::types::CapacityReservationSpecification,
) -> Self {
self.capacity_reservation_specification = Some(input);
self
}
/// <p>Information about the Capacity Reservation targeting option. If you do not specify this parameter, the instance's Capacity Reservation preference defaults to <code>open</code>, which enables it to run in any open Capacity Reservation that has matching attributes (instance type, platform, Availability Zone).</p>
pub fn set_capacity_reservation_specification(
mut self,
input: std::option::Option<crate::types::CapacityReservationSpecification>,
) -> Self {
self.capacity_reservation_specification = input;
self
}
/// <p>Indicates whether an instance is enabled for hibernation. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.</p>
pub fn hibernation_options(mut self, input: crate::types::HibernationOptionsRequest) -> Self {
self.hibernation_options = Some(input);
self
}
/// <p>Indicates whether an instance is enabled for hibernation. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Hibernate.html">Hibernate your instance</a> in the <i>Amazon EC2 User Guide</i>.</p>
/// <p>You can't enable hibernation and Amazon Web Services Nitro Enclaves on the same instance.</p>
pub fn set_hibernation_options(
mut self,
input: std::option::Option<crate::types::HibernationOptionsRequest>,
) -> Self {
self.hibernation_options = input;
self
}
/// Appends an item to `license_specifications`.
///
/// To override the contents of this collection use [`set_license_specifications`](Self::set_license_specifications).
///
/// <p>The license configurations.</p>
pub fn license_specifications(
mut self,
input: crate::types::LicenseConfigurationRequest,
) -> Self {
let mut v = self.license_specifications.unwrap_or_default();
v.push(input);
self.license_specifications = Some(v);
self
}
/// <p>The license configurations.</p>
pub fn set_license_specifications(
mut self,
input: std::option::Option<std::vec::Vec<crate::types::LicenseConfigurationRequest>>,
) -> Self {
self.license_specifications = input;
self
}
/// <p>The metadata options for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html">Instance metadata and user data</a>.</p>
pub fn metadata_options(mut self, input: crate::types::InstanceMetadataOptionsRequest) -> Self {
self.metadata_options = Some(input);
self
}
/// <p>The metadata options for the instance. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-instance-metadata.html">Instance metadata and user data</a>.</p>
pub fn set_metadata_options(
mut self,
input: std::option::Option<crate::types::InstanceMetadataOptionsRequest>,
) -> Self {
self.metadata_options = input;
self
}
/// <p>Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more information, see <a href="https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html"> What is Amazon Web Services Nitro Enclaves?</a> in the <i>Amazon Web Services Nitro Enclaves User Guide</i>.</p>
/// <p>You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.</p>
pub fn enclave_options(mut self, input: crate::types::EnclaveOptionsRequest) -> Self {
self.enclave_options = Some(input);
self
}
/// <p>Indicates whether the instance is enabled for Amazon Web Services Nitro Enclaves. For more information, see <a href="https://docs.aws.amazon.com/enclaves/latest/user/nitro-enclave.html"> What is Amazon Web Services Nitro Enclaves?</a> in the <i>Amazon Web Services Nitro Enclaves User Guide</i>.</p>
/// <p>You can't enable Amazon Web Services Nitro Enclaves and hibernation on the same instance.</p>
pub fn set_enclave_options(
mut self,
input: std::option::Option<crate::types::EnclaveOptionsRequest>,
) -> Self {
self.enclave_options = input;
self
}
/// <p>The options for the instance hostname. The default values are inherited from the subnet.</p>
pub fn private_dns_name_options(
mut self,
input: crate::types::PrivateDnsNameOptionsRequest,
) -> Self {
self.private_dns_name_options = Some(input);
self
}
/// <p>The options for the instance hostname. The default values are inherited from the subnet.</p>
pub fn set_private_dns_name_options(
mut self,
input: std::option::Option<crate::types::PrivateDnsNameOptionsRequest>,
) -> Self {
self.private_dns_name_options = input;
self
}
/// <p>The maintenance and recovery options for the instance.</p>
pub fn maintenance_options(
mut self,
input: crate::types::InstanceMaintenanceOptionsRequest,
) -> Self {
self.maintenance_options = Some(input);
self
}
/// <p>The maintenance and recovery options for the instance.</p>
pub fn set_maintenance_options(
mut self,
input: std::option::Option<crate::types::InstanceMaintenanceOptionsRequest>,
) -> Self {
self.maintenance_options = input;
self
}
/// <p>Indicates whether an instance is enabled for stop protection. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection">Stop protection</a>. </p>
pub fn disable_api_stop(mut self, input: bool) -> Self {
self.disable_api_stop = Some(input);
self
}
/// <p>Indicates whether an instance is enabled for stop protection. For more information, see <a href="https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Stop_Start.html#Using_StopProtection">Stop protection</a>. </p>
pub fn set_disable_api_stop(mut self, input: std::option::Option<bool>) -> Self {
self.disable_api_stop = input;
self
}
/// Consumes the builder and constructs a [`RunInstancesInput`](crate::operation::run_instances::RunInstancesInput).
pub fn build(
self,
) -> Result<
crate::operation::run_instances::RunInstancesInput,
aws_smithy_http::operation::error::BuildError,
> {
Ok(crate::operation::run_instances::RunInstancesInput {
block_device_mappings: self.block_device_mappings,
image_id: self.image_id,
instance_type: self.instance_type,
ipv6_address_count: self.ipv6_address_count,
ipv6_addresses: self.ipv6_addresses,
kernel_id: self.kernel_id,
key_name: self.key_name,
max_count: self.max_count,
min_count: self.min_count,
monitoring: self.monitoring,
placement: self.placement,
ramdisk_id: self.ramdisk_id,
security_group_ids: self.security_group_ids,
security_groups: self.security_groups,
subnet_id: self.subnet_id,
user_data: self.user_data,
additional_info: self.additional_info,
client_token: self.client_token,
disable_api_termination: self.disable_api_termination,
dry_run: self.dry_run,
ebs_optimized: self.ebs_optimized,
iam_instance_profile: self.iam_instance_profile,
instance_initiated_shutdown_behavior: self.instance_initiated_shutdown_behavior,
network_interfaces: self.network_interfaces,
private_ip_address: self.private_ip_address,
elastic_gpu_specification: self.elastic_gpu_specification,
elastic_inference_accelerators: self.elastic_inference_accelerators,
tag_specifications: self.tag_specifications,
launch_template: self.launch_template,
instance_market_options: self.instance_market_options,
credit_specification: self.credit_specification,
cpu_options: self.cpu_options,
capacity_reservation_specification: self.capacity_reservation_specification,
hibernation_options: self.hibernation_options,
license_specifications: self.license_specifications,
metadata_options: self.metadata_options,
enclave_options: self.enclave_options,
private_dns_name_options: self.private_dns_name_options,
maintenance_options: self.maintenance_options,
disable_api_stop: self.disable_api_stop,
})
}
}
impl std::fmt::Debug for RunInstancesInputBuilder {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
let mut formatter = f.debug_struct("RunInstancesInputBuilder");
formatter.field("block_device_mappings", &self.block_device_mappings);
formatter.field("image_id", &self.image_id);
formatter.field("instance_type", &self.instance_type);
formatter.field("ipv6_address_count", &self.ipv6_address_count);
formatter.field("ipv6_addresses", &self.ipv6_addresses);
formatter.field("kernel_id", &self.kernel_id);
formatter.field("key_name", &self.key_name);
formatter.field("max_count", &self.max_count);
formatter.field("min_count", &self.min_count);
formatter.field("monitoring", &self.monitoring);
formatter.field("placement", &self.placement);
formatter.field("ramdisk_id", &self.ramdisk_id);
formatter.field("security_group_ids", &self.security_group_ids);
formatter.field("security_groups", &self.security_groups);
formatter.field("subnet_id", &self.subnet_id);
formatter.field("user_data", &"*** Sensitive Data Redacted ***");
formatter.field("additional_info", &self.additional_info);
formatter.field("client_token", &self.client_token);
formatter.field("disable_api_termination", &self.disable_api_termination);
formatter.field("dry_run", &self.dry_run);
formatter.field("ebs_optimized", &self.ebs_optimized);
formatter.field("iam_instance_profile", &self.iam_instance_profile);
formatter.field(
"instance_initiated_shutdown_behavior",
&self.instance_initiated_shutdown_behavior,
);
formatter.field("network_interfaces", &self.network_interfaces);
formatter.field("private_ip_address", &self.private_ip_address);
formatter.field("elastic_gpu_specification", &self.elastic_gpu_specification);
formatter.field(
"elastic_inference_accelerators",
&self.elastic_inference_accelerators,
);
formatter.field("tag_specifications", &self.tag_specifications);
formatter.field("launch_template", &self.launch_template);
formatter.field("instance_market_options", &self.instance_market_options);
formatter.field("credit_specification", &self.credit_specification);
formatter.field("cpu_options", &self.cpu_options);
formatter.field(
"capacity_reservation_specification",
&self.capacity_reservation_specification,
);
formatter.field("hibernation_options", &self.hibernation_options);
formatter.field("license_specifications", &self.license_specifications);
formatter.field("metadata_options", &self.metadata_options);
formatter.field("enclave_options", &self.enclave_options);
formatter.field("private_dns_name_options", &self.private_dns_name_options);
formatter.field("maintenance_options", &self.maintenance_options);
formatter.field("disable_api_stop", &self.disable_api_stop);
formatter.finish()
}
}