Run an AWS CLI Script

Octopus.AwsRunScript exported 2026-07-22 by Octopus Deploy belongs to ‘Aws’ category.

Log into AWS and run a script with the AWS CLI.

Parameters

When this step is included in a project’s deployment process, the parameters below can be set.

Use EC2 Instance Role

Octopus.Action.AwsAccount.UseInstanceRole

Execute using the AWS service role for an EC2 instance.

Allowed values: True, False

Default: False

AWS Account

Octopus.Action.AwsAccount.Variable

The AWS account variable to use for authentication.

Assume a Different AWS Service Role

Octopus.Action.Aws.AssumeRole

Whether to assume a different AWS IAM role for executing this step.

Allowed values: True, False

Default: False

Assumed Role ARN

Octopus.Action.Aws.AssumedRoleArn

The Amazon Resource Name (ARN) of the IAM role to assume.

Example: arn:aws:iam::123456789012:role/ExampleRole

Assumed Role Session Name

Octopus.Action.Aws.AssumedRoleSession

A name for the assumed role session. Leave blank to use an automatically generated session name.

Assumed Role Session Duration (seconds)

Octopus.Action.Aws.AssumeRoleSessionDurationSeconds

The duration in seconds for the assumed role session. If blank, defaults to 3600 seconds (1 hour). AWS requires a session duration between 900 seconds (15 minutes) and 43200 seconds (12 hours).

Example: 3600

Assumed Role External ID

Octopus.Action.Aws.AssumeRoleExternalId

An external ID to provide additional security when assuming the role.

Region

Octopus.Action.Aws.Region (required)

The default AWS region code for this step.

Example: us-west-2

Script Source

Octopus.Action.Script.ScriptSource (required)

The source of the script to run.

Allowed values: Inline, Package, GitRepository

Script Body

Octopus.Action.Script.ScriptBody

The inline script body to execute when the script source is set to Inline.

Script Syntax

Octopus.Action.Script.Syntax

The scripting language to use. Required when the script source is Inline.

Allowed values: PowerShell, Bash

Script File Name

Octopus.Action.Script.ScriptFileName

The path to the script file inside the package or Git repository. Required when the script source is Package or GitRepository.

Example: Deploy.sh

Script Parameters

Octopus.Action.Script.ScriptParameters

Parameters to pass to the script.

Optional features

Enable features by adding their IDs to Octopus.Action.EnabledFeatures (a comma-separated list).

Structured Configuration Variables Octopus.Features.JsonConfigurationVariables

Replace settings in JSON, YAML, XML, and Java Properties files with Octopus variables. Enabled by default for package deployments.

Octopus.Action.Package.JsonConfigurationVariablesTargets

Octopus.Action.Package.JsonConfigurationVariablesTargets

Newline-separated list of target files (e.g. appsettings.json). Wildcards supported.

Substitute Variables in Templates Octopus.Features.SubstituteInFiles

Transforms files using the Octopus #{Variable} substitution syntax. Enabled by default for package deployments.

Octopus.Action.SubstituteInFiles.TargetFiles

Octopus.Action.SubstituteInFiles.TargetFiles

Newline-separated list of file names to transform (relative to package). Wildcards supported.

Octopus.Action.SubstituteInFiles.OutputEncoding

Octopus.Action.SubstituteInFiles.OutputEncoding

Encoding name for the output file (e.g. utf-8). Optional.

PowerShell Edition Octopus.Features.SelectPowerShellEditionForWindows

Specify the edition of PowerShell used during deployments on Windows.

Octopus.Action.PowerShell.Edition

Octopus.Action.PowerShell.Edition

PowerShell edition on Windows (Desktop or Core).

Allowed values: Desktop, Core

Step configuration using OCL

Example in Octopus Configuration Language (OCL):

step "run-aws-script" {
    name = "Run AWS Script"

    action {
        action_type = "Octopus.AwsRunScript"
        properties = {
            Octopus.Action.Aws.AssumeRole = "False"
            Octopus.Action.Aws.Region = "us-east-1"
            Octopus.Action.AwsAccount.UseInstanceRole = "False"
            Octopus.Action.AwsAccount.Variable = "aws-account"
            Octopus.Action.RunOnServer = "false"
            Octopus.Action.Script.ScriptBody = "aws s3 ls"
            Octopus.Action.Script.ScriptSource = "Inline"
            Octopus.Action.Script.Syntax = "PowerShell"
            OctopusUseBundledTooling = "False"
        }
    }
}

Page updated on Wednesday, July 22, 2026