InstancePublicPorts

class InstancePublicPorts : KotlinCustomResource

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_3_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"][0],
blueprint_id="amazon_linux_2",
bundle_id="nano_3_0")
test_instance_public_ports = aws.lightsail.InstancePublicPorts("test",
instance_name=test.name,
port_infos=[{
"protocol": "tcp",
"from_port": 80,
"to_port": 80,
}])
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_3_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 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_3_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
})
}
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_3_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_3_0
testInstancePublicPorts:
type: aws:lightsail:InstancePublicPorts
name: test
properties:
instanceName: ${test.name}
portInfos:
- protocol: tcp
fromPort: 80
toPort: 80

Properties

Link copied to clipboard
val id: Output<String>
Link copied to clipboard
val instanceName: Output<String>

Name of the Lightsail Instance.

Link copied to clipboard

Configuration block with port information. AWS closes all currently open ports that are not included in the port_info. Detailed below.

Link copied to clipboard
val pulumiChildResources: Set<KotlinResource>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val urn: Output<String>