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

alicloud.ecs.Command

Explore with Pulumi AI

Provides a ECS Command resource.

For information about ECS Command and how to use it, see What is Command.

NOTE: Available in v1.116.0+.

Example Usage

Basic Usage

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

const example = new alicloud.ecs.Command("example", {
    name: "tf-testAcc",
    commandContent: "bHMK",
    description: "For Terraform Test",
    type: "RunShellScript",
    workingDir: "/root",
});
Copy
import pulumi
import pulumi_alicloud as alicloud

example = alicloud.ecs.Command("example",
    name="tf-testAcc",
    command_content="bHMK",
    description="For Terraform Test",
    type="RunShellScript",
    working_dir="/root")
Copy
package main

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

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ecs.NewCommand(ctx, "example", &ecs.CommandArgs{
			Name:           pulumi.String("tf-testAcc"),
			CommandContent: pulumi.String("bHMK"),
			Description:    pulumi.String("For Terraform Test"),
			Type:           pulumi.String("RunShellScript"),
			WorkingDir:     pulumi.String("/root"),
		})
		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 example = new AliCloud.Ecs.Command("example", new()
    {
        Name = "tf-testAcc",
        CommandContent = "bHMK",
        Description = "For Terraform Test",
        Type = "RunShellScript",
        WorkingDir = "/root",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.alicloud.ecs.Command;
import com.pulumi.alicloud.ecs.CommandArgs;
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 example = new Command("example", CommandArgs.builder()
            .name("tf-testAcc")
            .commandContent("bHMK")
            .description("For Terraform Test")
            .type("RunShellScript")
            .workingDir("/root")
            .build());

    }
}
Copy
resources:
  example:
    type: alicloud:ecs:Command
    properties:
      name: tf-testAcc
      commandContent: bHMK
      description: For Terraform Test
      type: RunShellScript
      workingDir: /root
Copy

Create Command Resource

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

Constructor syntax

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

@overload
def Command(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            command_content: Optional[str] = None,
            type: Optional[str] = None,
            description: Optional[str] = None,
            enable_parameter: Optional[bool] = None,
            name: Optional[str] = None,
            timeout: Optional[int] = None,
            working_dir: Optional[str] = None)
func NewCommand(ctx *Context, name string, args CommandArgs, opts ...ResourceOption) (*Command, error)
public Command(string name, CommandArgs args, CustomResourceOptions? opts = null)
public Command(String name, CommandArgs args)
public Command(String name, CommandArgs args, CustomResourceOptions options)
type: alicloud:ecs:Command
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. CommandArgs
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. CommandArgs
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. CommandArgs
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. CommandArgs
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. CommandArgs
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 commandResource = new AliCloud.Ecs.Command("commandResource", new()
{
    CommandContent = "string",
    Type = "string",
    Description = "string",
    EnableParameter = false,
    Name = "string",
    Timeout = 0,
    WorkingDir = "string",
});
Copy
example, err := ecs.NewCommand(ctx, "commandResource", &ecs.CommandArgs{
	CommandContent:  pulumi.String("string"),
	Type:            pulumi.String("string"),
	Description:     pulumi.String("string"),
	EnableParameter: pulumi.Bool(false),
	Name:            pulumi.String("string"),
	Timeout:         pulumi.Int(0),
	WorkingDir:      pulumi.String("string"),
})
Copy
var commandResource = new Command("commandResource", CommandArgs.builder()
    .commandContent("string")
    .type("string")
    .description("string")
    .enableParameter(false)
    .name("string")
    .timeout(0)
    .workingDir("string")
    .build());
Copy
command_resource = alicloud.ecs.Command("commandResource",
    command_content="string",
    type="string",
    description="string",
    enable_parameter=False,
    name="string",
    timeout=0,
    working_dir="string")
Copy
const commandResource = new alicloud.ecs.Command("commandResource", {
    commandContent: "string",
    type: "string",
    description: "string",
    enableParameter: false,
    name: "string",
    timeout: 0,
    workingDir: "string",
});
Copy
type: alicloud:ecs:Command
properties:
    commandContent: string
    description: string
    enableParameter: false
    name: string
    timeout: 0
    type: string
    workingDir: string
Copy

Command 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 Command resource accepts the following input properties:

CommandContent
This property is required.
Changes to this property will trigger replacement.
string
The Base64-encoded content of the command.
Type
This property is required.
Changes to this property will trigger replacement.
string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
Description Changes to this property will trigger replacement. string
The description of command.
EnableParameter Changes to this property will trigger replacement. bool
Specifies whether to use custom parameters in the command to be created. Default to: false.
Name Changes to this property will trigger replacement. string
The name of the command, which supports all character sets. It can be up to 128 characters in length.
Timeout Changes to this property will trigger replacement. int
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
WorkingDir Changes to this property will trigger replacement. string
The execution path of the command in the ECS instance.
CommandContent
This property is required.
Changes to this property will trigger replacement.
string
The Base64-encoded content of the command.
Type
This property is required.
Changes to this property will trigger replacement.
string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
Description Changes to this property will trigger replacement. string
The description of command.
EnableParameter Changes to this property will trigger replacement. bool
Specifies whether to use custom parameters in the command to be created. Default to: false.
Name Changes to this property will trigger replacement. string
The name of the command, which supports all character sets. It can be up to 128 characters in length.
Timeout Changes to this property will trigger replacement. int
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
WorkingDir Changes to this property will trigger replacement. string
The execution path of the command in the ECS instance.
commandContent
This property is required.
Changes to this property will trigger replacement.
String
The Base64-encoded content of the command.
type
This property is required.
Changes to this property will trigger replacement.
String
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
description Changes to this property will trigger replacement. String
The description of command.
enableParameter Changes to this property will trigger replacement. Boolean
Specifies whether to use custom parameters in the command to be created. Default to: false.
name Changes to this property will trigger replacement. String
The name of the command, which supports all character sets. It can be up to 128 characters in length.
timeout Changes to this property will trigger replacement. Integer
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
workingDir Changes to this property will trigger replacement. String
The execution path of the command in the ECS instance.
commandContent
This property is required.
Changes to this property will trigger replacement.
string
The Base64-encoded content of the command.
type
This property is required.
Changes to this property will trigger replacement.
string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
description Changes to this property will trigger replacement. string
The description of command.
enableParameter Changes to this property will trigger replacement. boolean
Specifies whether to use custom parameters in the command to be created. Default to: false.
name Changes to this property will trigger replacement. string
The name of the command, which supports all character sets. It can be up to 128 characters in length.
timeout Changes to this property will trigger replacement. number
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
workingDir Changes to this property will trigger replacement. string
The execution path of the command in the ECS instance.
command_content
This property is required.
Changes to this property will trigger replacement.
str
The Base64-encoded content of the command.
type
This property is required.
Changes to this property will trigger replacement.
str
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
description Changes to this property will trigger replacement. str
The description of command.
enable_parameter Changes to this property will trigger replacement. bool
Specifies whether to use custom parameters in the command to be created. Default to: false.
name Changes to this property will trigger replacement. str
The name of the command, which supports all character sets. It can be up to 128 characters in length.
timeout Changes to this property will trigger replacement. int
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
working_dir Changes to this property will trigger replacement. str
The execution path of the command in the ECS instance.
commandContent
This property is required.
Changes to this property will trigger replacement.
String
The Base64-encoded content of the command.
type
This property is required.
Changes to this property will trigger replacement.
String
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
description Changes to this property will trigger replacement. String
The description of command.
enableParameter Changes to this property will trigger replacement. Boolean
Specifies whether to use custom parameters in the command to be created. Default to: false.
name Changes to this property will trigger replacement. String
The name of the command, which supports all character sets. It can be up to 128 characters in length.
timeout Changes to this property will trigger replacement. Number
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
workingDir Changes to this property will trigger replacement. String
The execution path of the command in the ECS instance.

Outputs

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

Get an existing Command 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?: CommandState, opts?: CustomResourceOptions): Command
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        command_content: Optional[str] = None,
        description: Optional[str] = None,
        enable_parameter: Optional[bool] = None,
        name: Optional[str] = None,
        timeout: Optional[int] = None,
        type: Optional[str] = None,
        working_dir: Optional[str] = None) -> Command
func GetCommand(ctx *Context, name string, id IDInput, state *CommandState, opts ...ResourceOption) (*Command, error)
public static Command Get(string name, Input<string> id, CommandState? state, CustomResourceOptions? opts = null)
public static Command get(String name, Output<String> id, CommandState state, CustomResourceOptions options)
resources:  _:    type: alicloud:ecs:Command    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:
CommandContent Changes to this property will trigger replacement. string
The Base64-encoded content of the command.
Description Changes to this property will trigger replacement. string
The description of command.
EnableParameter Changes to this property will trigger replacement. bool
Specifies whether to use custom parameters in the command to be created. Default to: false.
Name Changes to this property will trigger replacement. string
The name of the command, which supports all character sets. It can be up to 128 characters in length.
Timeout Changes to this property will trigger replacement. int
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
Type Changes to this property will trigger replacement. string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
WorkingDir Changes to this property will trigger replacement. string
The execution path of the command in the ECS instance.
CommandContent Changes to this property will trigger replacement. string
The Base64-encoded content of the command.
Description Changes to this property will trigger replacement. string
The description of command.
EnableParameter Changes to this property will trigger replacement. bool
Specifies whether to use custom parameters in the command to be created. Default to: false.
Name Changes to this property will trigger replacement. string
The name of the command, which supports all character sets. It can be up to 128 characters in length.
Timeout Changes to this property will trigger replacement. int
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
Type Changes to this property will trigger replacement. string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
WorkingDir Changes to this property will trigger replacement. string
The execution path of the command in the ECS instance.
commandContent Changes to this property will trigger replacement. String
The Base64-encoded content of the command.
description Changes to this property will trigger replacement. String
The description of command.
enableParameter Changes to this property will trigger replacement. Boolean
Specifies whether to use custom parameters in the command to be created. Default to: false.
name Changes to this property will trigger replacement. String
The name of the command, which supports all character sets. It can be up to 128 characters in length.
timeout Changes to this property will trigger replacement. Integer
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
type Changes to this property will trigger replacement. String
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
workingDir Changes to this property will trigger replacement. String
The execution path of the command in the ECS instance.
commandContent Changes to this property will trigger replacement. string
The Base64-encoded content of the command.
description Changes to this property will trigger replacement. string
The description of command.
enableParameter Changes to this property will trigger replacement. boolean
Specifies whether to use custom parameters in the command to be created. Default to: false.
name Changes to this property will trigger replacement. string
The name of the command, which supports all character sets. It can be up to 128 characters in length.
timeout Changes to this property will trigger replacement. number
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
type Changes to this property will trigger replacement. string
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
workingDir Changes to this property will trigger replacement. string
The execution path of the command in the ECS instance.
command_content Changes to this property will trigger replacement. str
The Base64-encoded content of the command.
description Changes to this property will trigger replacement. str
The description of command.
enable_parameter Changes to this property will trigger replacement. bool
Specifies whether to use custom parameters in the command to be created. Default to: false.
name Changes to this property will trigger replacement. str
The name of the command, which supports all character sets. It can be up to 128 characters in length.
timeout Changes to this property will trigger replacement. int
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
type Changes to this property will trigger replacement. str
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
working_dir Changes to this property will trigger replacement. str
The execution path of the command in the ECS instance.
commandContent Changes to this property will trigger replacement. String
The Base64-encoded content of the command.
description Changes to this property will trigger replacement. String
The description of command.
enableParameter Changes to this property will trigger replacement. Boolean
Specifies whether to use custom parameters in the command to be created. Default to: false.
name Changes to this property will trigger replacement. String
The name of the command, which supports all character sets. It can be up to 128 characters in length.
timeout Changes to this property will trigger replacement. Number
The timeout period that is specified for the command to be run on ECS instances. Unit: seconds. Default to: 60.
type Changes to this property will trigger replacement. String
The command type. Valid Values: RunBatScript, RunPowerShellScript and RunShellScript.
workingDir Changes to this property will trigger replacement. String
The execution path of the command in the ECS instance.

Import

ECS Command can be imported using the id, e.g.

$ pulumi import alicloud:ecs/command:Command example <id>
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.