# AWSUtility::CloudFormation::CommandRunner The AWSUtility::CloudFormation::CommandRunner resource runs any command provided to it before or after any Stack resource. The output of the command can be accessed by using Fn::GetAtt on the AWSUtility::CloudFormation::CommandRunner resource. ## Syntax To declare this entity in your AWS CloudFormation template, use the following syntax: ### JSON
{
    "Type" : "AWSUtility::CloudFormation::CommandRunner",
    "Properties" : {
        "Command" : String,
        "Role" : String,
        "LogGroup" : String,
        "SubnetId" : String,
        "KeyId" : String,
        "SecurityGroupId" : String,
        "DisableTerminateInstancesCheck" : String,
        "Timeout" : String,
        "InstanceType" : String
    }
}
### YAML
Type: AWSUtility::CloudFormation::CommandRunner
Properties:
    Command: String
    Role: String
    LogGroup: String
    SubnetId: String
    KeyId: String
    SecurityGroupId: String
    DisableTerminateInstancesCheck: String
    Timeout: String
    InstanceType: String
## Properties #### Command The command to be run using the provided IAM role. Use '>' to output to the file /command-output.txt and it will be available when referencing this resource using Fn::Ref. _Required_: Yes _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) #### Role The IAM role used to run the specified command. _Required_: No _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) #### LogGroup The CloudWatch Log Group to stream the logs from the specified command. _Required_: No _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) #### SubnetId Id of the Subnet to execute the command in. _Required_: No _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) #### KeyId Id of the KMS key to use when encrypting the output stored in SSM. If not specified, the account's default KMS key is used. _Required_: No _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) #### SecurityGroupId Id of the Security Group to attach to the instance the command is run in. If using SecurityGroup, SubnetId is required. _Required_: No _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) #### DisableTerminateInstancesCheck By default, CommandRunner checks to see if the execution role can perform a TerminateInstances API call. Set this property to true if you want to skip the check. Note that this means that the CommandRunner instance may not be terminated and will have to be terminated manually. _Required_: No _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) #### Timeout By default, the timeout is 600 seconds. To increase the timeout specify a higher Timeout value in seconds. Maximum timeout value is 43200 seconds i.e 12 hours. _Required_: No _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) #### InstanceType By default, the instance type used is t2.medium. However you can use this property to specify any supported instance type. _Required_: No _Type_: String _Update requires_: [No interruption](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-updating-stacks-update-behaviors.html#update-no-interrupt) ## Return Values ### Ref When you pass the logical ID of this resource to the intrinsic `Ref` function, Ref returns the Id. ### Fn::GetAtt The `Fn::GetAtt` intrinsic function returns a value for a specified attribute of this type. The following are the available attributes and sample return values. For more information about using the `Fn::GetAtt` intrinsic function, see [Fn::GetAtt](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/intrinsic-function-reference-getatt.html). #### Output Output of the command that was executed. #### Id Id of the command executed [Read-Only]