Class ExpressGatewayService


  • public class ExpressGatewayService
    extends com.pulumi.resources.CustomResource
    Manages an [ECS Express service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/express-service-overview.html). The Express service provides a simplified way to deploy containerized applications with automatic provisioning and management of AWS infrastructure including Application Load Balancers (ALBs), target groups, security groups, and auto-scaling policies. This service offers built-in load balancing, auto-scaling, and networking capabilities with zero-downtime deployments. > **Note:** To prevent a race condition during service deletion, make sure to set `dependsOn` to the related `aws.iam.RolePolicy` or `aws.iam.RolePolicyAttachment` resources. Otherwise, the policy may be destroyed too soon and the ECS service will then get stuck in the `DRAINING` state. ## Example Usage ### Basic Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ecs.ExpressGatewayService;
     import com.pulumi.aws.ecs.ExpressGatewayServiceArgs;
     import com.pulumi.aws.ecs.inputs.ExpressGatewayServicePrimaryContainerArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new ExpressGatewayService("example", ExpressGatewayServiceArgs.builder()
                 .primaryContainer(ExpressGatewayServicePrimaryContainerArgs.builder()
                     .image("nginx:latest")
                     .build())
                 .executionRoleArn(execution.arn())
                 .infrastructureRoleArn(infrastructure.arn())
                 .build());
     
         }
     }
     
     
    ### Container Logging, Environment Variables, and Secrets
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ecs.ExpressGatewayService;
     import com.pulumi.aws.ecs.ExpressGatewayServiceArgs;
     import com.pulumi.aws.ecs.inputs.ExpressGatewayServicePrimaryContainerArgs;
     import com.pulumi.aws.ecs.inputs.ExpressGatewayServicePrimaryContainerAwsLogsConfigurationArgs;
     import com.pulumi.aws.ecs.inputs.ExpressGatewayServicePrimaryContainerEnvironmentArgs;
     import com.pulumi.aws.ecs.inputs.ExpressGatewayServicePrimaryContainerSecretArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new ExpressGatewayService("example", ExpressGatewayServiceArgs.builder()
                 .primaryContainer(ExpressGatewayServicePrimaryContainerArgs.builder()
                     .awsLogsConfigurations(ExpressGatewayServicePrimaryContainerAwsLogsConfigurationArgs.builder()
                         .logGroup(app.name())
                         .build())
                     .environments(                
                         ExpressGatewayServicePrimaryContainerEnvironmentArgs.builder()
                             .name("ENV")
                             .value("production")
                             .build(),
                         ExpressGatewayServicePrimaryContainerEnvironmentArgs.builder()
                             .name("PORT")
                             .value("8080")
                             .build())
                     .secrets(ExpressGatewayServicePrimaryContainerSecretArgs.builder()
                         .name("DB_PASSWORD")
                         .valueFrom(dbPassword.arn())
                         .build())
                     .image("my-app:latest")
                     .containerPort(8080)
                     .commands("./start.sh")
                     .build())
                 .executionRoleArn(execution.arn())
                 .infrastructureRoleArn(infrastructure.arn())
                 .healthCheckPath("/health")
                 .build());
     
         }
     }
     
     
    ### Custom Networking
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.ecs.ExpressGatewayService;
     import com.pulumi.aws.ecs.ExpressGatewayServiceArgs;
     import com.pulumi.aws.ecs.inputs.ExpressGatewayServicePrimaryContainerArgs;
     import com.pulumi.aws.ecs.inputs.ExpressGatewayServiceNetworkConfigurationArgs;
     import java.util.ArrayList;
     import java.util.Arrays;
     import java.util.Map;
     import java.io.File;
     import java.nio.file.Files;
     import java.nio.file.Paths;
     
     public class App {
         public static void main(String[] args) {
             Pulumi.run(App::stack);
         }
     
         public static void stack(Context ctx) {
             var example = new ExpressGatewayService("example", ExpressGatewayServiceArgs.builder()
                 .primaryContainer(ExpressGatewayServicePrimaryContainerArgs.builder()
                     .image("nginx:latest")
                     .containerPort(80)
                     .build())
                 .networkConfigurations(ExpressGatewayServiceNetworkConfigurationArgs.builder()
                     .subnets(                
                         privateA.id(),
                         privateB.id())
                     .securityGroups(app.id())
                     .build())
                 .serviceName("my-express-service")
                 .cluster(main.name())
                 .executionRoleArn(execution.arn())
                 .infrastructureRoleArn(infrastructure.arn())
                 .cpu("256")
                 .memory("512")
                 .build());
     
         }
     }
     
     
    ### Service Updates and Deletion ### Updates When you update an Express service configuration, a new service revision is created and deployed using a canary deployment strategy with zero downtime. For more information, see [Updating an Express service](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/express-service-update.html). ### Deletion When an Express service is deleted, it enters a `DRAINING` state where existing tasks are allowed to complete gracefully before termination. The deletion process is irreversible - once initiated, the service and all its associated AWS infrastructure (load balancers, target groups, etc.) will be permanently removed. During the draining process, no new tasks are started, and the service becomes unavailable once all tasks have completed. ## Import Using `pulumi import`, import ECS Express Gateway Services using the service ARN. For example: ```sh $ pulumi import aws:ecs/expressGatewayService:ExpressGatewayService example arn:aws:ecs:us-west-2:123456789012:service/my-cluster/my-express-gateway-service ```
    • Constructor Detail

      • ExpressGatewayService

        public ExpressGatewayService​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • ExpressGatewayService

        public ExpressGatewayService​(java.lang.String name,
                                     ExpressGatewayServiceArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • ExpressGatewayService

        public ExpressGatewayService​(java.lang.String name,
                                     ExpressGatewayServiceArgs args,
                                     @Nullable
                                     com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • cluster

        public com.pulumi.core.Output<java.lang.String> cluster()
        Returns:
        Name or ARN of the ECS cluster. Defaults to `default`.
      • cpu

        public com.pulumi.core.Output<java.lang.String> cpu()
        Returns:
        Number of CPU units used by the task. Valid values are powers of 2 between 256 and 4096. Defaults to `1024`.
      • currentDeployment

        public com.pulumi.core.Output<java.lang.String> currentDeployment()
        Returns:
        (**Deprecated**) ARN of the current deployment.
      • executionRoleArn

        public com.pulumi.core.Output<java.lang.String> executionRoleArn()
        Returns:
        ARN of the IAM role that allows ECS to pull container images and publish container logs to Amazon CloudWatch.
      • healthCheckPath

        public com.pulumi.core.Output<java.lang.String> healthCheckPath()
        Returns:
        Path for health check requests. Defaults to `/`.
      • infrastructureRoleArn

        public com.pulumi.core.Output<java.lang.String> infrastructureRoleArn()
        Returns:
        ARN of the IAM role that allows ECS to manage AWS infrastructure on your behalf. **Important:** The infrastructure role cannot be modified after the service is created. Changing this forces a new resource to be created. The following arguments are optional:
      • ingressPaths

        public com.pulumi.core.Output<java.util.List<ExpressGatewayServiceIngressPath>> ingressPaths()
        Returns:
        List of ingress paths for the service. See `ingressPaths` Block below.
      • memory

        public com.pulumi.core.Output<java.lang.String> memory()
        Returns:
        Amount of memory (in MiB) used by the task. Valid values are between 512 and 8192. Defaults to `2048`.
      • networkConfigurations

        public com.pulumi.core.Output<java.util.List<ExpressGatewayServiceNetworkConfiguration>> networkConfigurations()
        Returns:
        Network configuration for the service. See `networkConfiguration` Block below.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        AWS region where the service will be created. If not specified, the region configured in the provider will be used.
      • scalingTargets

        public com.pulumi.core.Output<java.util.List<ExpressGatewayServiceScalingTarget>> scalingTargets()
        Returns:
        Auto-scaling configuration for the service. See `scalingTarget` Block below.
      • serviceArn

        public com.pulumi.core.Output<java.lang.String> serviceArn()
        Returns:
        ARN of the Express Gateway Service.
      • serviceName

        public com.pulumi.core.Output<java.lang.String> serviceName()
        Returns:
        Name of the service. If not specified, a name will be generated. Changing this forces a new resource to be created.
      • serviceRevisionArn

        public com.pulumi.core.Output<java.lang.String> serviceRevisionArn()
        Returns:
        ARN of the service revision.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Key-value map of resource tags. If configured with a provider `defaultTags` configuration block present, tags with matching keys will overwrite those defined at the provider-level.
      • tagsAll

        public com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()
        Returns:
        Map of tags assigned to the resource, including those inherited from the provider `defaultTags` configuration block.
      • taskRoleArn

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> taskRoleArn()
        Returns:
        ARN of the IAM role that allows your Amazon ECS container task to make calls to other AWS services.
      • waitForSteadyState

        public com.pulumi.core.Output<java.lang.Boolean> waitForSteadyState()
        Returns:
        Whether to wait for the service to reach a steady state before considering the operation complete. Defaults to `false`.
      • get

        public static ExpressGatewayService get​(java.lang.String name,
                                                com.pulumi.core.Output<java.lang.String> id,
                                                @Nullable
                                                ExpressGatewayServiceState state,
                                                @Nullable
                                                com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.