Task
Reference doc for the `sst.aws.Task` component.
The Task
component is internally used by the Cluster
component to deploy tasks to
Amazon ECS. It uses AWS Fargate.
This component is returned by the addTask
method of the Cluster
component.
Constructor
Parameters
-
name
string
-
args
TaskArgs
-
opts?
ComponentResourceOptions
Properties
nodes
Type Object
The underlying resources this component creates.
nodes.executionRole
Type Role
The Amazon ECS Execution Role.
nodes.taskDefinition
Type Output
<
TaskDefinition
>
The Amazon ECS Task Definition.
nodes.taskRole
Type Role
The Amazon ECS Task Role.
taskDefinition
Type Output
<
string
>
The ARN of the ECS Task Definition.
SDK
Use the SDK in your runtime to interact with your infrastructure.
Links
This is accessible through the Resource
object in the SDK.
-
assignPublicIp
boolean
Whether to assign a public IP address to the task.
-
cluster
string
The ARN of the cluster this task is deployed to.
-
containers
string
The names of the containers in the task.
-
securityGroups
string
The security groups for the task.
-
subnets
string
The subnets for the task.
-
taskDefinition
string
The ARN of the ECS Task Definition.
describe
Parameters
Returns Promise
<
any
>
Gets the details of a task. Tasks stopped longer than 1 hour are not returned.
For example, let’s say you have started task.
You can get the details of the task with the following.
run
Parameters
-
resource
Resource
-
environment?
Record
<
string
,string
>
-
options?
Object
Returns Promise
<
any
>
Runs a task.
For example, let’s say you have a task.
You can run it in your application with the following.
taskArn
is the ARN of the task. You can pass it to the describe
function to get
the status of the task; or to the stop
function to stop the task.
You can also pass in environment variables to the task.
stop
Parameters
Returns Promise
<
any
>
Stops a task.
For example, let’s say you have started a task.
You can stop the task with the following.
Options
Type Object
Options.aws?
Type Object
Configure the AWS client.
Options.aws.accessKeyId?
Type string
Options.aws.allHeaders?
Type boolean
Options.aws.appendSessionToken?
Type boolean
Options.aws.cache?
Type Map
<
string
, ArrayBuffer
<
>
>
Options.aws.datetime?
Type string
Options.aws.region?
Type string
Options.aws.secretAccessKey?
Type string
Options.aws.service?
Type string
Options.aws.sessionToken?
Type string
Options.aws.signQuery?
Type boolean
Options.aws.singleEncode?
Type boolean
Resource
Type Object
Resource.assignPublicIp
Type boolean
Whether to assign a public IP address to the task.
Resource.cluster
Type string
The ARN of the cluster.
Resource.containers
Type string
[]
The names of the containers in the task.
Resource.securityGroups
Type string
[]
The security groups to use for the task.
Resource.subnets
Type string
[]
The subnets to use for the task.
Resource.taskDefinition
Type string
The ARN of the task definition.