AWS Storage Blog
Effectively track AWS data transfer costs for cross-region Amazon EBS Snapshot Copy
To safeguard data against natural disasters and ransomware attacks, many AWS users opt to protect their data by creating snapshots and replicating them to different AWS Regions. It is crucial for these users to monitor snapshots and associated data transfers for inter-regional costs, allowing them to provide accurate chargebacks to both internal and external stakeholders.
Users use Amazon Elastic Block Store Snapshots (EBS Snapshots) to create point-in-time backups of their data and copy these snapshots to store them in alternative AWS Regions. To enable the accurate tracking of AWS data transfer costs for snapshot copy to remote AWS Regions, you can apply tags during snapshot copy operations to the AWS transfer cost associated with that snapshot.
This post walks through how to leverage EBS Snapshot tags to track the costs of copying snapshots across AWS Regions. You learn the step-by-step process to activate snapshot tags for cost allocation purposes in the AWS Billing and Cost Management console, apply custom tags during snapshot copy operations, and view the tagged usage data in AWS Cost Explorer for analysis. By properly tagging snapshots, the post explains how you can gain insight into snapshot data transfer expenses for cost optimization, reporting, and chargeback.
Solution overview
Applying tags to snapshots helps accurately allocate storage costs. When copying EBS Snapshots to a remote AWS Region, you can add cost allocation tags to the copied snapshots. These tags consist of a key-value pair and are automatically applied to the AWS Data Transfer cost incurred by the snapshot copy operation in a cross-Region. You can view the AWS Data Transfer cost of the snapshot copy operation in the AWS Cost and Usage Report (AWS CUR) and AWS Cost Explorer. This makes it easy to track expenses for moving snapshots between AWS Regions.
To track AWS Data Transfer for snapshot copy to remote AWS Regions, you can start by defining a tagging strategy for your organization. This includes establishing naming conventions, defining tag keys and values, and documenting your tagging policies.
This post emphasizes the tagging process for snapshot copies in different AWS Regions. To learn how to tag snapshots, refer to the Tag Amazon EBS Snapshots on Creation and Implement Stronger Security Policies post.
Prerequisites
Using AWS Identity and Access Management (IAM), you must have an AWS account with sufficient permissions to access EBS Snapshots to create a copy for a remote AWS Region. Additionally, to run API actions, you must have access to a terminal window that has AWS Command Line Interface (AWS CLI) installed and configured. To view Cost Explorer you should have proper permissions, so make sure to refer to the documentation on Granting access to billing.
Walkthrough
To implement the solution, you need to go through the following steps:
1. Enable cost allocation for the tag you created for the existing snapshot
2. Apply tags during copy snapshot process
3. Track snapshot data transfer costs in the Cost Explorer
Step 1: Enable cost allocation for the tag you created for the existing snapshot
1. Open the AWS Organizations console or the AWS Billing and Cost Management console, and then select Cost Allocation Tags.
2. Search for the tag in the User-defined cost allocation tags search box.
3. Check the box for Tag and select Activate.
4. Select Activate in the confirmation window.
5. Once the tag is activated, the status should change to “Active”.
After you create and apply user-defined tags to your resources, it can take up to 24 hours for the tag keys to appear on your cost allocation tags page for activation. Once activated, all tags can take up to 24 hours to appear in the Billing and Cost Management console and CUR.
Step 2: Apply tags during copy snapshot process
You can create a copy of the source snapshot with the same tag as the source snapshot or a different tag value.
To tag a snapshot copy in a different AWS Region, you can use any of the following methods:
– Method 1: Apply tags during copy snapshot for each individual snapshot using the AWS Management Console
– Method 2: Apply tags during copy snapshot for each individual snapshot using AWS CLI
– Method 3: Use the Amazon Data Lifecycle Manager policies for any snapshot using AWS CLI or the Console
Method 1: Apply tags during copy snapshot for each individual snapshot using AWS console
1. Open the Amazon Elastic Compute Cloud (Amazon EC2) console.
2. In the navigation pane, choose Snapshots, and select the snapshot to copy in the remote Region.
3. Choose Actions, and then select Copy Snapshot.
4. (Optional) For Description, enter a brief description for the snapshot.
5. Select the destination Region to copy snapshot.
6. (Optional) Check Encrypt this snapshot.
7. To assign tags to the snapshot in the destination region, enter the key-value pair in the Tags section. This tag is assigned to the AWS Data Transfer cost related to this snapshot copy operation. Choose Copy snapshot.
Method 2: Apply tags during copy snapshot for each individual snapshot using AWS CLI
You can input command to copy snapshot using AWS CLI:
aws ec2 copy-snapshot --source-region <source-snapshot-region> --source-snapshot-id <source snapshot-id> --destination-region <target-snapshot-region> --region <target-snapshot-region> --description "<desitnation-snapshot-description>" --tag-specifications 'ResourceType=snapshot,Tags=[{Key=<Key>,Value=<value> }]'
For example:
aws ec2 copy-snapshot --source-region us-east-1 --source-snapshot-id snap-xxxxxxxxxxxx55a2 --destination-region us-west-2 --region us-west-2 --description "copy of snap-xxxxxxxxxxxx55a2" --tag-specifications 'ResourceType=snapshot,Tags=[{Key=environment,Value=prod}]'
Make sure that you use the key that has been activated in the cost allocation tag to view the snapshot data transfer cost associated with the assigned key/value pair. In the previous example, “environment” serves as the key.
Method 3: Use the Amazon Data Lifecycle Manager policies for any snapshot using AWS CLI or the Console.
Follow the steps in the Automate snapshot lifecycles documentation to create a snapshot lifecycle policy.
Step 3: Track snapshot data transfer cost in AWS Cost Explorer
The AWS feature for tracking AWS Data Transfer costs for snapshots copy to remote AWS Regions using tags was implemented in September 2023. Tags applied before September 2023 do not retroactively backfill AWS Data Transfer cost tags for previous months’ snapshot copy in the Cost Explorer or CUR.
To check AWS Data Transfer cost related to snapshot copy to remote AWS Regions, you need to implement the following steps:
1. Sign in to the Console and open the AWS Cost Management console.
2. For Date Range, select the desired period (in the example one month is selected).
3. For Granularity, select a desired value (in the example Daily is selected).
4. For Dimension, select Usage Type.
5. For Service, select EC2 – Other.
6. For Usage Type Group, select the following groups:
-
- EC2: EBS – Snapshots
- EC2: Data Transfer – Region to Region (In)
- EC2: Data Transfer – Region to Region (Out)
7. For Tag, select the applicable tags used for the snapshot.
The following figure indicates the “USW2-USE1-AWS-Out-Byte” as the cost associated with transferring snapshot data from the us-west-2 to the us-east-1 Region.
A lot of users find the CUR helpful for accessing this information. If you’re new to CUR, then you can check out the guide for Creating Cost and Usage Reports. You can query the cost of snapshots and their data transfer to remote AWS Regions by looking for a specific tag in CUR, either through Amazon Athena queries or tools that your organization has developed around CUR. Using CUR gives users the flexibility to create their own dashboards. For additional details, you can refer to the Visualize and gain insights into your AWS cost and usage with Cloud Intelligence Dashboards and CUDOS using Amazon QuickSight blog post.
Note that data only shows up in Cost Explorer and CUR from the point in time that a tag is activated as a cost allocation tag and beyond. Tag data does not backfill for previous snapshot data transfers to remote AWS Regions prior to tag activation.
Cleaning up
AWS does not impose charges for using cost allocation tags. Nevertheless, when you undertake AWS snapshot cleanup to enhance cost efficiency and resource management, it’s advisable to also review and remove any associated tags from the cost allocation tags. This ensures accuracy, simplifies management, and aligns with organizational policies.
Conclusion
Companies with numerous users, such as Independent Software Vendors (ISVs), encounter challenges in accurately charging for services, particularly when dealing with data transfer costs for copying snapshots between AWS Regions. Existing solutions, such as labels or custom calculations, vary among companies and lack a universal fix. Some businesses may be unaware of potential financial losses due to these data transfer expenses. As technology evolves, finding a streamlined approach is vital to making sure of precise calculations.
Using tags for snapshot copy operations enables tags to appear for AWS Data Transfer costs related to snapshot copy. This empowers AWS users to make better-informed decisions about their snapshot copy-related AWS Data Transfer costs for accurate chargebacks. Start leveraging this solution today to enhance your cost-management practices and get the most out of your AWS resources.
Thank you for reading this post. If you have any comments or questions, please don’t hesitate to leave them in the comments section.