A global news website serves static web assets (images, CSS, JS files) stored in an Amazon S3 bucket, and dynamic personalized articles generated by an API running on Amazon EC2 instances in private subnets behind an Application Load Balancer (ALB). The API retrieves article content from an Amazon RDS database. During breaking news events, the website experiences significant latency, and both the ALB and the S3 bucket are overloaded by traffic spikes. Additionally, the application generates transient log files that must be stored in Amazon S3 for exactly 7 days before deletion. Which TWO solutions should a solutions architect implement to optimize content delivery performance and minimize operational costs?
- Configure an Amazon CloudFront distribution with the ALB as the origin for dynamic content paths and the S3 bucket as the origin for static content paths. Enable caching on the static behaviors to offload requests from the S3 bucket.Cevap
- Deploy Amazon ElastiCache in front of the Amazon RDS database to cache frequently requested article data in memory, reducing load on the database and decreasing API response times.Cevap
- CConfigure an Amazon CloudFront distribution with all cache behaviors pointing to the ALB and S3 origins, and set the Default TTL, Minimum TTL, and Maximum TTL to 0 seconds to guarantee that users always receive the most recent static updates directly from the origins.
- DStore the transient API log files in the Amazon S3 Standard-Infrequent Access (S3 Standard-IA) storage class, and define an S3 Lifecycle policy to permanently delete the objects after 7 days to minimize storage costs.
- ERoute all internal data transfers between the EC2 instances in the private subnets and the S3 bucket through a NAT Gateway, and configure a CloudFront distribution with the NAT Gateway's public IP as an origin to accelerate internal traffic.
Cevap
Configure an Amazon CloudFront distribution with the ALB as the origin for dynamic content paths and the Amazon S3 bucket as the origin for static content paths, caching only the static assets. Simultaneously, deploy Amazon ElastiCache in front of the database to cache frequently accessed dynamic query results.
Configuring Amazon CloudFront with separate behaviors ensures that static content is cached close to users, reducing latency and offloading the S3 bucket. Dynamic routes are passed through directly to the Application Load Balancer to guarantee personalization. At the database tier, Amazon ElastiCache caches recurrent query results in memory, drastically reducing the load on the RDS instance and accelerating the overall API response time.
Adım Adım Çözüm
Anahtar Kavram
Multi-tier caching using Amazon CloudFront and Amazon ElastiCache, alongside cost-optimization strategies for short-term storage and internal network routing.