AWSPremiumSupport-TroubleshootEC2DiskUsage - Amazon Systems Manager Automation runbook reference
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

AWSPremiumSupport-TroubleshootEC2DiskUsage

Description

The AWSPremiumSupport-TroubleshootEC2DiskUsage runbook helps you investigate and potentially remediate issues with Amazon Elastic Compute Cloud (Amazon EC2) instance root and non-root disk usage. If possible, the runbook attempts to remediate issues by extending the volume and its file system. To perform these tasks, this runbook orchestrates the execution of several runbooks based on the operating system of the affected instance.

The first runbook, AWSPremiumSupport-DiagnoseDiskUsageOnWindows or AWSPremiumSupport-DiagnoseDiskUsageOnLinux, determines if disk issues can be mitigated by expanding the volume.

The second runbook, AWSPremiumSupport-ExtendVolumesOnWindows or AWSPremiumSupport-ExtendVolumesOnLinux, uses the output of the first runbook to run Python code that modifies the volume. After the volume has been modified, the runbook extends the partition and file system of the affected volumes.

Important

Access to AWSPremiumSupport-* runbooks requires an Enterprise or Business Support Subscription. For more information, see Compare Amazon Web Services Support Plans.

This document was built in collaboration with Amazon Managed Services (AMS). AMS helps you manage your Amazon infrastructure more efficiently and securely. AMS also provides operational flexibility, enhanced security and compliance, capacity optimization, and cost-savings identification. For more information, see Amazon Managed Services.

Run this Automation (console)

Document type

Automation

Owner

Amazon

Platforms

Linux, Windows

Parameters

  • InstanceId

    Type: String

    Allowed values: ^i-[a-z0-9]{8,17}$

    Description: (Required) ID of your Amazon EC2 instance.

  • VolumeExpansionEnabled

    Type: Boolean

    Description: (Optional) Flag to control whether the document will extend the volumes and partitions affected.

    Default: true

  • VolumeExpansionUsageTrigger

    Type: String

    Description: (Optional) Minimum usage of partition space required to trigger extension (in percentage).

    Allowed values: ^[0-9]{1,2}$

    Default: 85

  • VolumeExpansionCapSize

    Type: String

    Description: (Optional) Maximum size that the Amazon Elastic Block Store (Amazon EBS) volume will be increased to (in GiB).

    Allowed values: ^[0-9]{1,4}$

    Default: 2048

  • VolumeExpansionGibIncrease

    Type: String

    Description: (Optional) Increase in GiB of the volume. The biggest net increase between VolumeExpansionGibIncrease and VolumeExpansionPercentageIncrease will be used.

    Allowed values: ^[0-9]{1,4}$

    Default: 20

  • VolumeExpansionPercentageIncrease

    Type: String

    Description: (Optional) Increase in percentage of the volume. The biggest net increase between VolumeExpansionGibIncrease and VolumeExpansionPercentageIncrease will be used.

    Allowed values: ^[0-9]{1,2}$

    Default: 20

  • 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.

Required IAM permissions

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

  • ec2:DescribeVolumes

  • ec2:DescribeVolumesModifications

  • ec2:ModifyVolume

  • ec2:DescribeInstances

  • ec2:CreateImage

  • ec2:DescribeImages

  • ec2:DescribeTags

  • ec2:CreateTags

  • ec2:DeleteTags

  • ssm:StartAutomationExecution

  • ssm:GetAutomationExecution

  • ssm:DescribeAutomationStepExecutions

  • ssm:DescribeAutomationExecutions

  • ssm:SendCommand

  • ssm:DescribeInstanceInformation

  • ssm:ListCommands

  • ssm:ListCommandInvocations

Document Steps

  1. aws:assertAwsResourceProperty - Check if the instance is managed by Systems Manager

  2. aws:executeAwsApi - Describes the instance to get the platform.

  3. aws:branch - Branches automation based on the instance's platform.

    1. If the instance is Windows:

      1. aws:executeAutomation - Run the AWSPremiumSupport-DiagnoseDiskUsageOnWindows runbook in order to diagnose disk usage issues on the instance.

      2. aws:executeAwsApi - Gets the output of the previous automation.

      3. aws:branch - Branches based on the output of the diagnostics, and if there are volumes that can be expanded to mitigate the alert.

        1. There are no volumes that need to be expanded: End the automation.

        2. There are volumes that need to be expanded:

          1. aws:executeAwsApi - Create an Amazon Machine Image (AMI) of the instance.

          2. aws:waitForAwsResourceProperty - Waits for the AMI state to be available.

          3. aws:executeAutomation - Run the AWSPremiumSupport-ExtendVolumesOnWindows runbook in order to perform the volume modification as well as the required steps in the operating system (OS) to make the new space available.

    2. (Platform is not windows) If the input instance is not Windows:

      1. aws:executeAutomation - Run the AWSPremiumSupport-DiagnoseDiskUsageOnLinux runbook in order to diagnose disk usage issues on the instance.

      2. aws:executeAwsApi - Gets the output of the previous automation.

      3. aws:branch - Branches based on the output of the diagnostics, and if there are volumes that can be expanded to mitigate the alert.

        1. There are no volumes that need to be expanded: End the automation.

        2. There are volumes that need to be expanded:

          1. aws:executeAwsApi - Create an AMI of the instance.

          2. aws:waitForAwsResourceProperty - Waits for AMI state to be available.

          3. aws:executeAutomation - Run the AWSPremiumSupport-ExtendVolumesOnLinux runbook in order to perform the volume modification as well as the required steps in the OS to make the new space available.

Outputs

diagnoseDiskUsageAlertOnWindows.Output

extendVolumesOnWindows.Output

diagnoseDiskUsageAlertOnLinux.Output

extendVolumesOnLinux.Output

BackupAMILinux.ImageId

BackupAMIWindows.ImageId