Using the Automate with AWS task in Bamboo

Use the Automate with AWS task to run remote actions with AWS from Bamboo jobs, specifically from builds and deployments.



Configuration

To configure an Automate with AWS task:

1. Follow the initial steps in Create a task for a job

2. Select the Automate with AWS task

3. Complete the following settings:

Action

Select the remote AWS action.

Parameters

Specify the parameters (JSON).

Evaluate as condition

Check to fail build based when returning an expected response format.

AWS Security Credentials



Source

Select the AWS Credentials source (see below) – can be either an IAM Role for EC2, or a shared Identity Federation for AWS connector.

Connector

(Conditional) Select the shared Identity Federation for AWS Connector. Alternatively, select [Use connector variable ...] to supply the connector dynamically via Bamboo variables (needs to be a connector id such as f24e81bc-7aff-42db-86a2-7cf82e24d871) – refer to How to parametrize the AWS connector via a Bamboo variable for details.

Role ARN

(Conditional | Optional) Specify the ARN of another role that the agent's IAM role for EC2 should assume.

4. Configure the selected AWS action's parameters template as documented for each action:




Entity Variables

Besides regular Bamboo variables, you can also inject contextual variables with workflow entities into the remote action parameters template – applicable entities for the Bamboo task are:

Examples

The examples are currently composed to reference only core entity variables – you can also reference Bamboo variables and applicable Bamboo specific entity variables.



  • Page:
    Invoke Lambda Function — This parameters template demonstrates the Invoke Lambda Function action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Invoke Lambda Function parameters example (escaped manually)

    {
      "FunctionName": "arn:aws:lambda:ap-southeast-2:123456789012:function:sample-AutomationWithAWSQuickstartLamb-1RRX37PWXZXLS",
      "Payload": "{ \"Event\":\"$event.simpleName\", \"Timestamp\": \"$event.timestamp\", \"TraceID\": \"$event.traceId\"}"
    }

    Invoke Lambda Function parameters example (escaped with utility function)

    {
      "FunctionName": "arn:aws:lambda:ap-southeast-2:123456789012:function:sample-AutomationWithAWSQuickstartLamb-1RRX37PWXZXLS",
      "Payload": "$util.escapeJson('{
        "Event": "$event.simpleName",
        "Timestamp": "$event.timestamp",
        "TraceID": "$event.traceId"
      }')"
    }
  • Page:
    Publish SNS Message - raw text format — This parameters template demonstrates publishing a SNS message in raw text format with the Publish SNS Message action:

    Publish SNS Message parameters example (raw text format)

    {
      "TopicArn": "arn:aws:sns:ap-southeast-2:123456789012:sample-AutomationWithAWSQuickstartSNSTopic-15EO7TT8O93XT",
      "Message": "$event.simpleName with trace ID $event.traceId triggered at $event.timestamp",
      "Subject": "Automation with AWS: $event.simpleName triggered at $event.timestamp"
    }
  • Page:
    Publish SNS Message - structured JSON format — This parameters template demonstrates publishing a SNS message in structured JSON format with the Publish SNS Message action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    JSON Message Generator

    The AWS Management Console features a JSON Message Generator that eases composition of the required JSON message structure, refer to section Create Different Messages for Each Protocol for within Publish to a topic for details.

    Publish SNS Message parameters example (structured JSON format – escaped manually)

    {
      "TopicArn": "arn:aws:sns:ap-southeast-2:123456789012:sample-AutomationWithAWSQuickstartSNSTopic-15EO7TT8O93XT",
      "Message": "{ \"default\": \"$event.simpleName with trace ID $event.traceId triggered at $event.timestamp\"}",
      "MessageStructure": "json",
      "Subject": "Automation with AWS: $event.simpleName triggered at $event.timestamp"
    }

    Publish SNS Message parameters example (structured JSON format – escaped with utility function)

    {
      "TopicArn": "arn:aws:sns:ap-southeast-2:123456789012:sample-AutomationWithAWSQuickstartSNSTopic-15EO7TT8O93XT",
      "Message": "$util.escapeJson('{
        "default": "$event.simpleName with trace ID $event.traceId triggered at $event.timestamp"
      }')",
      "MessageStructure": "json",
      "Subject": "Automation with AWS: $event.simpleName triggered at $event.timestamp"
    }
  • Page:
    Put EventBridge/CloudWatch Events - Atlassian Workflow Event — This parameters template demonstrates the Put EventBridge/CloudWatch Events action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Event Patterns in CloudWatch Events

    This is an opinionated example that works well for ingesting custom events from Atlassian products – refer to Event Patterns in CloudWatch Events for details on these and other available fields.


    Put EventBridge/CloudWatch Events parameters example - Atlassian Workflow Event (escaped manually)

    {
      "Entries": [
        {
          "Source": "net.utoolity.atlassian",
          "DetailType": "Atlassian Workflow Event",
          "Detail": "{ \"event\": \"$event.simpleName\", \"traceId\": \"$event.traceId\" }"
        }
      ]
    }

    Put EventBridge/CloudWatch Events parameters example - Atlassian Workflow Event (escaped with utility function)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian",
          "DetailType": "Atlassian Workflow Event",
          "Detail": "$util.escapeJson('{
            "event": "$event.simpleName",
            "traceID": "$event.traceId"
          }')"
        }
      ]
    }
  • Page:
    Put EventBridge/CloudWatch Events - Bamboo Build Notification — This parameters template demonstrates the Put EventBridge/CloudWatch Events action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Event Patterns in CloudWatch Events

    This is an opinionated example that works well for ingesting custom events from Atlassian products – refer to Event Patterns in CloudWatch Events for details on these and other available fields.

    Put EventBridge/CloudWatch Events parameters example - Bamboo Build Notification (escaped manually)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo Build Notification",
          "Detail": "{ \"plan\": $plan, \"resultsSummary\": $resultsSummary }"
        }
      ]
    }

    Put EventBridge/CloudWatch Events parameters example - Bamboo Build Notification (escaped with utility function)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo Build Notification",
          "Detail": "$util.escapeJson('{
            "plan": $plan,
            "resultsSummary": $resultsSummary
          }')"
        }
      ]
    }
  • Page:
    Put EventBridge/CloudWatch Events - Bamboo Build Task Execution — This parameters template demonstrates the Put EventBridge/CloudWatch Events action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Event Patterns in CloudWatch Events

    This is an opinionated example that works well for ingesting custom events from Atlassian products – refer to Event Patterns in CloudWatch Events for details on these and other available fields.


    Put EventBridge/CloudWatch Events parameters example - Bamboo Build Task Execution (escaped manually)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo Build Task Execution",
          "Detail": "{ \"agentId\": \"${bamboo.agentId}\", \"buildResultKey\": \"${bamboo.buildResultKey}\", \"resultsUrl\": \"${bamboo.resultsUrl}\" }"
        }
      ]
    }

    Put EventBridge/CloudWatch Events parameters example - Bamboo Build Task Execution (escaped with utility function)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo Build Task Execution",
          "Detail": "$util.escapeJson('{
            "agentId": "${bamboo.agentId}",
            "buildResultKey": "${bamboo.buildResultKey}",
            "resultsUrl": "${bamboo.resultsUrl}"
          }')"
        }
      ]
    }
  • Page:
    Put EventBridge/CloudWatch Events - Bamboo Deployment Notification — This parameters template demonstrates the Put EventBridge/CloudWatch Events action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Event Patterns in CloudWatch Events

    This is an opinionated example that works well for ingesting custom events from Atlassian products – refer to Event Patterns in CloudWatch Events for details on these and other available fields.

    Put EventBridge/CloudWatch Events parameters example - Bamboo Deployment Notification (escaped manually)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo Deployment Notification",
          "Detail": "{ \"plan\": $plan, \"deploymentResult\": $deploymentResult }"
        }
      ]
    }

    Put EventBridge/CloudWatch Events parameters example - Bamboo Deployment Notification (escaped with utility function)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo Deployment Notification",
          "Detail": "$util.escapeJson('{
            "plan": $plan,
            "deploymentResult": $deploymentResult
          }')"
        }
      ]
    }
  • Page:
    Put EventBridge/CloudWatch Events - Bamboo Deployment Task Execution — This parameters template demonstrates the Put EventBridge/CloudWatch Events action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Event Patterns in CloudWatch Events

    This is an opinionated example that works well for ingesting custom events from Atlassian products – refer to Event Patterns in CloudWatch Events for details on these and other available fields.

    Put EventBridge/CloudWatch Events parameters example - Bamboo Deployment Task Execution (escaped manually)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo Deployment Task Execution",
          "Detail": "{ \"agentId\": \"${bamboo.agentId}\", \"buildResultKey\": \"${bamboo.buildResultKey}\", \"resultsUrl\": \"${bamboo.resultsUrl}\", \"deploymentProject\": \"${bamboo.deploy.project}\", \"deploymentEnvironment\": \"${bamboo.deploy.environment}\" }"
        }
      ]
    }
    

    Put EventBridge/CloudWatch Events parameters example - Bamboo Deployment Task Execution (escaped with utility function)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo Deployment Task Execution",
          "Detail": "$util.escapeJson('{
            "agentId": "${bamboo.agentId}",
            "buildResultKey": "${bamboo.buildResultKey}",
            "resultsUrl": "${bamboo.resultsUrl}",
            "deploymentProject": "${bamboo.deploy.project}",
            "deploymentEnvironment": "${bamboo.deploy.environment}"
          }')"
        }
      ]
    }
  • Page:
    Put EventBridge/CloudWatch Events - Bamboo System Notification — This parameters template demonstrates the Put EventBridge/CloudWatch Events action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Event Patterns in CloudWatch Events

    This is an opinionated example that works well for ingesting custom events from Atlassian products – refer to Event Patterns in CloudWatch Events for details on these and other available fields.

    Put EventBridge/CloudWatch Events parameters example - Bamboo System Notification (escaped manually)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo System Notification",
          "Detail": "{ \"plan\": $plan }"
        }
      ]
    }
    

    Put EventBridge/CloudWatch Events parameters example - Bamboo System Notification (escaped with utility function)

    {
      "Entries": [
        {
          "Time": "$event.timestamp",
          "Source": "net.utoolity.atlassian.bamboo.automation-with-aws-bamboo",
          "DetailType": "Bamboo System Notification",
          "Detail": "$util.escapeJson('{
            "plan": $plan
          }')"
        }
      ]
    }
  • Page:
    Send SMS Message — This parameters template demonstrates sending a SMS message directly to a phone number with the Publish SNS Message action:

    Send SMS Message parameters example

    {
      "PhoneNumber": "+61.1234567890",
      "Message": "Automation with AWS: $event.simpleName with trace ID $event.traceId triggered at $event.timestamp",
      "MessageAttributes": {
        "AWS.SNS.SMS.SenderID": {
          "DataType": "String",
          "StringValue": "Utoolity"
        }
      }
    }
  • Page:
    Send SQS Message - raw text payload — This parameters template demonstrates the Send SQS Message action:

    Send SQS Message parameters example (raw text payload)

    {
      "QueueUrl": "https://sqs.ap-southeast-2.amazonaws.com/123456789012/sample-AutomationWithAWSQuickstartSQSQueue-1NAIZP8U9XJ1X",
      "MessageBody": "Automation with AWS: $event.simpleName with trace ID $event.traceId triggered at $event.timestamp - see ${bamboo.resultsUrl} for details."
    }
  • Page:
    Send SQS Message - structured JSON payload — This parameters template demonstrates the Send SQS Message action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Send SQS Message parameters example (Atlassian Workflow Event – escaped manually)

    {
      "QueueUrl": "https://sqs.ap-southeast-2.amazonaws.com/123456789012/sample-AutomationWithAWSQuickstartSQSQueue-1NAIZP8U9XJ1X",
      "MessageBody": "{ \"event\": \"$event.simpleName\", \"timestamp\": \"$event.timestamp\", \"traceId\": \"$event.traceId\" }"
    }

    Send SQS Message parameters example (Atlassian Workflow Event – escaped with utility function)

    {
      "QueueUrl": "https://sqs.ap-southeast-2.amazonaws.com/123456789012/sample-AutomationWithAWSQuickstartSQSQueue-1NAIZP8U9XJ1X",
      "MessageBody": "$util.escapeJson('{
        "event": "$event.simpleName",
        "timestamp": "$event.timestamp",
        "traceId": "$event.traceId"
      }')"
    }
  • Page:
    Start Step Functions Execution — This parameters template demonstrates the Start Step Functions Execution action:

    JSON escaping requirements

    If a parameter within the JSON formatted parameters template is a JSON structure in itself (e.g. the Lambda function payload), it needs to be escaped before adding it as a value - this has two implications:

    • (tick) custom content needs to be escaped, which can be achieved by Composing action payloads with utility functions, specifically the $util.escapeJson() function

    • (warning) variables with conflicting content (e.g. multi line variables like JIRA's $issue.fields.description or Bamboo's $notification.textEmailContent or JSON structures retrieved via JSONPath) need to be escaped twice, via $util.escapeJson($util.escapeJson(...)) - we are exploring options on how to make this easier in a future release

    Start Step Functions Execution parameters example (escaped manually)

    {
      "StateMachineArn": "arn:aws:states:ap-southeast-2:123456789012:stateMachine:sample-AutomationWithAWSQuickstartStepFunctionsStateMachine-UHDE4Y9QTDIN",
      "Input": "{ \"Event\":\"$event.simpleName\", \"Timestamp\": \"$event.timestamp\", \"TraceID\": \"$event.traceId\"}"
    }

    Start Step Functions Execution parameters example (escaped with utility function)

    {
      "StateMachineArn": "arn:aws:states:ap-southeast-2:123456789012:stateMachine:sample-AutomationWithAWSQuickstartStepFunctionsStateMachine-UHDE4Y9QTDIN",
      "Input": "$util.escapeJson('{
        "Event": "$event.simpleName",
        "Timestamp": "$event.timestamp",
        "TraceID": "$event.traceId"
      }')"
    }

How-to Articles

Filter by label

There are no items with the selected labels at this time.

Frequently Asked Questions (FAQ)

Atlassian®, Atlassian Bamboo®, Bitbucket®, Atlassian Crowd®, Confluence®, Jira®, Jira Service Management™, Opsgenie®, and Statuspage™ are registered trademarks of Atlassian.
Amazon Web Services™, AWS™ and the “Powered by Amazon Web Services” logo are trademarks of Amazon.com, Inc. or its affiliates in the United States and/or other countries.

Utoolity® is a registered trademark of Utoolity GmbH.
© 2024 Utoolity GmbH. All rights reserved.