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",
],
});
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",
])
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
}
_, 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
})
}
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",
},
});
});
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());
}
}
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
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)
type: alicloud:ddos:Port
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PortArgs
- 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 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 string
- The unique name of the resource.
- args PortArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PortArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args 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,
},
});
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),
},
})
var portResource = new Port("portResource", PortArgs.builder()
.frontendPort("string")
.frontendProtocol("string")
.instanceId("string")
.realServers("string")
.backendPort("string")
.config(PortConfigArgs.builder()
.persistenceTimeout(0)
.build())
.build());
port_resource = alicloud.ddos.Port("portResource",
frontend_port="string",
frontend_protocol="string",
instance_id="string",
real_servers=["string"],
backend_port="string",
config=alicloud.ddos.PortConfigArgs(
persistence_timeout=0,
))
const portResource = new alicloud.ddos.Port("portResource", {
frontendPort: "string",
frontendProtocol: "string",
instanceId: "string",
realServers: ["string"],
backendPort: "string",
config: {
persistenceTimeout: 0,
},
});
type: alicloud:ddos:Port
properties:
backendPort: string
config:
persistenceTimeout: 0
frontendPort: string
frontendProtocol: string
instanceId: string
realServers:
- string
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
The Port resource accepts the following input properties:
- Frontend
Port string - The forwarding port to query. Valid values:
0
to65535
. - Frontend
Protocol string - The type of the forwarding protocol to query. Valid values:
- Instance
Id 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.
- Real
Servers List<string> - List of source IP addresses
- Backend
Port string - The port of the origin server. Valid values:
0
to65535
. - Config
Pulumi.
Ali Cloud. Ddos. Inputs. Port Config - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- Frontend
Port string - The forwarding port to query. Valid values:
0
to65535
. - Frontend
Protocol string - The type of the forwarding protocol to query. Valid values:
- Instance
Id 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.
- Real
Servers []string - List of source IP addresses
- Backend
Port string - The port of the origin server. Valid values:
0
to65535
. - Config
Port
Config Args - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- frontend
Port String - The forwarding port to query. Valid values:
0
to65535
. - frontend
Protocol String - The type of the forwarding protocol to query. Valid values:
- instance
Id 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.
- real
Servers List<String> - List of source IP addresses
- backend
Port String - The port of the origin server. Valid values:
0
to65535
. - config
Port
Config - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- frontend
Port string - The forwarding port to query. Valid values:
0
to65535
. - frontend
Protocol string - The type of the forwarding protocol to query. Valid values:
- instance
Id 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.
- real
Servers string[] - List of source IP addresses
- backend
Port string - The port of the origin server. Valid values:
0
to65535
. - config
Port
Config - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- frontend_
port str - The forwarding port to query. Valid values:
0
to65535
. - frontend_
protocol str - The type of the forwarding protocol to query. Valid values:
- instance_
id 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
- backend_
port str - The port of the origin server. Valid values:
0
to65535
. - config
Port
Config Args - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- frontend
Port String - The forwarding port to query. Valid values:
0
to65535
. - frontend
Protocol String - The type of the forwarding protocol to query. Valid values:
- instance
Id 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.
- real
Servers List<String> - List of source IP addresses
- backend
Port String - The port of the origin server. Valid values:
0
to65535
. - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
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)
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.
- Backend
Port string - The port of the origin server. Valid values:
0
to65535
. - Config
Pulumi.
Ali Cloud. Ddos. Inputs. Port Config - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- Frontend
Port string - The forwarding port to query. Valid values:
0
to65535
. - Frontend
Protocol string - The type of the forwarding protocol to query. Valid values:
- Instance
Id 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.
- Real
Servers List<string> - List of source IP addresses
- Backend
Port string - The port of the origin server. Valid values:
0
to65535
. - Config
Port
Config Args - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- Frontend
Port string - The forwarding port to query. Valid values:
0
to65535
. - Frontend
Protocol string - The type of the forwarding protocol to query. Valid values:
- Instance
Id 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.
- Real
Servers []string - List of source IP addresses
- backend
Port String - The port of the origin server. Valid values:
0
to65535
. - config
Port
Config - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- frontend
Port String - The forwarding port to query. Valid values:
0
to65535
. - frontend
Protocol String - The type of the forwarding protocol to query. Valid values:
- instance
Id 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.
- real
Servers List<String> - List of source IP addresses
- backend
Port string - The port of the origin server. Valid values:
0
to65535
. - config
Port
Config - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- frontend
Port string - The forwarding port to query. Valid values:
0
to65535
. - frontend
Protocol string - The type of the forwarding protocol to query. Valid values:
- instance
Id 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.
- real
Servers string[] - List of source IP addresses
- backend_
port str - The port of the origin server. Valid values:
0
to65535
. - config
Port
Config Args - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- frontend_
port str - The forwarding port to query. Valid values:
0
to65535
. - frontend_
protocol str - The type of the forwarding protocol to query. Valid values:
- instance_
id 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
- backend
Port String - The port of the origin server. Valid values:
0
to65535
. - 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
to3600
, in seconds. The default value is0
, which is closed. Seeconfig
below.
- frontend
Port String - The forwarding port to query. Valid values:
0
to65535
. - frontend
Protocol String - The type of the forwarding protocol to query. Valid values:
- instance
Id 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.
- real
Servers List<String> - List of source IP addresses
Supporting Types
PortConfig, PortConfigArgs
- Persistence
Timeout int - 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.
- persistence
Timeout Integer - The timeout period for session retention. Value range: 30~3600, unit: second. The default is 0, which means off.
- persistence
Timeout 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.
- persistence
Timeout 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>
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.