# Guidance for Attachment Management to AWS Cloud WAN

## Overview

This Guidance demonstrates an automated, secure method for connecting a virtual private cloud (VPC) to AWS Cloud WAN. By streamlining VPC attachments to a core network, it facilitates proper configuration and compliance with network policies. In addition, it operates automatically within AWS systems, minimizing user intervention while preventing unauthorized changes. With this Guidance, users can manage VPC attachments, handle IP addressing conflicts, and control exceptions when needed. This approach helps AWS customers save time, reduce errors, and maintain a consistent, secure network architecture across their organization, while also providing flexibility for future enhancements.

## How it works

These technical details feature an architecture diagram to illustrate how to effectively use this solution. The architecture diagram shows the key components and their interactions, providing an overview of the architecture's structure and functionality step-by-step.

[Download the architecture diagram](https://d1.awsstatic.com/solutions/guidance/architecture-diagrams/attachment-management-to-aws-cloud-wan.pdf)

![Architecture diagram](/images/solutions/attachment-management-to-aws-cloud-wan/images/attachment-management-to-aws-cloud-wan-1.png)

1. **Step 1**: In a user account, a Spoke Amazon Virtual Private Cloud (Amazon VPC) is attached to a shared AWS Cloud WAN edge location. By default, the attachment is moved to a quarantine network segment.
1. **Step 2**: Once the Spoke Amazon VPC CIDR ranges are learned, a New route event (or topology change) is generated by AWS Network Manager. The event is processed by Amazon EventBridge, which sends it to the Event curation and SNS publish AWS Lambda function for curation.
1. **Step 3**: The Event curation and SNS publish Lambda function parses the event and publishes it to an Amazon Simple Notification Service (Amazon SNS) topic. It's published with enriched attributes, such as attachmentArn and attachmentId.
1. **Step 4**: An Amazon Simple Queue Service (Amazon SQS) deployed in another AWS Region has a queue subscribed to the Amazon SNS topic and filters events of interest based on their message attributes. A Dead Letter Queue (DLQ) is also configured for monitoring and troubleshooting.
1. **Step 5**: The Attachment Manager Lambda function reads events from the Amazon SQS queue to perform the attachment admission to the network.
1. **Step 6**: The Attachment Manager Lambda function assumes a role in the Management Account. This role is used to read the segment and account tags of the user account that created the Amazon VPC attachment to AWS Cloud WAN. A 'route-domain' tag will identify a network segment to which the User account belongs (such as production, testing, and development).
1. **Step 7**: This Guidance also provides an option to package the Plan for IP address provisioning of the global network in the Attachment Manager Lambda function. In that case, the New route event being advertised is also verified for adherence to the plan for IP address provisioning.
1. **Step 8**: If the evaluation logic is successful, the Attachment Manager Lambda function will tag the Spoke Amazon VPC attachment with the correct tag to ensure it is admitted to the correct AWS Cloud WAN network segment. Otherwise, the attachment will be deleted.
## Deploy with confidence

Everything you need to launch this Guidance in your account is right here.

- **Sample code**: Use sample code to deploy this Guidance in your AWS account

[Sample code](https://github.com/aws-solutions-library-samples/guidance-for-aws-cloud-wan-attachment-management)


## Well-Architected Pillars

The architecture diagram above is an example of a Solution created with Well-Architected best practices in mind. To be fully Well-Architected, you should follow as many Well-Architected best practices as possible.

### Operational Excellence

EventBridge filters network manager events and sends them to Amazon SNS. In different Regions, multiple Amazon SQS queues subscribe to Amazon SNS, receiving these events for processing by Lambda, which then performs the attachment configuration automatically based on metadata. For unexpected events, an Amazon SQS DLQ captures the malformed events to prevent data loss. This setup automates AWS Cloud WAN attachment management without user intervention, serving two purposes. One, it prevents cross-network domain leakage, and two, it removes the need for manual oversight, supporting efficient and secure management of complex network configurations. [Read the Operational Excellence whitepaper](/wellarchitected/latest/operational-excellence-pillar/welcome.html)


### Security

AWS Identity and Access Management (IAM) Roles for Lambda limit access to specific resources like Amazon SQS and Amazon SNS, enforcing the principle of least privilege. In addition, resource policies in Amazon SQS and Amazon SNS are narrowly defined, granting only the minimum permissions necessary for proper application functions. By implementing these security measures, organizations limit authorized access to the AWS Cloud WAN attachment configuration resources exclusively. This approach reduces the potential attack surface and minimizes the risk of unauthorized access or data breaches. [Read the Security whitepaper](/wellarchitected/latest/security-pillar/welcome.html)


### Reliability

To support reliable workloads, the Lambda functions for the AWS Cloud WAN attachment are deployed in at least two Regions. This multi-service, multi-Region approach creates a resilient system that can withstand various types of failures and continue operating smoothly. Furthermore, EventBridge routes events to Lambda for processing, while Amazon SQS and Amazon SNS provide a robust subscribing mechanism for Lambda as part of routing control. For event processing and routing control, Lambda offers a serverless framework deployed across two Regions to mitigate Regional failures. As managed services, EventBridge, Amazon SQS, and Amazon SNS significantly reduce the likelihood of failure, helping to ensure that all relevant events are processed without downtime. [Read the Reliability whitepaper](/wellarchitected/latest/reliability-pillar/welcome.html)


### Performance Efficiency

This Guidance uses a durable, subscription-based mechanism for handling events across at least two Regions. For example, EventBridge, Amazon SQS, Amazon SNS, and Lambda work together to process AWS control plane events in real-time, specifically for new routes learned in AWS Cloud WAN. This setup delivers near real-time performance for event processing. EventBridge initiates the process by capturing and routing events, while Amazon SQS and Amazon SNS work in tandem to help ensure reliable message delivery. Lambda functions, deployed across multiple Regions, process these events efficiently, minimizing delays in network configuration updates. By utilizing these services, the system achieves minimum latency for attaching network segments in AWS Cloud WAN. [Read the Performance Efficiency whitepaper](/wellarchitected/latest/performance-efficiency-pillar/welcome.html)


### Cost Optimization

When configured, this Guidance processes control plane events tied to network topology changes, which typically don't occur in high volumes daily. This event-driven approach conserves resources, as computing power is used only when needed for event processing. Consequently, the system avoids wasting resources on idle, long-running processes, leading to optimized costs and efficient resource utilization. Also, EventBridge, Amazon SQS, Amazon SNS, and Lambda process only specific AWS control plane events related to new routes in AWS Cloud WAN. These services activate solely when new events occur, eliminating the need for long-running processes. [Read the Cost Optimization whitepaper](/wellarchitected/latest/cost-optimization-pillar/welcome.html)


### Sustainability

EventBridge, Amazon SQS, Amazon SNS, and Lambda are fully managed AWS services that offer higher efficiency compared to traditional long-running or compute-intensive alternatives. By processing only specific AWS control plane events related to new routes in AWS Cloud WAN, the system minimizes unnecessary resource consumption. The near real-time, serverless event processing approach eliminates the need for constantly running compute resources, leading to a reduced environmental footprint as energy is consumed only when events require processing. [Read the Sustainability whitepaper](/wellarchitected/latest/sustainability-pillar/sustainability-pillar.html)


[Read usage guidelines](/solutions/guidance-disclaimers/)

