Class ContainerService


  • public class ContainerService
    extends com.pulumi.resources.CustomResource
    Manages a Lightsail container service. Use this resource to create and manage a scalable compute and networking platform for deploying, running, and managing containerized applications in Lightsail. > **Note:** For more information about the AWS Regions in which you can create Amazon Lightsail container services, see ["Regions and Availability Zones in Amazon Lightsail"](https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail). > **NOTE:** You must create and validate an SSL/TLS certificate before you can use `publicDomainNames` with your container service. For more information, see [Enabling and managing custom domains for your Amazon Lightsail container services](https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-creating-container-services-certificates). ## Example Usage ### Basic Usage
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.lightsail.ContainerService;
     import com.pulumi.aws.lightsail.ContainerServiceArgs;
     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 ContainerService("example", ContainerServiceArgs.builder()
                 .name("container-service-1")
                 .power("nano")
                 .scale(1)
                 .isDisabled(false)
                 .tags(Map.ofEntries(
                     Map.entry("foo1", "bar1"),
                     Map.entry("foo2", "")
                 ))
                 .build());
     
         }
     }
     
     
    ### Public Domain Names
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.lightsail.ContainerService;
     import com.pulumi.aws.lightsail.ContainerServiceArgs;
     import com.pulumi.aws.lightsail.inputs.ContainerServicePublicDomainNamesArgs;
     import com.pulumi.aws.lightsail.inputs.ContainerServicePublicDomainNamesCertificateArgs;
     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 ContainerService("example", ContainerServiceArgs.builder()
                 .publicDomainNames(ContainerServicePublicDomainNamesArgs.builder()
                     .certificates(ContainerServicePublicDomainNamesCertificateArgs.builder()
                         .certificateName("example-certificate")
                         .domainNames("www.example.com")
                         .build())
                     .build())
                 .build());
     
         }
     }
     
     
    ### Private Registry Access
     
     package generated_program;
     
     import com.pulumi.Context;
     import com.pulumi.Pulumi;
     import com.pulumi.core.Output;
     import com.pulumi.aws.lightsail.ContainerService;
     import com.pulumi.aws.lightsail.ContainerServiceArgs;
     import com.pulumi.aws.lightsail.inputs.ContainerServicePrivateRegistryAccessArgs;
     import com.pulumi.aws.lightsail.inputs.ContainerServicePrivateRegistryAccessEcrImagePullerRoleArgs;
     import com.pulumi.aws.iam.IamFunctions;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentArgs;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementArgs;
     import com.pulumi.aws.iam.inputs.GetPolicyDocumentStatementPrincipalArgs;
     import com.pulumi.aws.ecr.RepositoryPolicy;
     import com.pulumi.aws.ecr.RepositoryPolicyArgs;
     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 exampleContainerService = new ContainerService("exampleContainerService", ContainerServiceArgs.builder()
                 .privateRegistryAccess(ContainerServicePrivateRegistryAccessArgs.builder()
                     .ecrImagePullerRole(ContainerServicePrivateRegistryAccessEcrImagePullerRoleArgs.builder()
                         .isActive(true)
                         .build())
                     .build())
                 .build());
     
             final var example = IamFunctions.getPolicyDocument(GetPolicyDocumentArgs.builder()
                 .statements(GetPolicyDocumentStatementArgs.builder()
                     .principals(GetPolicyDocumentStatementPrincipalArgs.builder()
                         .type("AWS")
                         .identifiers(exampleContainerService.privateRegistryAccess().applyValue(_privateRegistryAccess -> _privateRegistryAccess.ecrImagePullerRole().principalArn()))
                         .build())
                     .effect("Allow")
                     .actions(                
                         "ecr:BatchGetImage",
                         "ecr:GetDownloadUrlForLayer")
                     .build())
                 .build());
     
             var exampleRepositoryPolicy = new RepositoryPolicy("exampleRepositoryPolicy", RepositoryPolicyArgs.builder()
                 .repository(exampleAwsEcrRepository.name())
                 .policy(example.applyValue(_example -> _example.json()))
                 .build());
     
         }
     }
     
     
    ## Import Using `pulumi import`, import Lightsail Container Service using the `name`. For example: ```sh $ pulumi import aws:lightsail/containerService:ContainerService example container-service-1 ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.pulumi.core.Output<java.lang.String> arn()  
      com.pulumi.core.Output<java.lang.String> availabilityZone()  
      com.pulumi.core.Output<java.lang.String> createdAt()  
      static ContainerService get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, ContainerServiceState state, 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.
      com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> isDisabled()  
      com.pulumi.core.Output<java.lang.String> name()  
      com.pulumi.core.Output<java.lang.String> power()  
      com.pulumi.core.Output<java.lang.String> powerId()  
      com.pulumi.core.Output<java.lang.String> principalArn()  
      com.pulumi.core.Output<java.lang.String> privateDomainName()  
      com.pulumi.core.Output<ContainerServicePrivateRegistryAccess> privateRegistryAccess()  
      com.pulumi.core.Output<java.util.Optional<ContainerServicePublicDomainNames>> publicDomainNames()  
      com.pulumi.core.Output<java.lang.String> region()  
      com.pulumi.core.Output<java.lang.String> resourceType()  
      com.pulumi.core.Output<java.lang.Integer> scale()  
      com.pulumi.core.Output<java.lang.String> state()  
      com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()  
      com.pulumi.core.Output<java.util.Map<java.lang.String,​java.lang.String>> tagsAll()  
      com.pulumi.core.Output<java.lang.String> url()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, id, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn, pulumiChildResources, pulumiResourceName, pulumiResourceType, urn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ContainerService

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

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

        public ContainerService​(java.lang.String name,
                                ContainerServiceArgs 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

      • arn

        public com.pulumi.core.Output<java.lang.String> arn()
        Returns:
        ARN of the container service.
      • availabilityZone

        public com.pulumi.core.Output<java.lang.String> availabilityZone()
        Returns:
        Availability Zone. Follows the format us-east-2a (case-sensitive).
      • createdAt

        public com.pulumi.core.Output<java.lang.String> createdAt()
        Returns:
        Date and time when the container service was created.
      • isDisabled

        public com.pulumi.core.Output<java.util.Optional<java.lang.Boolean>> isDisabled()
        Returns:
        Whether to disable the container service. Defaults to `false`.
      • name

        public com.pulumi.core.Output<java.lang.String> name()
        Returns:
        Name of the container service. Names must be of length 1 to 63, and be unique within each AWS Region in your Lightsail account.
      • power

        public com.pulumi.core.Output<java.lang.String> power()
        Returns:
        Power specification for the container service. The power specifies the amount of memory, the number of vCPUs, and the monthly price of each node of the container service. Possible values: `nano`, `micro`, `small`, `medium`, `large`, `xlarge`.
      • powerId

        public com.pulumi.core.Output<java.lang.String> powerId()
        Returns:
        Power ID of the container service.
      • principalArn

        public com.pulumi.core.Output<java.lang.String> principalArn()
        Returns:
        Principal ARN of the container service. The principal ARN can be used to create a trust relationship between your standard AWS account and your Lightsail container service.
      • privateDomainName

        public com.pulumi.core.Output<java.lang.String> privateDomainName()
        Returns:
        Private domain name of the container service. The private domain name is accessible only by other resources within the default VPC of your Lightsail account.
      • privateRegistryAccess

        public com.pulumi.core.Output<ContainerServicePrivateRegistryAccess> privateRegistryAccess()
        Returns:
        Configuration for the container service to access private container image repositories, such as Amazon Elastic Container Registry (Amazon ECR) private repositories. See below.
      • publicDomainNames

        public com.pulumi.core.Output<java.util.Optional<ContainerServicePublicDomainNames>> publicDomainNames()
        Returns:
        Public domain names to use with the container service, such as example.com and www.example.com. You can specify up to four public domain names for a container service. The domain names that you specify are used when you create a deployment with a container configured as the public endpoint of your container service. If you don't specify public domain names, then you can use the default domain of the container service. See below.
      • region

        public com.pulumi.core.Output<java.lang.String> region()
        Returns:
        Region where this resource will be [managed](https://docs.aws.amazon.com/general/latest/gr/rande.html#regional-endpoints). Defaults to the Region set in the provider configuration.
      • resourceType

        public com.pulumi.core.Output<java.lang.String> resourceType()
        Returns:
        Lightsail resource type of the container service (i.e., ContainerService).
      • scale

        public com.pulumi.core.Output<java.lang.Integer> scale()
        Returns:
        Scale specification for the container service. The scale specifies the allocated compute nodes of the container service. The following arguments are optional:
      • state

        public com.pulumi.core.Output<java.lang.String> state()
        Returns:
        Current state of the container service.
      • tags

        public com.pulumi.core.Output<java.util.Optional<java.util.Map<java.lang.String,​java.lang.String>>> tags()
        Returns:
        Map of tags to assign to the resource. To create a key-only tag, use an empty string as the value. 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.
      • url

        public com.pulumi.core.Output<java.lang.String> url()
        Returns:
        Publicly accessible URL of the container service. If no public endpoint is specified in the currentDeployment, this URL returns a 404 response.
      • get

        public static ContainerService get​(java.lang.String name,
                                           com.pulumi.core.Output<java.lang.String> id,
                                           @Nullable
                                           ContainerServiceState 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.