### Start EBS Snapshot with Rust SDK Source: https://docs.aws.amazon.com/ebs/latest/userguide/sdk.md Use the `StartSnapshot` API to initiate a new EBS snapshot. Ensure you have the necessary AWS SDK for Rust setup. ```rust async fn start(client: &Client, description: &str) -> Result { let snapshot = client .start_snapshot() .description(description) .encrypted(false) .volume_size(1) .send() .await?; Ok(snapshot.snapshot_id.unwrap()) } ``` -------------------------------- ### Install fio on Ubuntu Source: https://docs.aws.amazon.com/ebs/latest/userguide/benchmark_procedures.md Use this command to install the fio benchmarking tool on Ubuntu instances. fio requires the `libaio-devel` package. ```bash sudo apt-get install -y fio ``` -------------------------------- ### MBR Partitioning Example (Linux) Source: https://docs.aws.amazon.com/ebs/latest/userguide/modify-volume-requirements.md An example output from `gdisk -l` on a SUSE instance indicating MBR partitioning is present and GPT is not. ```text GPT fdisk (gdisk) version 0.8.8 Partition table scan: MBR: MBR only BSD: not present APM: not present GPT: not present ``` -------------------------------- ### GPT Partitioning Example (Linux) Source: https://docs.aws.amazon.com/ebs/latest/userguide/modify-volume-requirements.md An example output from `gdisk -l` on an Amazon Linux instance indicating GPT partitioning is present. ```text GPT fdisk (gdisk) version 0.8.10 Partition table scan: MBR: protective BSD: not present APM: not present GPT: present Found valid GPT with protective MBR; using GPT. ``` -------------------------------- ### Install XFS Tools Source: https://docs.aws.amazon.com/ebs/latest/userguide/ebs-using-volumes.md If the `mkfs.xfs` command is not found, install the necessary XFS tools using `yum install xfsprogs`. ```bash [ec2-user ~]$ sudo yum install xfsprogs ``` -------------------------------- ### Example output for describe-snapshots Source: https://docs.aws.amazon.com/ebs/latest/userguide/view-archived-snapshot.md This JSON output details snapshots, indicating their state, volume size, and start time. The `StorageTier` field shows 'archive' for archived snapshots and 'standard' otherwise. `RestoreExpiryTime` is shown for temporarily restored snapshots. ```json { "Snapshots": [ { "Description": "Snap A", "Encrypted": false, "VolumeId": "vol-01234567890aaaaaa", "State": "completed", "VolumeSize": 8, "StartTime": "2021-09-07T21:00:00.000Z", "Progress": "100%", ``` -------------------------------- ### Install nvme-cli tool Source: https://docs.aws.amazon.com/ebs/latest/userguide/nvme-detailed-performance-stats.md Install the nvme-cli tool on older Amazon Linux AMIs to access NVMe statistics. ```bash sudo yum install nvme-cli ``` -------------------------------- ### Example Output for Restoring Volume Source: https://docs.aws.amazon.com/ebs/latest/userguide/recycle-bin-working-with-volumes.md This is an example of the JSON output returned after successfully restoring a volume from the Recycle Bin. ```json { "VolumeId": "vol-01234567890abcdef", "State": "available", "Size": 100, "VolumeType": "gp3", "AvailabilityZone": "us-east-1a", "CreateTime": "2021-12-01T13:00:00.000000+00:00", "Encrypted": false } ``` -------------------------------- ### Install fio on Amazon Linux Source: https://docs.aws.amazon.com/ebs/latest/userguide/benchmark_procedures.md Use this command to install the fio benchmarking tool on Amazon Linux instances. fio requires the `libaio-devel` package. ```bash $ sudo yum install -y fio ``` -------------------------------- ### Install fio on Amazon Linux Source: https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.md Command to install the fio utility on Amazon Linux instances using yum. ```bash sudo yum install -y fio ``` -------------------------------- ### StartSnapshot Source: https://docs.aws.amazon.com/ebs/latest/userguide/sdk.md This code example demonstrates how to initiate a snapshot creation process using the `StartSnapshot` API in the AWS SDK for Rust. ```APIDOC ## StartSnapshot ### Description Initiates the creation of a snapshot for an EBS volume. ### Method `start_snapshot()` ### Parameters - `description` (str) - A description for the snapshot. - `encrypted` (bool) - Whether the snapshot should be encrypted. - `volume_size` (usize) - The size of the volume in GiBs. ### Request Example ```rust async fn start(client: &Client, description: &str) -> Result { let snapshot = client .start_snapshot() .description(description) .encrypted(false) .volume_size(1) .send() .await?; Ok(snapshot.snapshot_id.unwrap()) } ``` ### Response #### Success Response (200) - `snapshot_id` (String) - The ID of the created snapshot. ``` -------------------------------- ### Example Calculation for Individual Snapshot Copy Duration Source: https://docs.aws.amazon.com/ebs/latest/userguide/time-based-copies.md This example demonstrates the calculation for a snapshot with 900,000 MiB of data, showing how the formula results in a 30-minute completion duration. ```text minimum completion duration = Max(15 minutes, (900,000 MiB ÷ 500 MiB/s) = Max(15 minutes, 30 minutes) = 30 minutes ``` -------------------------------- ### Start DiskPart utility Source: https://docs.aws.amazon.com/ebs/latest/userguide/raid-config.md Initiate the DiskPart command-line utility on Windows to manage disk volumes. ```batch diskpart Microsoft DiskPart version 6.1.7601 Copyright (C) 1999-2008 Microsoft Corporation. On computer: WIN-BM6QPPL51CO ``` -------------------------------- ### StartSnapshot Source: https://docs.aws.amazon.com/ebs/latest/APIReference/API_Operations.md Starts the creation of a snapshot. ```APIDOC ## StartSnapshot ### Description Starts the creation of a snapshot. ### Method POST ### Endpoint / ### Parameters #### Query Parameters - **Action** (string) - Required - The name of the action to perform. - **Version** (string) - Required - The version of the API to use. #### Request Body (No request body is specified in the source) ### Request Example (No request example is specified in the source) ### Response #### Success Response (200) (No success response details are specified in the source) #### Response Example (No response example is specified in the source) ``` -------------------------------- ### AWS CLI: Example Output for Permanent Restore Change Source: https://docs.aws.amazon.com/ebs/latest/userguide/modify-temp-restore-period.md This is an example of the JSON output received after changing a snapshot restore to permanent. ```json { "SnapshotId": "snap-0abcdef1234567890", "IsPermanentRestore": true } ``` -------------------------------- ### Start Backup Operation Logging Source: https://docs.aws.amazon.com/ebs/latest/userguide/automate-app-consistent-backups.md Logs the start of a backup operation, including the operation type and the current execution ID, along with a timestamp. ```bash echo "INFO: ${OPERATION} starting at $(date) with executionId: ${EXECUTION_ID}" ``` -------------------------------- ### Install mdadm on Linux Source: https://docs.aws.amazon.com/ebs/latest/userguide/raid-config.md If the 'mdadm' command is not found, use this command to install it. This is a prerequisite for creating RAID arrays on Linux. ```bash sudo yum install mdadm ``` -------------------------------- ### Example output of /proc/mdstat Source: https://docs.aws.amazon.com/ebs/latest/userguide/raid-config.md This is an example of the output from the 'cat /proc/mdstat' command, showing the status of an active RAID 0 array. ```text Personalities : [raid0] md0 : active raid0 xvdc[1] xvdb[0] 41910272 blocks super 1.2 512k chunks unused devices: ``` -------------------------------- ### Example Response for ListSnapshotBlocks Source: https://docs.aws.amazon.com/ebs/latest/userguide/readsnapshots.md This is an example response from the ListSnapshotBlocks API, showing block indexes, block tokens, expiry time, volume size, and block size. ```json { "Blocks": [ { "BlockIndex": 1001, "BlockToken": "AAABAV3/PNhXOynVdMYHUpPsetaSvjLB1dtIGfbJv5OJ0sX855EzGTWos4a4" }, { "BlockIndex": 1002, "BlockToken": "AAABATGQIgwr0WwIuqIMjCA/Sy7e/YoQFZsHejzGNvjKauzNgzeI13YHBfQB" }, { "BlockIndex": 1007, "BlockToken": "AAABAZ9CTuQtUvp/dXqRWw4d07eOgTZ3jvn6hiW30W9duM8MiMw6yQayzF2c" }, { "BlockIndex": 1012, "BlockToken": "AAABAQdzxhw0rVV6PNmsfo/YRIxo9JPR85XxPf1BLjg0Hec6pygYr6laE1p0" }, { "BlockIndex": 1030, "BlockToken": "AAABAaYvPax6mv+iGWLdTUjQtFWouQ7Dqz6nSD9L+CbXnvpkswA6iDID523d" }, { "BlockIndex": 1031, "BlockToken": "AAABATgWZC0XcFwUKvTJbUXMiSPg59KVxJGL+BWBClkw6spzCxJVqDVaTskJ" }, ... ], "ExpiryTime": 1576287332.806, "VolumeSize": 32212254720, "BlockSize": 524288 } ``` ```json HTTP/1.1 200 OK x-amzn-RequestId: d6e5017c-70a8-4539-8830-57f5557f3f27 Content-Type: application/json Content-Length: 2472 Date: Wed, 17 Jun 2020 23:19:56 GMT Connection: keep-alive { "BlockSize": 524288, "Blocks": [ { "BlockIndex": 0, "BlockToken": "AAUBAcuWqOCnDNuKle11s7IIX6jp6FYcC/q8oT93913HhvLvA+3JRrSybp/0" }, { "BlockIndex": 1536, "BlockToken": "AAUBAWudwfmofcrQhGVlLwuRKm2b8ZXPiyrgoykTRC6IU1NbxKWDY1pPjvnV" }, { "BlockIndex": 3072, "BlockToken": "AAUBAV7p6pC5fKAC7TokoNCtAnZhqq27u6YEXZ3MwRevBkDjmMx6iuA6tsBt" }, { "BlockIndex": 3073, "BlockToken": "AAUBAbqt9zpqBUEvtO2HINAfFaWToOwlPjbIsQOlx6JUN/0+iMQl0NtNbnX4" }, ... ], "ExpiryTime": 1.59298379649E9, "VolumeSize": 3 } ``` -------------------------------- ### Start a snapshot using AWS CLI Source: https://docs.aws.amazon.com/ebs/latest/userguide/writesnapshots.md Starts an incremental EBS snapshot using the AWS CLI. The snapshot will be created with a specified volume size and parent snapshot. A client token is used for idempotency. The snapshot is initially in a 'pending' state. ```APIDOC ## start-snapshot ### Description Starts an EBS snapshot, optionally as an incremental snapshot of a parent snapshot. The snapshot will enter a 'pending' state and requires subsequent `put-snapshot-block` and `complete-snapshot` operations within a timeout period. ### Method aws ebs start-snapshot ### Parameters - `--volume-size` (integer) - Required - The size of the volume in GiB. - `--parent-snapshot` (string) - Optional - The ID of the parent snapshot for incremental creation. - `--timeout` (integer) - Optional - The timeout period in minutes before the snapshot enters an error state. - `--client-token` (string) - Optional - A unique identifier to ensure request idempotency. ### Request Example ```bash aws ebs start-snapshot --volume-size 8 --parent-snapshot snap-123EXAMPLE1234567 --timeout 60 --client-token 550e8400-e29b-41d4-a716-446655440000 ``` ### Response Example ```json { "SnapshotId": "snap-0aaEXAMPLEe306d62", "OwnerId": "111122223333", "Status": "pending", "VolumeSize": 8, "BlockSize": 524288 } ``` ``` -------------------------------- ### View Block Public Access Setting (AWS PowerShell) - Example Output Source: https://docs.aws.amazon.com/ebs/latest/userguide/block-public-access-snapshots-view.md Example output from the `Get-EC2SnapshotBlockPublicAccessState` cmdlet, showing the block public access state for EBS snapshots in a region. ```text Value ----- block-new-sharing ``` -------------------------------- ### Example output for listing snapshots in Recycle Bin Source: https://docs.aws.amazon.com/ebs/latest/userguide/recycle-bin-working-with-snaps.md This JSON output shows the details of a snapshot that has been moved to the Recycle Bin. ```json { "SnapshotRecycleBinInfo": [ { "Description": "Monthly data backup snapshot", "RecycleBinEnterTime": "2021-12-01T13:00:00.000Z", "RecycleBinExitTime": "2021-12-15T13:00:00.000Z", "VolumeId": "vol-abcdef09876543210", "SnapshotId": "snap-01234567890abcdef" } ] } ``` -------------------------------- ### Get Power Scheme GUID (Windows) Source: https://docs.aws.amazon.com/ebs/latest/userguide/benchmark_procedures.md Retrieves the GUID for the 'High performance' power scheme on a Windows instance. ```powershell (Get-WmiObject -class Win32_PowerPlan -Namespace "root\cimv2\power" -Filter "ElementName='High performance'").InstanceID ``` -------------------------------- ### Get Power Setting Subgroup GUID (Windows) Source: https://docs.aws.amazon.com/ebs/latest/userguide/benchmark_procedures.md Retrieves the GUID for the 'Processor power management' subgroup on a Windows instance. ```powershell (Get-WmiObject -class Win32_PowerSettingSubgroup -Namespace "root\cimv2\power" -Filter "ElementName='Processor power management'").InstanceID ``` -------------------------------- ### Get Power Setting GUID (Windows) Source: https://docs.aws.amazon.com/ebs/latest/userguide/benchmark_procedures.md Retrieves the GUID for the 'Processor idle disable' power setting on a Windows instance. ```powershell (Get-WmiObject -class Win32_PowerSetting -Namespace "root\cimv2\power" -Filter "ElementName='Processor idle disable'").InstanceID ``` -------------------------------- ### Get Snapshot Block Data using AWS CLI Source: https://docs.aws.amazon.com/ebs/latest/userguide/readsnapshots.md This snippet shows how to use the AWS CLI to get data for a specific block index and token from an EBS snapshot. It also includes an example of the expected response. ```APIDOC ## Get Snapshot Block Data using AWS CLI ### Description This command retrieves data for a specific block index and token from an EBS snapshot. The binary data is output to a specified file. ### Command ```bash aws ebs get-snapshot-block --snapshot-id {{snap-1234567890}} --block-index {{6001}} --block-token {{AAABASBpSJ2UAD3PLxJnCt6zun4/T4sU25Bnb8jB5Q6FRXHFqAIAqE04hJoR}} {{C:/Temp/data}} ``` ### Response Example ```json { "DataLength": "524288", "Checksum": "cf0Y6/Fn0oFa4VyjQPOa/iD0zhTflPTKzxGv2OKowXc=", "ChecksumAlgorithm": "SHA256" } ``` ``` -------------------------------- ### Get Recycle Bin Rule Details Source: https://docs.aws.amazon.com/ebs/latest/userguide/recycle-bin-ct.md Example of a GetRule API call to retrieve details for a specific Recycle Bin rule. The rule identifier is required. ```json { "eventVersion": "1.08", "userIdentity": { "type": "AssumedRole", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:root", "accountId": "123456789012", "accessKeyId": "AKIAIOSFODNN7EXAMPLE", "sessionContext": { "sessionIssuer": { "type": "Role", "principalId": "123456789012", "arn": "arn:aws:iam::123456789012:role/Admin", "accountId": "123456789012", "userName": "Admin" }, "webIdFederationData": {}, "attributes": { "mfaAuthenticated": "false", "creationDate": "2021-08-02T21:43:38Z" } } }, "eventTime": "2021-08-02T21:45:33Z", "eventSource": "rbin.amazonaws.com", "eventName": "GetRule", "awsRegion": "us-west-2", "sourceIPAddress": "123.123.123.123", "userAgent": "aws-cli/1.20.9 Python/3.6.14 Linux/4.9.230-0.1.ac.224.84.332.metal1.x86_64 botocore/1.21.9", "requestParameters": { "identifier": "jkrnexample" }, "responseElements": null, "requestID": "ex0577a5-amc4-pl4f-ef51-50fdexample", "eventID": "714fafex-2eam-42pl-913e-926d4example", "readOnly": true, "eventType": "AwsApiCall", "managementEvent": true, "eventCategory": "Management", "recipientAccountId": "123456789012", "tlsDetails": { "tlsVersion": "TLSv1.2", "cipherSuite": "ECDHE-RSA-AES128-GCM-SHA256", "clientProvidedHostHeader": "rbin.us-west-2.amazonaws.com" } } ``` -------------------------------- ### Example Calculation for 128 GiB Snapshot Source: https://docs.aws.amazon.com/ebs/latest/userguide/volume-creation-credits.md Demonstrates the calculation of fill rate and maximum credit bucket size for a snapshot of 128 GiB. Shows how credits accumulate over time to allow for initialized volume creation. ```text MIN (10, (1024 ÷ {{128}})) = MIN (10, 8) = 8 credits per hour = 0.1333 credits per minute ``` ```text MAX (1, MIN (10, (1024 ÷ {{128}}))) = MAX (1, MIN (10, 8)) = MAX (1, 8) = 8 credits ``` -------------------------------- ### Initialize Volume with dd (using /dev/null) Source: https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.md Use this command to read all blocks on the specified device and send the output to the /dev/null virtual device, safely initializing your volume. This is for newer versions of dd for Windows that support /dev/null. ```bash dd if=\\.\\PHYSICALDRIVE{{n}} of=/dev/null bs=1M --progress --size ``` -------------------------------- ### Get EBS Volume Modifications (PowerShell) Source: https://docs.aws.amazon.com/ebs/latest/userguide/monitoring-volume-modifications.md Use the Get-EC2VolumeModification cmdlet to retrieve information about EBS volume modifications. This example retrieves modifications for two specified volumes. ```powershell Get-EC2VolumeModification ` -VolumeId {{vol-11111111111111111}} {{vol-22222222222222222}} ``` -------------------------------- ### Initialize Volume with fio Source: https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.md Run this command using the fio utility to initialize a volume. This command reads the specified device with a block size of 1M and an IO depth of 32, ensuring the volume is ready for use. ```bash fio --filename=\\.\\PHYSICALDRIVE{{n}} --rw=read --bs=1M --iodepth=32 --direct=1 --name=volume-initialize ``` -------------------------------- ### Running Fio Benchmark Source: https://docs.aws.amazon.com/ebs/latest/userguide/benchmark_procedures.md Execute the fio benchmark using the specified configuration file. This command requires root privileges. ```bash $ sudo fio fio_rw_mix.cfg ``` -------------------------------- ### Example Amazon EBS VPC Endpoint Policy Source: https://docs.aws.amazon.com/ebs/latest/userguide/dlm-vpc-endpoints.md This policy grants all users permission to get summary information about Amazon Data Lifecycle Manager policies when attached to an endpoint. ```json { "Statement": [{ "Action": "dlm:GetLifecyclePolicies", "Effect": "Allow", "Principal": "*", "Resource": "*" }] } ``` -------------------------------- ### AWS API Request to Get Snapshot Block Source: https://docs.aws.amazon.com/ebs/latest/userguide/readsnapshots.md This example shows the HTTP request format for retrieving data from a specific block within an EBS snapshot using the AWS API. ```http GET /snapshots/{{snap-0c9EXAMPLE1b30e2f}}/blocks/{{3072}}?blockToken={{AAUBARGCaufCqBRZC8tEkPYGGkSv3vqvOjJ2xKDi3ljDFiytUxBLXYgTmkid}} HTTP/1.1 Host: ebs.us-east-2.amazonaws.com Accept-Encoding: identity User-Agent: {{}} X-Amz-Date: 20200617T232838Z Authorization: {{}} ``` -------------------------------- ### AWS API Response for Get Snapshot Block Source: https://docs.aws.amazon.com/ebs/latest/userguide/readsnapshots.md This is an example of a successful HTTP response when retrieving block data via the AWS API, including metadata like data length and checksum. ```http HTTP/1.1 200 OK x-amzn-RequestId: 2d0db2fb-bd88-474d-a137-81c4e57d7b9f x-amz-Data-Length: 524288 x-amz-Checksum: Vc0yY2j3qg8bUL9I6GQuI2orTudrQRBDMIhcy7bdEsw= x-amz-Checksum-Algorithm: SHA256 Content-Type: application/octet-stream Content-Length: 524288 Date: Wed, 17 Jun 2020 23:28:38 GMT Connection: keep-alive {{BlockData}} ``` -------------------------------- ### Initialize Volume with dd (using nul) Source: https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.md Use this command if you are using an older version of dd for Windows that does not support the /dev/null device. It initializes the volume by reading all blocks and sending output to the nul device. ```bash dd if=\\.\\PHYSICALDRIVE{{n}} of=nul bs=1M --progress --size ``` -------------------------------- ### EBS Create Snapshot Event Example Source: https://docs.aws.amazon.com/ebs/latest/userguide/ebs-cloud-watch-events.md This JSON structure represents a successful EBS snapshot creation event. It includes details about the snapshot, source volume, and the start and end times of the creation process. ```json { "version": "0", "id": "{{01234567}}-{{0123}}-{{0123}}-{{0123}}-{{012345678901}}", "detail-type": "EBS Snapshot Notification", "source": "aws.ec2", "account": "{{012345678901}}", "time": "{{yyyy}}-{{mm}}-{{dd}}T{{hh}}:{{mm}}:{{ss}}Z", "region": "{{us-east-1}}", "resources": [ "arn:aws:ec2::{{us-west-2}}:snapshot/snap-{{01234567}}" ], "detail": { "event": "createSnapshot", "result": "succeeded", "cause": "", "request-id": "", "snapshot_id": "arn:aws:ec2::{{us-west-2}}:snapshot/snap-{{01234567}}", "source": "arn:aws:ec2::{{us-west-2}}:volume/vol-{{01234567}}", "startTime": "{{yyyy}}-{{mm}}-{{dd}}T{{hh}}:{{mm}}:{{ss}}Z", "endTime": "{{yyyy}}-{{mm}}-{{dd}}T{{hh}}:{{mm}}:{{ss}}Z" } } ``` -------------------------------- ### Get Snapshot Block Data using AWS API Source: https://docs.aws.amazon.com/ebs/latest/userguide/readsnapshots.md This snippet demonstrates how to use the AWS API to request data for a specific block index and token from an EBS snapshot. It includes example request and response. ```APIDOC ## Get Snapshot Block Data using AWS API ### Description This API request retrieves data for a specific block index and token from an EBS snapshot. The binary data is transmitted in the body of the response. ### Method GET ### Endpoint /snapshots/{{snap-0c9EXAMPLE1b30e2f}}/blocks/{{3072}}?blockToken={{AAUBARGCaufCqBRZC8tEkPYGGkSv3vqvOjJ2xKDi3ljDFiytUxBLXYgTmkid}} ### Request Example ```http GET /snapshots/{{snap-0c9EXAMPLE1b30e2f}}/blocks/{{3072}}?blockToken={{AAUBARGCaufCqBRZC8tEkPYGGkSv3vqvOjJ2xKDi3ljDFiytUxBLXYgTmkid}} HTTP/1.1 Host: ebs.us-east-2.amazonaws.com Accept-Encoding: identity User-Agent: {{}} X-Amz-Date: 20200617T232838Z Authorization: {{}} ``` ### Response Example ```http HTTP/1.1 200 OK x-amzn-RequestId: 2d0db2fb-bd88-474d-a137-81c4e57d7b9f x-amz-Data-Length: 524288 x-amz-Checksum: Vc0yY2j3qg8bUL9I6GQuI2orTudrQRBDMIhcy7bdEsw= x-amz-Checksum-Algorithm: SHA256 Content-Type: application/octet-stream Content-Length: 524288 Date: Wed, 17 Jun 2020 23:28:38 GMT Connection: keep-alive {{BlockData}} ``` ``` -------------------------------- ### Initialize EBS Volume with fio on Linux Source: https://docs.aws.amazon.com/ebs/latest/userguide/initalize-volume.md Utilize the fio utility for faster, multi-threaded reads to initialize a Linux EBS volume. Specify the device with --filename, set read parameters, and use direct I/O for performance. ```bash $ sudo fio --filename=/dev/{{xvdf}} --rw=read --bs=1M --iodepth=32 --ioengine=libaio --direct=1 --name=volume-initialize ``` -------------------------------- ### Backup /etc/fstab file Source: https://docs.aws.amazon.com/ebs/latest/userguide/ebs-using-volumes.md Before editing, create a backup of your /etc/fstab file to prevent potential boot issues. ```bash [ec2-user ~]$ sudo cp /etc/fstab /etc/fstab.orig ``` -------------------------------- ### Display file system usage (Xen instance) Source: https://docs.aws.amazon.com/ebs/latest/userguide/recognize-expanded-volume-linux.md Check file system usage, types, and mount points for Xen instances. This helps identify the file system to extend. ```bash [ec2-user ~]$ df -hT Filesystem Type Size Used Avail Use% Mounted on /dev/xvda1 ext4 8.0G 1.9G 6.2G 24% / /dev/xvdf1 xfs 24.0G 45M 8.0G 1% /data ... ``` -------------------------------- ### List block devices on Xen instance Source: https://docs.aws.amazon.com/ebs/latest/userguide/recognize-expanded-volume-linux.md Use `lsblk` to view the block device structure on Xen-based instances. This helps identify partitions and their sizes. ```bash [ec2-user ~]$ sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 16G 0 disk └─xvda1 202:1 0 8G 0 part / xvdf 202:80 0 24G 0 disk ``` -------------------------------- ### AWS CLI: Example Output for Restore Period Modification Source: https://docs.aws.amazon.com/ebs/latest/userguide/modify-temp-restore-period.md This is an example of the JSON output received after modifying the restore period for a snapshot. ```json { "SnapshotId": "snap-0abcdef1234567890", "RestoreDuration": 10, "IsPermanentRestore": false } ``` -------------------------------- ### List block devices (Xen instance) Source: https://docs.aws.amazon.com/ebs/latest/userguide/recognize-expanded-volume-linux.md View the block device configuration for Xen instances to identify volume and partition sizes. ```bash [ec2-user ~]$ sudo lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvda 202:0 0 16G 0 disk └─xvda1 202:1 0 16G 0 part / xvdf 202:80 0 24G 0 disk ``` -------------------------------- ### Create Default EBS Snapshot Policy (CLI - Method 1) Source: https://docs.aws.amazon.com/ebs/latest/userguide/default-policies.md Use this command to create a default EBS snapshot policy with direct parameter specification. Configure state, description, execution role, intervals, tag copying, deletion extension, cross-region copies, and exclusions. ```bash aws dlm create-lifecycle-policy \ --state {{ENABLED | DISABLED}} \ --description "{{policy_description}}" \ --execution-role-arn {{role_arn}} \ --default-policy VOLUME \ --create-interval {{creation_frequency_in_days (1-7)}} \ --retain-interval {{retention_period_in_days (2-14)}} \ {{--copy-tags | --no-copy-tags}} \ {{--extend-deletion | --no-extend-deletion}} \ --cross-region-copy-targets TargetRegion={{destination_region_code}} \ --exclusions ExcludeBootVolumes={{true | false}}, ExcludeTags=[{Key={{tag_key}},Value={{tag_value}}}], ExcludeVolumeTypes="{{standard | gp2 | gp3 | io1 | io2 | st1 | sc1}}" ``` ```bash aws dlm create-lifecycle-policy \ --state ENABLED \ --description "Daily default snapshot policy" \ --execution-role-arn arn:aws:iam::{{account_id}}:role/AWSDataLifecycleManagerDefaultRole \ --default-policy VOLUME ``` -------------------------------- ### Create Mount Point Directory Source: https://docs.aws.amazon.com/ebs/latest/userguide/ebs-using-volumes.md Use the `mkdir` command to create a directory that will serve as the mount point for your EBS volume. ```bash [ec2-user ~]$ sudo mkdir {{/data}} ``` -------------------------------- ### Create Basic AMI Lifecycle Policy Source: https://docs.aws.amazon.com/ebs/latest/userguide/ami-policy.md Use this command to create a basic AMI lifecycle policy. Ensure the policyDetails.json file is correctly formatted. ```bash aws dlm create-lifecycle-policy \ --description "{{My AMI policy}}" \ --state ENABLED \ --execution-role-arn arn:aws:iam::{{12345678910}}:role/{{AWSDataLifecycleManagerDefaultRoleForAMIManagement}} \ --policy-details file://{{policyDetails.json}} ``` ```json { "PolicyType": "IMAGE_MANAGEMENT", "ResourceTypes": [ "INSTANCE" ], "TargetTags": [{ "Key": "purpose", "Value": "production" }], "Schedules": [{ "Name": "DailyAMIs", "TagsToAdd": [{ "Key": "type", "Value": "myDailyAMI" }], "CreateRule": { "Interval": 24, "IntervalUnit": "HOURS", "Times": [ "01:00" ] }, RetainRule":{ "Interval" : 2, "IntervalUnit" : "DAYS" }, DeprecateRule": { "Interval" : 1, "IntervalUnit" : "DAYS" }, "CopyTags": true } ], "Parameters" : { "NoReboot":true } } ``` -------------------------------- ### Example CloudTrail Log Entry for CreateLifecyclePolicy Source: https://docs.aws.amazon.com/ebs/latest/userguide/logging-using-cloudtrail.md This is an example of a CloudTrail log entry for the CreateLifecyclePolicy action. It shows the structure of the event data captured by CloudTrail. ```json { "eventVersion": "1.05", ``` -------------------------------- ### List Block Devices (Linux) Source: https://docs.aws.amazon.com/ebs/latest/userguide/identify-nvme-ebs-device.md The `lsblk` command displays all available block devices and their mount points. Use this to identify which NVMe devices are attached and whether they are mounted, helping to determine the correct device name. ```bash [ec2-user ~]$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT nvme1n1 259:3 0 100G 0 disk nvme0n1 259:0 0 8G 0 disk nvme0n1p1 259:1 0 8G 0 part / nvme0n1p128 259:2 0 1M 0 part ```