{
  "typeName" : "AWS::EC2::EC2Fleet",
  "description" : "Resource Type definition for AWS::EC2::EC2Fleet",
  "sourceUrl" : "https://github.com/aws-cloudformation",
  "additionalProperties" : false,
  "properties" : {
    "TargetCapacitySpecification" : {
      "$ref" : "#/definitions/TargetCapacitySpecificationRequest"
    },
    "OnDemandOptions" : {
      "$ref" : "#/definitions/OnDemandOptionsRequest"
    },
    "ReservedCapacityOptions" : {
      "$ref" : "#/definitions/ReservedCapacityOptionsRequest"
    },
    "Type" : {
      "type" : "string",
      "enum" : [ "maintain", "request", "instant" ]
    },
    "ExcessCapacityTerminationPolicy" : {
      "type" : "string",
      "enum" : [ "termination", "no-termination" ]
    },
    "TagSpecifications" : {
      "type" : "array",
      "uniqueItems" : false,
      "items" : {
        "$ref" : "#/definitions/TagSpecification"
      }
    },
    "SpotOptions" : {
      "$ref" : "#/definitions/SpotOptionsRequest"
    },
    "ValidFrom" : {
      "type" : "string"
    },
    "ReplaceUnhealthyInstances" : {
      "type" : "boolean"
    },
    "LaunchTemplateConfigs" : {
      "type" : "array",
      "uniqueItems" : false,
      "maxItems" : 50,
      "items" : {
        "$ref" : "#/definitions/FleetLaunchTemplateConfigRequest"
      }
    },
    "FleetId" : {
      "type" : "string"
    },
    "TerminateInstancesWithExpiration" : {
      "type" : "boolean"
    },
    "ValidUntil" : {
      "type" : "string"
    },
    "Context" : {
      "type" : "string"
    }
  },
  "definitions" : {
    "OnDemandOptionsRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "SingleAvailabilityZone" : {
          "type" : "boolean"
        },
        "AllocationStrategy" : {
          "type" : "string"
        },
        "SingleInstanceType" : {
          "type" : "boolean"
        },
        "MinTargetCapacity" : {
          "type" : "integer"
        },
        "MaxTotalPrice" : {
          "type" : "string"
        },
        "CapacityReservationOptions" : {
          "$ref" : "#/definitions/CapacityReservationOptionsRequest"
        }
      }
    },
    "SpotOptionsRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "MaintenanceStrategies" : {
          "$ref" : "#/definitions/MaintenanceStrategies"
        },
        "SingleAvailabilityZone" : {
          "type" : "boolean"
        },
        "AllocationStrategy" : {
          "type" : "string",
          "enum" : [ "lowest-price", "lowestPrice", "diversified", "capacityOptimized", "capacity-optimized", "capacityOptimizedPrioritized", "capacity-optimized-prioritized", "priceCapacityOptimized", "price-capacity-optimized" ]
        },
        "SingleInstanceType" : {
          "type" : "boolean"
        },
        "MinTargetCapacity" : {
          "type" : "integer"
        },
        "MaxTotalPrice" : {
          "type" : "string"
        },
        "InstanceInterruptionBehavior" : {
          "type" : "string",
          "enum" : [ "hibernate", "stop", "terminate" ]
        },
        "InstancePoolsToUseCount" : {
          "type" : "integer"
        }
      }
    },
    "TargetCapacitySpecificationRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "DefaultTargetCapacityType" : {
          "type" : "string",
          "enum" : [ "on-demand", "spot", "reserved-capacity" ]
        },
        "TargetCapacityUnitType" : {
          "type" : "string",
          "enum" : [ "vcpu", "memory-mib", "units" ]
        },
        "TotalTargetCapacity" : {
          "type" : "integer"
        },
        "OnDemandTargetCapacity" : {
          "type" : "integer"
        },
        "SpotTargetCapacity" : {
          "type" : "integer"
        }
      },
      "required" : [ "TotalTargetCapacity" ]
    },
    "FleetLaunchTemplateSpecificationRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LaunchTemplateName" : {
          "type" : "string",
          "minLength" : 3,
          "maxLength" : 128,
          "pattern" : "[a-zA-Z0-9\\(\\)\\.\\-/_]+"
        },
        "LaunchTemplateId" : {
          "type" : "string"
        },
        "Version" : {
          "type" : "string"
        }
      },
      "required" : [ "Version" ]
    },
    "Placement" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "GroupName" : {
          "type" : "string"
        },
        "Tenancy" : {
          "type" : "string"
        },
        "SpreadDomain" : {
          "type" : "string"
        },
        "PartitionNumber" : {
          "type" : "integer"
        },
        "AvailabilityZone" : {
          "type" : "string"
        },
        "Affinity" : {
          "type" : "string"
        },
        "HostId" : {
          "type" : "string"
        },
        "HostResourceGroupArn" : {
          "type" : "string"
        }
      }
    },
    "BlockDeviceMapping" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "DeviceName" : {
          "type" : "string"
        },
        "Ebs" : {
          "$ref" : "#/definitions/EbsBlockDevice"
        },
        "NoDevice" : {
          "type" : "string"
        },
        "VirtualName" : {
          "type" : "string"
        }
      }
    },
    "EbsBlockDevice" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "DeleteOnTermination" : {
          "type" : "boolean"
        },
        "Encrypted" : {
          "type" : "boolean"
        },
        "Iops" : {
          "type" : "integer"
        },
        "KmsKeyId" : {
          "type" : "string"
        },
        "SnapshotId" : {
          "type" : "string"
        },
        "VolumeSize" : {
          "type" : "integer"
        },
        "VolumeType" : {
          "type" : "string",
          "enum" : [ "gp2", "gp3", "io1", "io2", "sc1", "st1", "standard" ]
        }
      }
    },
    "FleetLaunchTemplateConfigRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "LaunchTemplateSpecification" : {
          "$ref" : "#/definitions/FleetLaunchTemplateSpecificationRequest"
        },
        "Overrides" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "$ref" : "#/definitions/FleetLaunchTemplateOverridesRequest"
          }
        }
      }
    },
    "CapacityReservationOptionsRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "UsageStrategy" : {
          "type" : "string",
          "enum" : [ "use-capacity-reservations-first" ]
        }
      }
    },
    "ReservedCapacityOptionsRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ReservationTypes" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "enum" : [ "interruptible-capacity-reservation" ]
          }
        }
      }
    },
    "FleetLaunchTemplateOverridesRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "WeightedCapacity" : {
          "type" : "number"
        },
        "Placement" : {
          "$ref" : "#/definitions/Placement"
        },
        "Priority" : {
          "type" : "number"
        },
        "AvailabilityZone" : {
          "type" : "string"
        },
        "AvailabilityZoneId" : {
          "type" : "string"
        },
        "SubnetId" : {
          "type" : "string"
        },
        "InstanceType" : {
          "type" : "string"
        },
        "InstanceRequirements" : {
          "$ref" : "#/definitions/InstanceRequirementsRequest"
        },
        "MaxPrice" : {
          "type" : "string"
        },
        "BlockDeviceMappings" : {
          "type" : "array",
          "uniqueItems" : true,
          "items" : {
            "$ref" : "#/definitions/BlockDeviceMapping"
          }
        }
      }
    },
    "Tag" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Value" : {
          "type" : "string"
        },
        "Key" : {
          "type" : "string"
        }
      },
      "required" : [ "Value", "Key" ]
    },
    "TagSpecification" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ResourceType" : {
          "type" : "string",
          "enum" : [ "client-vpn-endpoint", "customer-gateway", "dedicated-host", "dhcp-options", "egress-only-internet-gateway", "elastic-gpu", "elastic-ip", "export-image-task", "export-instance-task", "fleet", "fpga-image", "host-reservation", "image", "import-image-task", "import-snapshot-task", "instance", "internet-gateway", "key-pair", "launch-template", "local-gateway-route-table-vpc-association", "natgateway", "network-acl", "network-insights-analysis", "network-insights-path", "network-interface", "placement-group", "reserved-instances", "route-table", "security-group", "snapshot", "spot-fleet-request", "spot-instances-request", "subnet", "traffic-mirror-filter", "traffic-mirror-session", "traffic-mirror-target", "transit-gateway", "transit-gateway-attachment", "transit-gateway-connect-peer", "transit-gateway-multicast-domain", "transit-gateway-route-table", "volume", "vpc", "vpc-flow-log", "vpc-peering-connection", "vpn-connection", "vpn-gateway" ]
        },
        "Tags" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "$ref" : "#/definitions/Tag"
          }
        }
      }
    },
    "InstanceRequirementsRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "VCpuCount" : {
          "$ref" : "#/definitions/VCpuCountRangeRequest"
        },
        "MemoryMiB" : {
          "$ref" : "#/definitions/MemoryMiBRequest"
        },
        "CpuManufacturers" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "enum" : [ "intel", "amd", "amazon-web-services", "apple" ]
          }
        },
        "MemoryGiBPerVCpu" : {
          "$ref" : "#/definitions/MemoryGiBPerVCpuRequest"
        },
        "AllowedInstanceTypes" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "minLength" : 1,
            "maxLength" : 30,
            "pattern" : "[a-zA-Z0-9\\.\\*]+"
          }
        },
        "ExcludedInstanceTypes" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "minLength" : 1,
            "maxLength" : 30,
            "pattern" : "[a-zA-Z0-9\\.\\*]+"
          }
        },
        "InstanceGenerations" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "enum" : [ "current", "previous" ]
          }
        },
        "SpotMaxPricePercentageOverLowestPrice" : {
          "type" : "integer"
        },
        "OnDemandMaxPricePercentageOverLowestPrice" : {
          "type" : "integer"
        },
        "MaxSpotPriceAsPercentageOfOptimalOnDemandPrice" : {
          "type" : "integer"
        },
        "BareMetal" : {
          "type" : "string",
          "enum" : [ "included", "required", "excluded" ]
        },
        "BurstablePerformance" : {
          "type" : "string",
          "enum" : [ "included", "required", "excluded" ]
        },
        "RequireHibernateSupport" : {
          "type" : "boolean"
        },
        "NetworkBandwidthGbps" : {
          "$ref" : "#/definitions/NetworkBandwidthGbpsRequest"
        },
        "NetworkInterfaceCount" : {
          "$ref" : "#/definitions/NetworkInterfaceCountRequest"
        },
        "LocalStorage" : {
          "type" : "string",
          "enum" : [ "included", "required", "excluded" ]
        },
        "LocalStorageTypes" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "enum" : [ "hdd", "ssd" ]
          }
        },
        "TotalLocalStorageGB" : {
          "$ref" : "#/definitions/TotalLocalStorageGBRequest"
        },
        "BaselineEbsBandwidthMbps" : {
          "$ref" : "#/definitions/BaselineEbsBandwidthMbpsRequest"
        },
        "AcceleratorTypes" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "enum" : [ "gpu", "fpga", "inference", "media" ]
          }
        },
        "AcceleratorCount" : {
          "$ref" : "#/definitions/AcceleratorCountRequest"
        },
        "AcceleratorManufacturers" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "enum" : [ "amazon-web-services", "amd", "habana", "nvidia", "xilinx" ]
          }
        },
        "AcceleratorNames" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "type" : "string",
            "enum" : [ "a10g", "a100", "h100", "inferentia", "k520", "k80", "m60", "radeon-pro-v520", "t4", "t4g", "vu9p", "v100", "l40s", "l4", "gaudi-hl-205", "inferentia2", "trainium", "trainium2", "u30" ]
          }
        },
        "AcceleratorTotalMemoryMiB" : {
          "$ref" : "#/definitions/AcceleratorTotalMemoryMiBRequest"
        },
        "BaselinePerformanceFactors" : {
          "$ref" : "#/definitions/BaselinePerformanceFactorsRequest"
        },
        "RequireEncryptionInTransit" : {
          "type" : "boolean"
        }
      }
    },
    "VCpuCountRangeRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "integer"
        },
        "Max" : {
          "type" : "integer"
        }
      }
    },
    "MemoryMiBRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "integer"
        },
        "Max" : {
          "type" : "integer"
        }
      }
    },
    "MemoryGiBPerVCpuRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "number"
        },
        "Max" : {
          "type" : "number"
        }
      }
    },
    "NetworkBandwidthGbpsRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "number"
        },
        "Max" : {
          "type" : "number"
        }
      }
    },
    "NetworkInterfaceCountRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "integer"
        },
        "Max" : {
          "type" : "integer"
        }
      }
    },
    "TotalLocalStorageGBRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "number"
        },
        "Max" : {
          "type" : "number"
        }
      }
    },
    "BaselineEbsBandwidthMbpsRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "integer"
        },
        "Max" : {
          "type" : "integer"
        }
      }
    },
    "AcceleratorCountRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "integer"
        },
        "Max" : {
          "type" : "integer"
        }
      }
    },
    "AcceleratorTotalMemoryMiBRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Min" : {
          "type" : "integer"
        },
        "Max" : {
          "type" : "integer"
        }
      }
    },
    "BaselinePerformanceFactorsRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "Cpu" : {
          "$ref" : "#/definitions/CpuPerformanceFactorRequest"
        }
      }
    },
    "CpuPerformanceFactorRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "References" : {
          "type" : "array",
          "uniqueItems" : false,
          "items" : {
            "$ref" : "#/definitions/PerformanceFactorReferenceRequest"
          }
        }
      }
    },
    "PerformanceFactorReferenceRequest" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "InstanceFamily" : {
          "type" : "string"
        }
      }
    },
    "MaintenanceStrategies" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "CapacityRebalance" : {
          "$ref" : "#/definitions/CapacityRebalance"
        }
      }
    },
    "CapacityRebalance" : {
      "type" : "object",
      "additionalProperties" : false,
      "properties" : {
        "ReplacementStrategy" : {
          "type" : "string",
          "enum" : [ "launch", "launch-before-terminate" ]
        },
        "TerminationDelay" : {
          "type" : "integer"
        }
      }
    }
  },
  "required" : [ "TargetCapacitySpecification", "LaunchTemplateConfigs" ],
  "createOnlyProperties" : [ "/properties/LaunchTemplateConfigs", "/properties/OnDemandOptions", "/properties/ReservedCapacityOptions", "/properties/ReplaceUnhealthyInstances", "/properties/SpotOptions", "/properties/TagSpecifications", "/properties/TerminateInstancesWithExpiration", "/properties/Type", "/properties/ValidFrom", "/properties/ValidUntil", "/properties/TargetCapacitySpecification/TargetCapacityUnitType", "/properties/TargetCapacitySpecification/DefaultTargetCapacityType" ],
  "writeOnlyProperties" : [ "/properties/LaunchTemplateConfigs/*/Overrides/*/Placement/HostResourceGroupArn", "/properties/LaunchTemplateConfigs/*/Overrides/*/Placement/Affinity", "/properties/LaunchTemplateConfigs/*/Overrides/*/Placement/SpreadDomain", "/properties/LaunchTemplateConfigs/*/Overrides/*/Placement/AvailabilityZone", "/properties/LaunchTemplateConfigs/*/Overrides/*/Placement/PartitionNumber", "/properties/LaunchTemplateConfigs/*/Overrides/*/Placement/HostId", "/properties/LaunchTemplateConfigs/*/Overrides/*/Placement/Tenancy" ],
  "primaryIdentifier" : [ "/properties/FleetId" ],
  "readOnlyProperties" : [ "/properties/FleetId" ],
  "handlers" : {
    "create" : {
      "permissions" : [ "ec2:CreateFleet", "ec2:DescribeFleets", "ec2:CreateTags", "ec2:RunInstances", "iam:PassRole", "ec2:DescribeCapacityReservations" ]
    },
    "delete" : {
      "permissions" : [ "ec2:DescribeFleets", "ec2:DescribeFleetInstances", "ec2:DescribeInstanceStatus", "ec2:DeleteFleets", "ec2:TerminateInstances" ],
      "timeoutInMinutes" : 40
    },
    "list" : {
      "handlerSchema" : {
        "properties" : {
          "Type" : {
            "$ref" : "resource-schema.json#/properties/Type"
          }
        }
      },
      "permissions" : [ "ec2:DescribeFleets" ]
    },
    "read" : {
      "permissions" : [ "ec2:DescribeFleets" ]
    },
    "update" : {
      "permissions" : [ "ec2:ModifyFleet", "ec2:DescribeFleets" ]
    }
  },
  "tagging" : {
    "taggable" : false
  }
}