Profile Applicability:
- Level 2
Description:
Exporting cache data to Amazon S3 is an important practice for archiving, sharing, and processing data from services that utilize caching, such as Amazon ElastiCache, for Redis or Memcached. Properly exporting cache to S3 ensures that important data stored in cache is backed up, retained, and available for recovery or further processing.
Rationale:
Exporting cache data to S3 ensures:
Data persistence beyond the lifetime of cache instances
Backup and recovery options in case of cache failure
Easy access to exported cache data for analytical purposes
Cost-effective and scalable data storage using S3
Default Value:
By default, cache services such as ElastiCache do not automatically export data to S3. Export must be manually configured via the console or CLI.
Impact:
Pros:
• Ensures that cached data is safely backed up in S3
• Supports data analytics and further processing of cached data
• Reduces the risk of data loss in case of cache failure or eviction
Cons:
• Requires manual configuration and monitoring
• May incur additional costs for S3 storage and data transfer
• Export frequency may need to be managed to avoid performance impact on the cache service
Pre-requisites:
IAM Permissions Required:
s3:PutObject, s3:GetObject, s3:ListBucket
elasticache:ExportCacheToS3
Permissions for accessing both the cache and S3 bucket are required
Remediation:
Test Plan:
Using AWS Console:
• Log in to the AWS Management Console
• Navigate to Amazon ElastiCache
• Select the Cluster or Replication Group you want to export data from
• Under the Actions menu, select Export Data to S3
• Configure export settings, including the destination S3 bucket and data format
• Confirm the export process and monitor for completion in the console
• Ensure that the data appears in the specified S3 bucket
Using AWS CLI:
aws elasticache describe-replication-groups \ --replication-group-id <replication-group-id> aws elasticache export-cache-to-s3 \ --cache-cluster-id <cache-cluster-id> \ --s3-bucket-name <bucket-name> \ --s3-key-prefix <prefix> \ --export-name <export-name>
Implementation Plan:
Using AWS Console:
• Navigate to Amazon ElastiCache > Clusters
• Select the cluster or replication group you want to export from
• Under Actions, click on Export Data to S3
• Specify the S3 bucket, prefix, and export settings
• Monitor the progress of the export job
• Ensure that data is correctly stored in the target S3 bucket
Using AWS CLI:
Step 1: Export cache data to S3
aws elasticache export-cache-to-s3 \ --cache-cluster-id <cache-cluster-id> \ --s3-bucket-name <bucket-name> \ --s3-key-prefix <prefix> \ --export-name <export-name>
Step 2: Verify the exported data in the S3 bucket
aws s3 ls s3://<bucket-name>/<prefix>/
Backout Plan:
Using AWS Console:
• If export fails, verify the IAM permissions for both ElastiCache and S3
• Check if the S3 bucket has proper access control policies
• Retry the export with adjusted settings if necessary
• Alternatively, manually back up the cache data or adjust export settings
Using AWS CLI:
aws elasticache cancel-export-task \ --export-task-id <export-task-id> aws s3 rm s3://<bucket-name>/<prefix> --recursive