UNPKG

@pulumi/awsx

Version:

[![Actions Status](https://github.com/pulumi/pulumi-awsx/workflows/master/badge.svg)](https://github.com/pulumi/pulumi-awsx/actions) [![Slack](http://www.pulumi.com/images/docs/badges/slack.svg)](https://slack.pulumi.com) [![NPM version](https://badge.fur

179 lines (178 loc) 8.02 kB
import * as aws from "@pulumi/aws"; import * as pulumi from "@pulumi/pulumi"; import * as ec2 from "../ec2"; import * as lb from "../lb"; import { Cluster } from "./cluster"; import { TaskDefinition } from "./taskDefinition"; export declare abstract class Service extends pulumi.ComponentResource { readonly service: aws.ecs.Service; readonly cluster: Cluster; readonly taskDefinition: TaskDefinition; /** * Mapping from container in this service to the ELB listener exposing it through a load * balancer. Only present if a listener was provided in [Container.portMappings] or in * [Container.applicationListener] or [Container.networkListener]. */ readonly listeners: Record<string, lb.Listener>; readonly applicationListeners: Record<string, lb.ApplicationListener>; readonly networkListeners: Record<string, lb.NetworkListener>; constructor(type: string, name: string, args: ServiceArgs, opts: pulumi.ComponentResourceOptions); } export interface ServiceLoadBalancer { containerName: pulumi.Input<string>; containerPort: pulumi.Input<number>; elbName?: pulumi.Input<string>; targetGroupArn?: pulumi.Input<string>; } export interface ServiceLoadBalancerProvider { serviceLoadBalancer(name: string, parent: pulumi.Resource): pulumi.Input<ServiceLoadBalancer>; } export interface NetworkConfiguration { /** * Assign a public IP address to the ENI (Fargate launch type only). Valid values are true or * false. Default false. * */ assignPublicIp?: pulumi.Input<boolean>; /** * The security groups associated with the task or service. If you do not specify a security * group, the default security group for the VPC is used. */ securityGroups?: pulumi.Input<pulumi.Input<string>[]>; /** * The subnets associated with the task or service. */ subnets: pulumi.Input<pulumi.Input<string>[]>; } export interface ServiceArgs { /** * The capacity provider strategy to use for the service. */ capacityProviderStrategies?: aws.ecs.ServiceArgs["capacityProviderStrategies"]; /** * Configuration block for deployment circuit breaker. */ deploymentCircuitBreaker?: aws.ecs.ServiceArgs["deploymentCircuitBreaker"]; /** * Configuration block containing deployment controller configuration. */ deploymentController?: aws.ecs.ServiceArgs["deploymentController"]; /** * The upper limit (as a percentage of the service's desiredCount) of the number of running * tasks that can be running in a service during a deployment. Not valid when using the `DAEMON` * scheduling strategy. */ deploymentMaximumPercent?: pulumi.Input<number>; /** * The lower limit (as a percentage of the service's desiredCount) of the number of running * tasks that must remain running and healthy in a service during a deployment. */ deploymentMinimumHealthyPercent?: pulumi.Input<number>; /** * The number of instances of the task definition to place and keep running. Defaults to 1. Do * not specify if using the `DAEMON` scheduling strategy. */ desiredCount?: pulumi.Input<number>; /** * Specifies whether to enable Amazon ECS managed tags for the tasks within the service. */ enableEcsManagedTags?: pulumi.Input<boolean>; /** * Specifies whether to enable Amazon ECS Exec for the tasks within the service. */ enableExecuteCommand?: pulumi.Input<boolean>; /** * Enable to force a new task deployment of the service. This can be used to update tasks * to use a newer Docker image with same image/tag combination (e.g. `myimage:latest`), roll * Fargate tasks onto a newer platform version, or immediately deploy `orderedPlacementStrategy` * and `placementConstraints` updates. */ forceNewDeployment?: pulumi.Input<boolean>; /** * Seconds to ignore failing load balancer health checks on newly instantiated tasks to prevent * premature shutdown, up to 7200. Only valid for services configured to use load balancers. */ healthCheckGracePeriodSeconds?: pulumi.Input<number>; /** * ARN of the IAM role that allows Amazon ECS to make calls to your load balancer on your * behalf. This parameter is required if you are using a load balancer with your service, but * only if your task definition does not use the `awsvpc` network mode. If using `awsvpc` * network mode, do not specify this role. If your account has already created the Amazon ECS * service-linked role, that role is used by default for your service unless you specify a role * here. */ iamRole?: pulumi.Input<string>; /** * The launch type on which to run your service. The valid values are `EC2` and `FARGATE`. * Defaults to `EC2`. */ launchType?: pulumi.Input<"EC2" | "FARGATE">; /** * A load balancer block. Load balancers documented below. */ loadBalancers?: (pulumi.Input<ServiceLoadBalancer> | ServiceLoadBalancerProvider)[]; /** * The name of the service (up to 255 letters, numbers, hyphens, and underscores) */ name?: pulumi.Input<string>; /** * The network configuration for the service. This parameter is required for task definitions * that use the `awsvpc` network mode to receive their own Elastic Network Interface, and it is * not supported for other network modes. */ networkConfiguration?: pulumi.Input<NetworkConfiguration>; /** * Service level strategy rules that are taken into consideration during task placement. List * from top to bottom in order of precedence. The maximum number of `ordered_placement_strategy` * blocks is `5`. Defined below. */ orderedPlacementStrategies?: aws.ecs.ServiceArgs["orderedPlacementStrategies"]; /** * rules that are taken into consideration during task placement. Maximum number of * `placement_constraints` is `10`. Defined below. */ placementConstraints?: aws.ecs.ServiceArgs["placementConstraints"]; /** * The platform version on which to run your service. Only applicable for `launchType` set to `FARGATE`. * Defaults to `LATEST`. More information about Fargate platform versions can be found in the * [AWS ECS User Guide](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html). */ platformVersion?: pulumi.Input<string>; /** * Specifies whether to propagate the tags from the task definition or the service * to the tasks. The valid values are `SERVICE` and `TASK_DEFINITION`. */ propagateTags?: pulumi.Input<string>; /** * The scheduling strategy to use for the service. The valid values are `REPLICA` and `DAEMON`. * Defaults to `REPLICA`. Note that [*Fargate tasks do not support the `DAEMON` scheduling * strategy*](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/scheduling_tasks.html). */ schedulingStrategy?: pulumi.Input<string>; /** * The service discovery registries for the service. The maximum number of `service_registries` blocks is `1`. */ serviceRegistries?: aws.ecs.ServiceArgs["serviceRegistries"]; /** * Key-value mapping of resource tags */ tags?: pulumi.Input<aws.Tags>; /** * Wait for the service to reach a steady state (like [`aws ecs wait * services-stable`](https://docs.aws.amazon.com/cli/latest/reference/ecs/wait/services-stable.html)) * before continuing. Defaults to `true`. */ waitForSteadyState?: pulumi.Input<boolean>; /** * Cluster this service will run in. If not specified [Cluster.getDefault()] will be used. */ cluster?: Cluster; /** * The task definition to create the service from. */ taskDefinition: TaskDefinition; /** * Security groups determining how this service can be reached. */ securityGroups: ec2.SecurityGroup[]; }