1. Packages
  2. Alibaba Cloud Provider
  3. API Docs
  4. ddos
  5. Port
Alibaba Cloud v3.76.0 published on Tuesday, Apr 8, 2025 by Pulumi

alicloud.ddos.Port

Explore with Pulumi AI

Provides a Ddos Coo Port resource.

For information about Anti-DDoS Pro Port and how to use it, see What is Port.

NOTE: Available since v1.123.0.

Example Usage

Basic Usage

import * as pulumi from "@pulumi/pulumi";
import * as alicloud from "@pulumi/alicloud";

const config = new pulumi.Config();
const name = config.get("name") || "tf-example";
const _default = new alicloud.ddos.DdosCooInstance("default", {
    name: name,
    bandwidth: "30",
    baseBandwidth: "30",
    serviceBandwidth: "100",
    portCount: "50",
    domainCount: "50",
    period: 1,
    productType: "ddoscoo",
});
const defaultPort = new alicloud.ddos.Port("default", {
    instanceId: _default.id,
    frontendPort: "7001",
    backendPort: "7002",
    frontendProtocol: "tcp",
    realServers: [
        "1.1.1.1",
        "2.2.2.2",
    ],
});
Copy
import pulumi
import pulumi_alicloud as alicloud

config = pulumi.Config()
name = config.get("name")
if name is None:
    name = "tf-example"
default = alicloud.ddos.DdosCooInstance("default",
    name=name,
    bandwidth="30",
    base_bandwidth="30",
    service_bandwidth="100",
    port_count="50",
    domain_count="50",
    period=1,
    product_type="ddoscoo")
default_port = alicloud.ddos.Port("default",
    instance_id=default.id,
    frontend_port="7001",
    backend_port="7002",
    frontend_protocol="tcp",
    real_servers=[
        "1.1.1.1",
        "2.2.2.2",
    ])
Copy
package main

import (
	"github.com/pulumi/pulumi-alicloud/sdk/v3/go/alicloud/ddos"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		name := "tf-example"
		if param := cfg.Get("name"); param != "" {
			name = param
		}
		_default, err := ddos.NewDdosCooInstance(ctx, "default", &ddos.DdosCooInstanceArgs{
			Name:             pulumi.String(name),
			Bandwidth:        pulumi.String("30"),
			BaseBandwidth:    pulumi.String("30"),
			ServiceBandwidth: pulumi.String("100"),
			PortCount:        pulumi.String("50"),
			DomainCount:      pulumi.String("50"),
			Period:           pulumi.Int(1),
			ProductType:      pulumi.String("ddoscoo"),
		})
		if err != nil {
			return err
		}
		_, err = ddos.NewPort(ctx, "default", &ddos.PortArgs{
			InstanceId:       _default.ID(),
			FrontendPort:     pulumi.String("7001"),
			BackendPort:      pulumi.String("7002"),
			FrontendProtocol: pulumi.String("tcp"),
			RealServers: pulumi.StringArray{
				pulumi.String("1.1.1.1"),
				pulumi.String("2.2.2.2"),
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AliCloud = Pulumi.AliCloud;

return await Deployment.RunAsync(() => 
{
    var config = new Config();
    var name = config.Get("name") ?? "tf-example";
    var @default = new AliCloud.Ddos.DdosCooInstance("default", new()
    {
        Name = name,
        Bandwidth = "30",
        BaseBandwidth = "30",
        ServiceBandwidth = "100",
        PortCount = "50",
        DomainCount = "50",
        Period = 1,
        ProductType = "ddoscoo",
    });

    var defaultPort = new AliCloud.Ddos.Port("default", new()
    {
        InstanceId = @default.Id,
        FrontendPort = "7001",
        BackendPort = "7002",
        FrontendProtocol = "tcp",
        RealServers = new[]
        {
            "1.1.1.1",
            "2.2.2.2",
        },
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ddos.DdosCooInstance;
import com.pulumi.alicloud.ddos.DdosCooInstanceArgs;
import com.pulumi.alicloud.ddos.Port;
import com.pulumi.alicloud.ddos.PortArgs;
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) {
        final var config = ctx.config();
        final var name = config.get("name").orElse("tf-example");
        var default_ = new DdosCooInstance("default", DdosCooInstanceArgs.builder()
            .name(name)
            .bandwidth("30")
            .baseBandwidth("30")
            .serviceBandwidth("100")
            .portCount("50")
            .domainCount("50")
            .period("1")
            .productType("ddoscoo")
            .build());

        var defaultPort = new Port("defaultPort", PortArgs.builder()
            .instanceId(default_.id())
            .frontendPort("7001")
            .backendPort("7002")
            .frontendProtocol("tcp")
            .realServers(            
                "1.1.1.1",
                "2.2.2.2")
            .build());

    }
}
Copy
configuration:
  name:
    type: string
    default: tf-example
resources:
  default:
    type: alicloud:ddos:DdosCooInstance
    properties:
      name: ${name}
      bandwidth: '30'
      baseBandwidth: '30'
      serviceBandwidth: '100'
      portCount: '50'
      domainCount: '50'
      period: '1'
      productType: ddoscoo
  defaultPort:
    type: alicloud:ddos:Port
    name: default
    properties:
      instanceId: ${default.id}
      frontendPort: '7001'
      backendPort: '7002'
      frontendProtocol: tcp
      realServers:
        - 1.1.1.1
        - 2.2.2.2
Copy

Create Port Resource

Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

Constructor syntax

new Port(name: string, args: PortArgs, opts?: CustomResourceOptions);
@overload
def Port(resource_name: str,
         args: PortArgs,
         opts: Optional[ResourceOptions] = None)

@overload
def Port(resource_name: str,
         opts: Optional[ResourceOptions] = None,
         frontend_port: Optional[str] = None,
         frontend_protocol: Optional[str] = None,
         instance_id: Optional[str] = None,
         real_servers: Optional[Sequence[str]] = None,
         backend_port: Optional[str] = None,
         config: Optional[PortConfigArgs] = None)
func NewPort(ctx *Context, name string, args PortArgs, opts ...ResourceOption) (*Port, error)
public Port(string name, PortArgs args, CustomResourceOptions? opts = null)
public Port(String name, PortArgs args)
public Port(String name, PortArgs args, CustomResourceOptions options)
type: alicloud:ddos:Port
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. PortArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. PortArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. PortArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. PortArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. PortArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

Constructor example

The following reference example uses placeholder values for all input properties.

var portResource = new AliCloud.Ddos.Port("portResource", new()
{
    FrontendPort = "string",
    FrontendProtocol = "string",
    InstanceId = "string",
    RealServers = new[]
    {
        "string",
    },
    BackendPort = "string",
    Config = new AliCloud.Ddos.Inputs.PortConfigArgs
    {
        PersistenceTimeout = 0,
    },
});
Copy
example, err := ddos.NewPort(ctx, "portResource", &ddos.PortArgs{
	FrontendPort:     pulumi.String("string"),
	FrontendProtocol: pulumi.String("string"),
	InstanceId:       pulumi.String("string"),
	RealServers: pulumi.StringArray{
		pulumi.String("string"),
	},
	BackendPort: pulumi.String("string"),
	Config: &ddos.PortConfigArgs{
		PersistenceTimeout: pulumi.Int(0),
	},
})
Copy
var portResource = new Port("portResource", PortArgs.builder()
    .frontendPort("string")
    .frontendProtocol("string")
    .instanceId("string")
    .realServers("string")
    .backendPort("string")
    .config(PortConfigArgs.builder()
        .persistenceTimeout(0)
        .build())
    .build());
Copy
port_resource = alicloud.ddos.Port("portResource",
    frontend_port="string",
    frontend_protocol="string",
    instance_id="string",
    real_servers=["string"],
    backend_port="string",
    config={
        "persistence_timeout": 0,
    })
Copy
const portResource = new alicloud.ddos.Port("portResource", {
    frontendPort: "string",
    frontendProtocol: "string",
    instanceId: "string",
    realServers: ["string"],
    backendPort: "string",
    config: {
        persistenceTimeout: 0,
    },
});
Copy
type: alicloud:ddos:Port
properties:
    backendPort: string
    config:
        persistenceTimeout: 0
    frontendPort: string
    frontendProtocol: string
    instanceId: string
    realServers:
        - string
Copy

Port Resource Properties

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

Inputs

In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

The Port resource accepts the following input properties:

FrontendPort
This property is required.
Changes to this property will trigger replacement.
string
The forwarding port to query. Valid values: 0 to 65535.
FrontendProtocol
This property is required.
Changes to this property will trigger replacement.
string
The type of the forwarding protocol to query. Valid values:
InstanceId
This property is required.
Changes to this property will trigger replacement.
string

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

RealServers This property is required. List<string>
List of source IP addresses
BackendPort Changes to this property will trigger replacement. string
The port of the origin server. Valid values: 0 to 65535.
Config Pulumi.AliCloud.Ddos.Inputs.PortConfig
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
FrontendPort
This property is required.
Changes to this property will trigger replacement.
string
The forwarding port to query. Valid values: 0 to 65535.
FrontendProtocol
This property is required.
Changes to this property will trigger replacement.
string
The type of the forwarding protocol to query. Valid values:
InstanceId
This property is required.
Changes to this property will trigger replacement.
string

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

RealServers This property is required. []string
List of source IP addresses
BackendPort Changes to this property will trigger replacement. string
The port of the origin server. Valid values: 0 to 65535.
Config PortConfigArgs
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
frontendPort
This property is required.
Changes to this property will trigger replacement.
String
The forwarding port to query. Valid values: 0 to 65535.
frontendProtocol
This property is required.
Changes to this property will trigger replacement.
String
The type of the forwarding protocol to query. Valid values:
instanceId
This property is required.
Changes to this property will trigger replacement.
String

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

realServers This property is required. List<String>
List of source IP addresses
backendPort Changes to this property will trigger replacement. String
The port of the origin server. Valid values: 0 to 65535.
config PortConfig
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
frontendPort
This property is required.
Changes to this property will trigger replacement.
string
The forwarding port to query. Valid values: 0 to 65535.
frontendProtocol
This property is required.
Changes to this property will trigger replacement.
string
The type of the forwarding protocol to query. Valid values:
instanceId
This property is required.
Changes to this property will trigger replacement.
string

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

realServers This property is required. string[]
List of source IP addresses
backendPort Changes to this property will trigger replacement. string
The port of the origin server. Valid values: 0 to 65535.
config PortConfig
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
frontend_port
This property is required.
Changes to this property will trigger replacement.
str
The forwarding port to query. Valid values: 0 to 65535.
frontend_protocol
This property is required.
Changes to this property will trigger replacement.
str
The type of the forwarding protocol to query. Valid values:
instance_id
This property is required.
Changes to this property will trigger replacement.
str

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

real_servers This property is required. Sequence[str]
List of source IP addresses
backend_port Changes to this property will trigger replacement. str
The port of the origin server. Valid values: 0 to 65535.
config PortConfigArgs
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
frontendPort
This property is required.
Changes to this property will trigger replacement.
String
The forwarding port to query. Valid values: 0 to 65535.
frontendProtocol
This property is required.
Changes to this property will trigger replacement.
String
The type of the forwarding protocol to query. Valid values:
instanceId
This property is required.
Changes to this property will trigger replacement.
String

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

realServers This property is required. List<String>
List of source IP addresses
backendPort Changes to this property will trigger replacement. String
The port of the origin server. Valid values: 0 to 65535.
config Property Map
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.

Outputs

All input properties are implicitly available as output properties. Additionally, the Port 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 Port Resource

Get an existing Port 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?: PortState, opts?: CustomResourceOptions): Port
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        backend_port: Optional[str] = None,
        config: Optional[PortConfigArgs] = None,
        frontend_port: Optional[str] = None,
        frontend_protocol: Optional[str] = None,
        instance_id: Optional[str] = None,
        real_servers: Optional[Sequence[str]] = None) -> Port
func GetPort(ctx *Context, name string, id IDInput, state *PortState, opts ...ResourceOption) (*Port, error)
public static Port Get(string name, Input<string> id, PortState? state, CustomResourceOptions? opts = null)
public static Port get(String name, Output<String> id, PortState state, CustomResourceOptions options)
resources:  _:    type: alicloud:ddos:Port    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
BackendPort Changes to this property will trigger replacement. string
The port of the origin server. Valid values: 0 to 65535.
Config Pulumi.AliCloud.Ddos.Inputs.PortConfig
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
FrontendPort Changes to this property will trigger replacement. string
The forwarding port to query. Valid values: 0 to 65535.
FrontendProtocol Changes to this property will trigger replacement. string
The type of the forwarding protocol to query. Valid values:
InstanceId Changes to this property will trigger replacement. string

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

RealServers List<string>
List of source IP addresses
BackendPort Changes to this property will trigger replacement. string
The port of the origin server. Valid values: 0 to 65535.
Config PortConfigArgs
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
FrontendPort Changes to this property will trigger replacement. string
The forwarding port to query. Valid values: 0 to 65535.
FrontendProtocol Changes to this property will trigger replacement. string
The type of the forwarding protocol to query. Valid values:
InstanceId Changes to this property will trigger replacement. string

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

RealServers []string
List of source IP addresses
backendPort Changes to this property will trigger replacement. String
The port of the origin server. Valid values: 0 to 65535.
config PortConfig
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
frontendPort Changes to this property will trigger replacement. String
The forwarding port to query. Valid values: 0 to 65535.
frontendProtocol Changes to this property will trigger replacement. String
The type of the forwarding protocol to query. Valid values:
instanceId Changes to this property will trigger replacement. String

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

realServers List<String>
List of source IP addresses
backendPort Changes to this property will trigger replacement. string
The port of the origin server. Valid values: 0 to 65535.
config PortConfig
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
frontendPort Changes to this property will trigger replacement. string
The forwarding port to query. Valid values: 0 to 65535.
frontendProtocol Changes to this property will trigger replacement. string
The type of the forwarding protocol to query. Valid values:
instanceId Changes to this property will trigger replacement. string

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

realServers string[]
List of source IP addresses
backend_port Changes to this property will trigger replacement. str
The port of the origin server. Valid values: 0 to 65535.
config PortConfigArgs
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
frontend_port Changes to this property will trigger replacement. str
The forwarding port to query. Valid values: 0 to 65535.
frontend_protocol Changes to this property will trigger replacement. str
The type of the forwarding protocol to query. Valid values:
instance_id Changes to this property will trigger replacement. str

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

real_servers Sequence[str]
List of source IP addresses
backendPort Changes to this property will trigger replacement. String
The port of the origin server. Valid values: 0 to 65535.
config Property Map
Session persistence settings for port forwarding rules. Use a string representation in JSON format. The specific structure is described as follows.

  • PersistenceTimeout: is of Integer type and is required. The timeout period of the session. Value range: 30 to 3600, in seconds. The default value is 0, which is closed. See config below.
frontendPort Changes to this property will trigger replacement. String
The forwarding port to query. Valid values: 0 to 65535.
frontendProtocol Changes to this property will trigger replacement. String
The type of the forwarding protocol to query. Valid values:
instanceId Changes to this property will trigger replacement. String

The ID of the Anti-DDoS Pro or Anti-DDoS Premium instance to which the port forwarding rule belongs.

NOTE: You can call the DescribeInstanceIds operation to query the IDs of all instances.

realServers List<String>
List of source IP addresses

Supporting Types

PortConfig
, PortConfigArgs

PersistenceTimeout int
The timeout period for session retention. Value range: 30~3600, unit: second. The default is 0, which means off.
PersistenceTimeout int
The timeout period for session retention. Value range: 30~3600, unit: second. The default is 0, which means off.
persistenceTimeout Integer
The timeout period for session retention. Value range: 30~3600, unit: second. The default is 0, which means off.
persistenceTimeout number
The timeout period for session retention. Value range: 30~3600, unit: second. The default is 0, which means off.
persistence_timeout int
The timeout period for session retention. Value range: 30~3600, unit: second. The default is 0, which means off.
persistenceTimeout Number
The timeout period for session retention. Value range: 30~3600, unit: second. The default is 0, which means off.

Import

Ddos Coo Port can be imported using the id, e.g.

$ pulumi import alicloud:ddos/port:Port example <instance_id>:<frontend_port>:<frontend_protocol>
Copy

To learn more about importing existing cloud resources, see Importing resources.

Package Details

Repository
Alibaba Cloud pulumi/pulumi-alicloud
License
Apache-2.0
Notes
This Pulumi package is based on the alicloud Terraform Provider.