1. Packages
  2. AWS Classic
  3. API Docs
  4. lightsail
  5. InstancePublicPorts

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.27.0 published on Monday, Mar 18, 2024 by Pulumi

aws.lightsail.InstancePublicPorts

Explore with Pulumi AI

aws logo

Try AWS Native preview for resources not in the classic version.

AWS Classic v6.27.0 published on Monday, Mar 18, 2024 by Pulumi

    Opens ports for a specific Amazon Lightsail instance, and specifies the IP addresses allowed to connect to the instance through the ports, and the protocol.

    See What is Amazon Lightsail? for more information.

    Note: Lightsail is currently only supported in a limited number of AWS Regions, please see “Regions and Availability Zones in Amazon Lightsail” for more details.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as aws from "@pulumi/aws";
    
    const test = new aws.lightsail.Instance("test", {
        name: "yak_sail",
        availabilityZone: available.names[0],
        blueprintId: "amazon_linux_2",
        bundleId: "nano_1_0",
    });
    const testInstancePublicPorts = new aws.lightsail.InstancePublicPorts("test", {
        instanceName: test.name,
        portInfos: [{
            protocol: "tcp",
            fromPort: 80,
            toPort: 80,
        }],
    });
    
    import pulumi
    import pulumi_aws as aws
    
    test = aws.lightsail.Instance("test",
        name="yak_sail",
        availability_zone=available["names"],
        blueprint_id="amazon_linux_2",
        bundle_id="nano_1_0")
    test_instance_public_ports = aws.lightsail.InstancePublicPorts("test",
        instance_name=test.name,
        port_infos=[aws.lightsail.InstancePublicPortsPortInfoArgs(
            protocol="tcp",
            from_port=80,
            to_port=80,
        )])
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/lightsail"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		test, err := lightsail.NewInstance(ctx, "test", &lightsail.InstanceArgs{
    			Name:             pulumi.String("yak_sail"),
    			AvailabilityZone: pulumi.Any(available.Names[0]),
    			BlueprintId:      pulumi.String("amazon_linux_2"),
    			BundleId:         pulumi.String("nano_1_0"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = lightsail.NewInstancePublicPorts(ctx, "test", &lightsail.InstancePublicPortsArgs{
    			InstanceName: test.Name,
    			PortInfos: lightsail.InstancePublicPortsPortInfoArray{
    				&lightsail.InstancePublicPortsPortInfoArgs{
    					Protocol: pulumi.String("tcp"),
    					FromPort: pulumi.Int(80),
    					ToPort:   pulumi.Int(80),
    				},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Aws = Pulumi.Aws;
    
    return await Deployment.RunAsync(() => 
    {
        var test = new Aws.LightSail.Instance("test", new()
        {
            Name = "yak_sail",
            AvailabilityZone = available.Names[0],
            BlueprintId = "amazon_linux_2",
            BundleId = "nano_1_0",
        });
    
        var testInstancePublicPorts = new Aws.LightSail.InstancePublicPorts("test", new()
        {
            InstanceName = test.Name,
            PortInfos = new[]
            {
                new Aws.LightSail.Inputs.InstancePublicPortsPortInfoArgs
                {
                    Protocol = "tcp",
                    FromPort = 80,
                    ToPort = 80,
                },
            },
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.aws.lightsail.Instance;
    import com.pulumi.aws.lightsail.InstanceArgs;
    import com.pulumi.aws.lightsail.InstancePublicPorts;
    import com.pulumi.aws.lightsail.InstancePublicPortsArgs;
    import com.pulumi.aws.lightsail.inputs.InstancePublicPortsPortInfoArgs;
    import java.util.List;
    import java.util.ArrayList;
    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 test = new Instance("test", InstanceArgs.builder()        
                .name("yak_sail")
                .availabilityZone(available.names()[0])
                .blueprintId("amazon_linux_2")
                .bundleId("nano_1_0")
                .build());
    
            var testInstancePublicPorts = new InstancePublicPorts("testInstancePublicPorts", InstancePublicPortsArgs.builder()        
                .instanceName(test.name())
                .portInfos(InstancePublicPortsPortInfoArgs.builder()
                    .protocol("tcp")
                    .fromPort(80)
                    .toPort(80)
                    .build())
                .build());
    
        }
    }
    
    resources:
      test:
        type: aws:lightsail:Instance
        properties:
          name: yak_sail
          availabilityZone: ${available.names[0]}
          blueprintId: amazon_linux_2
          bundleId: nano_1_0
      testInstancePublicPorts:
        type: aws:lightsail:InstancePublicPorts
        name: test
        properties:
          instanceName: ${test.name}
          portInfos:
            - protocol: tcp
              fromPort: 80
              toPort: 80
    

    Create InstancePublicPorts Resource

    new InstancePublicPorts(name: string, args: InstancePublicPortsArgs, opts?: CustomResourceOptions);
    @overload
    def InstancePublicPorts(resource_name: str,
                            opts: Optional[ResourceOptions] = None,
                            instance_name: Optional[str] = None,
                            port_infos: Optional[Sequence[InstancePublicPortsPortInfoArgs]] = None)
    @overload
    def InstancePublicPorts(resource_name: str,
                            args: InstancePublicPortsArgs,
                            opts: Optional[ResourceOptions] = None)
    func NewInstancePublicPorts(ctx *Context, name string, args InstancePublicPortsArgs, opts ...ResourceOption) (*InstancePublicPorts, error)
    public InstancePublicPorts(string name, InstancePublicPortsArgs args, CustomResourceOptions? opts = null)
    public InstancePublicPorts(String name, InstancePublicPortsArgs args)
    public InstancePublicPorts(String name, InstancePublicPortsArgs args, CustomResourceOptions options)
    
    type: aws:lightsail:InstancePublicPorts
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args InstancePublicPortsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    resource_name str
    The unique name of the resource.
    args InstancePublicPortsArgs
    The arguments to resource properties.
    opts ResourceOptions
    Bag of options to control resource's behavior.
    ctx Context
    Context object for the current deployment.
    name string
    The unique name of the resource.
    args InstancePublicPortsArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args InstancePublicPortsArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args InstancePublicPortsArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    InstancePublicPorts Resource Properties

    To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

    Inputs

    The InstancePublicPorts resource accepts the following input properties:

    InstanceName string
    Name of the Lightsail Instance.
    PortInfos List<Pulumi.Aws.LightSail.Inputs.InstancePublicPortsPortInfo>
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    InstanceName string
    Name of the Lightsail Instance.
    PortInfos []InstancePublicPortsPortInfoArgs
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    instanceName String
    Name of the Lightsail Instance.
    portInfos List<InstancePublicPortsPortInfo>
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    instanceName string
    Name of the Lightsail Instance.
    portInfos InstancePublicPortsPortInfo[]
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    instance_name str
    Name of the Lightsail Instance.
    port_infos Sequence[InstancePublicPortsPortInfoArgs]
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    instanceName String
    Name of the Lightsail Instance.
    portInfos List<Property Map>
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the InstancePublicPorts resource produces the following output properties:

    Id string
    The provider-assigned unique ID for this managed resource.
    Id string
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.
    id string
    The provider-assigned unique ID for this managed resource.
    id str
    The provider-assigned unique ID for this managed resource.
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing InstancePublicPorts Resource

    Get an existing InstancePublicPorts resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

    public static get(name: string, id: Input<ID>, state?: InstancePublicPortsState, opts?: CustomResourceOptions): InstancePublicPorts
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            instance_name: Optional[str] = None,
            port_infos: Optional[Sequence[InstancePublicPortsPortInfoArgs]] = None) -> InstancePublicPorts
    func GetInstancePublicPorts(ctx *Context, name string, id IDInput, state *InstancePublicPortsState, opts ...ResourceOption) (*InstancePublicPorts, error)
    public static InstancePublicPorts Get(string name, Input<string> id, InstancePublicPortsState? state, CustomResourceOptions? opts = null)
    public static InstancePublicPorts get(String name, Output<String> id, InstancePublicPortsState state, CustomResourceOptions options)
    Resource lookup is not supported in YAML
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    resource_name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    name
    The unique name of the resulting resource.
    id
    The unique provider ID of the resource to lookup.
    state
    Any extra arguments used during the lookup.
    opts
    A bag of options that control this resource's behavior.
    The following state arguments are supported:
    InstanceName string
    Name of the Lightsail Instance.
    PortInfos List<Pulumi.Aws.LightSail.Inputs.InstancePublicPortsPortInfo>
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    InstanceName string
    Name of the Lightsail Instance.
    PortInfos []InstancePublicPortsPortInfoArgs
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    instanceName String
    Name of the Lightsail Instance.
    portInfos List<InstancePublicPortsPortInfo>
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    instanceName string
    Name of the Lightsail Instance.
    portInfos InstancePublicPortsPortInfo[]
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    instance_name str
    Name of the Lightsail Instance.
    port_infos Sequence[InstancePublicPortsPortInfoArgs]
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.
    instanceName String
    Name of the Lightsail Instance.
    portInfos List<Property Map>
    Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.

    Supporting Types

    InstancePublicPortsPortInfo, InstancePublicPortsPortInfoArgs

    FromPort int
    First port in a range of open ports on an instance.
    Protocol string
    IP protocol name. Valid values are tcp, all, udp, and icmp.
    ToPort int

    Last port in a range of open ports on an instance.

    The following arguments are optional:

    CidrListAliases List<string>
    Set of CIDR aliases that define access for a preconfigured range of IP addresses.
    Cidrs List<string>
    Set of CIDR blocks.
    Ipv6Cidrs List<string>
    FromPort int
    First port in a range of open ports on an instance.
    Protocol string
    IP protocol name. Valid values are tcp, all, udp, and icmp.
    ToPort int

    Last port in a range of open ports on an instance.

    The following arguments are optional:

    CidrListAliases []string
    Set of CIDR aliases that define access for a preconfigured range of IP addresses.
    Cidrs []string
    Set of CIDR blocks.
    Ipv6Cidrs []string
    fromPort Integer
    First port in a range of open ports on an instance.
    protocol String
    IP protocol name. Valid values are tcp, all, udp, and icmp.
    toPort Integer

    Last port in a range of open ports on an instance.

    The following arguments are optional:

    cidrListAliases List<String>
    Set of CIDR aliases that define access for a preconfigured range of IP addresses.
    cidrs List<String>
    Set of CIDR blocks.
    ipv6Cidrs List<String>
    fromPort number
    First port in a range of open ports on an instance.
    protocol string
    IP protocol name. Valid values are tcp, all, udp, and icmp.
    toPort number

    Last port in a range of open ports on an instance.

    The following arguments are optional:

    cidrListAliases string[]
    Set of CIDR aliases that define access for a preconfigured range of IP addresses.
    cidrs string[]
    Set of CIDR blocks.
    ipv6Cidrs string[]
    from_port int
    First port in a range of open ports on an instance.
    protocol str
    IP protocol name. Valid values are tcp, all, udp, and icmp.
    to_port int

    Last port in a range of open ports on an instance.

    The following arguments are optional:

    cidr_list_aliases Sequence[str]
    Set of CIDR aliases that define access for a preconfigured range of IP addresses.
    cidrs Sequence[str]
    Set of CIDR blocks.
    ipv6_cidrs Sequence[str]
    fromPort Number
    First port in a range of open ports on an instance.
    protocol String
    IP protocol name. Valid values are tcp, all, udp, and icmp.
    toPort Number

    Last port in a range of open ports on an instance.

    The following arguments are optional:

    cidrListAliases List<String>
    Set of CIDR aliases that define access for a preconfigured range of IP addresses.
    cidrs List<String>
    Set of CIDR blocks.
    ipv6Cidrs List<String>

    Package Details

    Repository
    AWS Classic pulumi/pulumi-aws
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the aws Terraform Provider.
    aws logo

    Try AWS Native preview for resources not in the classic version.

    AWS Classic v6.27.0 published on Monday, Mar 18, 2024 by Pulumi