Managing Cross-Account Private Origins in AWS WAF Classic to WAF v2 Migration
A detailed guide for securing resources across multiple AWS accounts during WAF migration, covering IAM roles, cross-account associations, and centralized monitoring with practical code examples.
Anonymous User
Amazon Employee
Published May 15, 2025
When migrating from AWS WAF Classic to WAF v2, organizations with multi-account architectures face unique challenges. Protecting resources across different AWS accounts requires careful planning and execution to maintain security posture throughout the migration process. This article dives deep into the specific steps and considerations for handling private origins across AWS accounts during your WAF migration journey.
In a multi-account AWS environment, you typically have:
- Security Account: Houses your WAF configurations and centralized security controls
- Application Accounts: Contain your private origins (ALBs, API Gateways, CloudFront distributions)
This separation follows AWS best practices for security but adds complexity when migrating WAF configurations. Let's explore how to navigate this successfully.
Begin by documenting all cross-account relationships:
Create a detailed mapping of:
- Which WAF Classic Web ACLs protect resources in which accounts
- The IAM roles and permissions enabling these cross-account relationships
- Any custom integrations or automations that manage these relationships
WAF v2 supports cross-account resource protection, but the implementation differs from WAF Classic. Design your target architecture considering:
- Will you maintain the same security account structure?
- Do you need to adjust IAM permissions for the new WAF v2 APIs?
- How will you handle the transition period when both WAF versions are active?
In each application account, create a role that your security account can assume:
For more granular permissions, create a custom policy:
In your security account, create the WAF v2 Web ACLs that will protect resources across accounts:
Now, assume the role in the application account and associate the WAF v2 Web ACL:
For ALBs in different accounts:
1. Security Group Configuration:
2. Health Check Verification:
Ensure WAF v2 doesn't interfere with ALB health checks by testing thoroughly before full deployment.
For API Gateway resources:
For CloudFront distributions with origins in different accounts:
1. Origin Access Identity (OAI) Setup:
2. S3 Bucket Policy Update (if using S3 origins):
3. CloudFront WAF Association:
Confirm that your WAF v2 Web ACLs are correctly associated with resources across accounts:
Before enforcing blocking rules, use Count mode to validate behavior:
Set up centralized logging to monitor WAF behavior across accounts:
1. Create a Kinesis Firehose in Security Account:
2. Enable WAF Logging:
3. Create CloudWatch Dashboard:
Develop a dashboard that aggregates metrics from WAF across all accounts.
Before making changes, document the current state of all cross-account associations:
Prepare scripts that can quickly revert to WAF Classic if needed:
Validate your rollback procedure in a test environment before full deployment.
To streamline ongoing management, consider implementing automation:
Deploy a Lambda function in your security account that can manage WAF across accounts:
Use CloudFormation StackSets to deploy consistent IAM roles across all accounts:
For comprehensive visibility:
- Create a central logging account for all WAF logs
- Implement log aggregation using Kinesis Data Firehose
- Set up cross-account CloudWatch metrics using CloudWatch cross-account observability
For IP sets used across accounts:
Implement CI/CD pipelines that can update WAF rules across accounts:
- Store rule configurations in a version-controlled repository
- Use AWS CodePipeline to automate deployments
- Implement approval workflows for rule changes
Successfully migrating WAF Classic to WAF v2 in a cross-account environment requires careful planning, precise execution, and thorough testing. By following the steps outlined in this guide, you can maintain robust security controls throughout the migration process while taking advantage of the enhanced capabilities offered by WAF v2.
The cross-account architecture not only provides better security through separation of concerns but also enables centralized management of web application security across your entire AWS organization. With proper implementation of the IAM roles, testing procedures, and monitoring solutions described here, you can achieve a seamless migration while enhancing your security posture.
Have you implemented a cross-account WAF architecture? Share your experiences and insights in the comments below!
Any opinions in this post are those of the individual author and may not reflect the opinions of AWS.