Skip to content

Instantly share code, notes, and snippets.

Here are the full URLs for the references mentioned:
1. Cisco SD-WAN Cloud Init Configuration:
https://www.cisco.com/c/en/us/td/docs/routers/sdwan/configuration/day-zero-and-bootstrap-configuration/CloudInit.html
2. Cisco SD-WAN Ports and Protocols:
https://www.cisco.com/c/en/us/td/docs/routers/sdwan/configuration/ports/ports.html
provider "aws" {
alias = "ap_southeast_2"
region = "ap-southeast-2"
}
provider "aws" {
alias = "ap_southeast_4"
region = "ap-southeast-4"
}
Let’s assume you’re monitoring the Route53 DNS query volume metric, which is commonly named DNSQueries, with dimensions like HostedZoneId. Below are detailed examples for each case:
1. Tweak Anomaly Detection Parameters
Adjust the Confidence Bound
Reduce false positives by widening the confidence interval from 99% (default) to 95%.
aws cloudwatch put-anomaly-detector \
--namespace "AWS/Route53" \
AWS Tiros is an internal service developed by Amazon Web Services (AWS) that utilizes automated reasoning to analyze and verify network configurations within AWS environments. It helps identify potential misconfigurations or security vulnerabilities by modeling network architectures and assessing reachability properties without sending actual network traffic. 
The Network Reachability Analyzer in AWS leverages Tiros to determine the connectivity between resources in a Virtual Private Cloud (VPC). To perform these analyses, the Reachability Analyzer requires permissions to invoke Tiros APIs, specifically to create and manage reachability queries. These permissions enable the Reachability Analyzer to access Tiros’s capabilities for assessing network paths and identifying connectivity issues. 
In summary, Tiros provides the foundational technology that the Network Reachability Analyzer uses to evaluate network configurations and ensure secure and reliable connectivity within AWS environments.
Here are some common algorithms and problem types you might encounter in a Level 1 Codility test, along with Python code samples and explanations.
1. Find Missing Integer (Simple Counting Problem)
Problem:
Given an array of integers, find the smallest positive integer that does not appear in the array.
Example:
Input: [1, 2, 3]
Good.
Now come to the routing in CloudWAN. The routing in describe in 2 directions implicitly. From each VPC, we need a route to all other VPCs.
- int to int do not go through fw
- anywhere to ext must go through ext fw
- anywhere to prot must go through prot fw
- prot can only be reached from int in the same environment.
- int and prot in NP can't communicate directly with int and prot in PROD can't communicate directly, they must go through ext.
- anywhere from NP to PROD must go through segr fw.
Below is an illustrative example of how you can structure and write the Terraform code for CloudWAN resources using modules. This is a sample layout and code—adjust names, variables, and values to fit your actual environment and CIDR blocks.
Note:
• The code below uses placeholder values. You will need to replace these with your actual values (VPC IDs, segment names, etc.).
• The CloudWAN functionality and resources used are based on current AWS provider capabilities (as of AWS provider v4.x).
• Policies and segment relationships must be defined carefully in the JSON documents. The policy code example is a starting point; you will need to customize it to reflect your routing rules.
• This code assumes you have already created VPCs and their subnets. The VPC attachments here will reference existing VPC IDs and subnets.
• The firewall code snippet is a placeholder to create a firewall VPC attachment and related resources. Actual firewall logic (like configuring AWS Network Firewall or third-party firewall
@huynhbaoan
huynhbaoan / ap
Last active December 19, 2024 08:18
import threading
class MusicPlayer:
def __init__(self, music_folder="~/home/audio-extracted/"):
pygame.mixer.init(44100, -16, 2, 2048)
self.music_folder = os.path.expanduser(music_folder)
self.current_track = None
self.playing = False
self.paused = False
self.playlist = []
Below is a comprehensive end-to-end example of how you might Resource Access Manager (RAM) share a CloudWAN core network from a prod account to a nonprod (NP) account. The example is organized into two folders—prod/ and np/—each containing minimal Terraform configurations. It illustrates:
1. Creating a CloudWAN core network in prod.
2. Creating a RAM resource share in prod.
3. Associating the nonprod account as a principal.
4. Sharing the CloudWAN core network with nonprod.
5. Referencing the shared CloudWAN in nonprod to create a VPC attachment.
Disclaimer: This is a simplified example for demonstration. You would adapt naming, variables, and references to suit your actual environment (e.g., separate files, modules, state management, encryption, etc.).
Folder Structure
Below is a sample (not production-ready) Terraform folder structure and code snippets to illustrate how AWS Network Firewall (firewall VPC) and CloudWAN segments/policy can be set up for service insertion. The example focuses on one scenario:
Anywhere → prot must go through prot fw, and vice-versa (symmetric).
• Same region:
NP MEL int --> NP MEL prot fw (service insertion) --> NP MEL prot
• Different region:
NP MEL int --> NP MEL prot fw (service insertion) --> NP SYD prot fw (service insertion) --> NP SYD prot
You can expand this pattern to the rest of your int/ext/prot/segr requirements, following the same logic.