

# `AWSSupport-SendLogBundleToS3Bucket`
<a name="automation-awssupport-sendlogbundletos3bucket"></a>

 **Description** 

The `AWSSupport-SendLogBundleToS3Bucket` runbook uploads a log bundle generated by the EC2Rescue tool from the target instance to the specified S3 bucket. The runbook installs the platform specific version of EC2Rescue based on the platform of the target instance. EC2Rescue is then used to collect all the available operating system (OS) logs.

[Run this Automation (console)](https://console.amazonaws.cn/systems-manager/automation/execute/AWSSupport-SendLogBundleToS3Bucket)

**Document type**

Automation

**Owner**

Amazon

**Platforms**

Linux, macOS, Windows

**Parameters**
+ AutomationAssumeRole

  Type: String

  Description: (Optional) The Amazon Resource Name (ARN) of the Amazon Identity and Access Management (IAM) role that allows Systems Manager Automation to perform the actions on your behalf. If no role is specified, Systems Manager Automation uses the permissions of the user that starts this runbook.
+ InstanceId

  Type: String

  Description: (Required) The ID of the Windows or Linux managed instance you want to collect logs from.
+ S3BucketName

  Type: String

  Description: (Required) S3 bucket to upload the logs to.
+ S3Path

  Type: String

  Default: `AWSSupport-SendLogBundleToS3Bucket`/

  Description: (Optional) S3 path for the collected logs.

**Required IAM permissions**

The `AutomationAssumeRole` parameter requires the following actions to use the runbook successfully.

It is recommended that the EC2 instance receiving the command has an IAM role with the **AmazonSSMManagedInstanceCore** Amazon managed policy attached. The user must have at least **ssm:StartAutomationExecution** and **ssm:SendCommand** to run the automation and send the command to the instance, plus **ssm:GetAutomationExecution** to be able to read the automation output.

 **Document Steps** 

1. `aws:runCommand` - Install EC2Rescue via `AWS-ConfigureAWSPackage`.

1. `aws:runCommand` - Run the PowerShell script to collect Windows troubleshooting logs with EC2Rescue.

1. `aws:runCommand` - Run the bash script to collect Linux troubleshooting logs with EC2Rescue.

 **Outputs** 

collectAndUploadWindowsLogBundle.Output

collectAndUploadLinuxLogBundle.Output