• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 5 years ago
  • Updated about 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

peerd is an AWS VPC Peering Connection management tool. It creates full-meshes of VPCs from a yaml file, and manages the full lifecycle of creation, deletion and route table updates needed to make VPC peerings useful across accounts and regions. Contributions welcome.

peerd

peerd is an AWS VPC Peering Connection management tool. It creates full-meshes of VPCs peerings based on a simple yaml file, and manages the full lifecycle of creation, deletion and route table updates needed to make VPC peerings useful across accounts and regions. Contributions welcome.

 ./peerd.py --help
usage: peerd.py [-h] [--debug] --config CONFIG --environment ENVIRONMENT

AWS VPC Peering Management Tool

optional arguments:
  -h, --help            show this help message and exit
  --debug               Set log-level to DEBUG
  --config CONFIG, -c CONFIG
                        Path to configuration file
  --environment ENVIRONMENT, -e ENVIRONMENT
                        Only execute the script on this environment
  --dryrun, -d          Only check for peerings which might be created or deleted. No changes made to mesh.

Capabilities

  • Capable of creating and accepting cross-account VPC peerings.
  • Capable of creating and accepting cross-region VPC peerings.
  • Capable of creating full-meshes of VPC peerings.
  • Overlapping meshes supported through the use of different environment names in configuration file.
  • Injects, repairs and removes routes as needed from VPC routing tables.

Comment on other tools

Ansible, Terraform, Transit Gateway are valid approaches to creating networks between AWS VPCs. peerd attempts to solve the issue of managing complex overlapping meshes of VPC peerings between many accounts and regions, which can be difficult with other tools or result in large configuration modules/files.

Requirements

Route Tables

  • peerd will only manage routes in route tables with the tag peerd_eligible:true
  • Route tables must be tagged with Key: peerd_eligible Value: true

Authentication

peerd will assume a target IAM role with the same principal name in each account it needs to perform work in. The target IAM role must have EC2 route table, VPC and Peering read and write permissions.

Setup / Installation

# Install python 3.8 or higher if needed
brew install [email protected]

# Verify version
$ python3 --version
Python 3.8.1

# Verify python path (may be different if using brew)
$ which python3
/Library/Frameworks/Python.framework/Versions/3.8/bin/python3

# Create a virtual environment
mkvirtualenv peerd -p python3

# Activate virtual environment
workon peerd

# Install requirements
pip install -r requirements.txt

Configuration file

Metadata block

  • resource_owner: String. Used for tagging. Human or Machine owner of the peerings.
  • business_unit: String. Useed for tagging. Business unit owner of the peerings.
  • service_name: String. Used for tagging. Usually peerd
  • support: String. Used for tagging. Who to contact about this infrastructure e.g. email address.
  • common_principal_name: String. The common principal name used to assume a role in each target account.
  • role_session_name: String. Used to identify the assume-role session. Useful for Cloudtrails log filtering.

VPC blocks

  • myfirstenvironment: Used to deduplicate VPC peerings and allow overlaping meshes.
  • account_id: The account id where this VPC exists.
  • vpc_id: The VPC which will be part of the VPC peering mesh.
  • region: The AWS region where the VPC exists.
  • note: Freeform. Not used for anything.
  • cidr_overrides: Override the discovered CIDRs associated with this VPC when installing on remote sides of peerings. Useful if you only want to share a slice of a VPC CIDR range(s).
  • peering_tags: Any custom tags you wish peerd to apply to the VPC peering connections it creates.

Example

In the following example, VPCs across multiple regions and accounts will be peered together into a two overlapping meshes. Route tables in each VPC with tag peerd_eligible:true on said route tables will be updated. Unassumable account numbers, principals and non-existent VPCs will be skipped.

---
metadata:
  resource_owner: myname
  business_unit: PaaS
  service_name: peerd
  support: [email protected]
  common_principal_name: peerd-bot
  role_session_name: peerd
environments:
  myfirstenvironment:
    - account_id: '415433457294'
      vpc_id: vpc-bi37c2c47
      region: ap-southeast-2
      note: peerd test vpc1
      cidr_overrides:
        - 192.168.4.0/24
      peering_tags:
        my_custom_taga: '0'
    - account_id: '415433457294'
      vpc_id: vpc-vb787854
      region: ap-southeast-2
      note: peerd test vpc2
      cidr_overrides:
        - 10.53.101.32/27
        - 10.53.128.128/25
        - 192.168.2.0/24
        - 2.2.2.0/24
      peering_tags:
         my_custom_tagb: '1'
    - account_id: '415433457294'
      vpc_id: vpc-v52oby8v7
      region: ap-southeast-2
      note: peerd test vpc3
    - account_id: '415433457294'
      vpc_id: vpc-2378vby38vb348
      region: ap-southeast-1
      note: peerd test vpc4
    - account_id: '415433457294'
      vpc_id: vpc-8tv23o87yv4
      region: ap-southeast-1
      note: vpc does not exist, will be skipped
    - account_id: '123456789012'
      vpc_id: vpc-abc12345
      region: ap-southeast-2
      note: account does not exist, will be skipped
    - account_id: '4375823475902'
      vpc_id: vpc-7834bcri234bcr
      region: us-east-1
      note: peerd test vpc5
  myseecondenvironment:
    - account_id: '415433457294'
      vpc_id: vpc-2378vby38vb348
      region: ap-southeast-1
      note: peerd test vpc4
    - account_id: '4375823475902'
      vpc_id: vpc-23754cn5b38bc
      region: us-east-2
      note: peerd test vpc6

Running / Executing

./peerd.py --config ./config/config.yaml --environment myfirstenvironment

Deleting a peering

Simply remove the vpc block from the configuration file then re-run the tool.

Note: The tool does not keep state, but it is possible to remove multiple VPCs at a time. When run, the tool will go through all existing peerings that terminate in accounts in the config file, and will check if any of them peers with accounts not listed the config file. If it finds any, it will login to those accounts, and determine if there are additional peerings to delete.

For this reason, to completely delete an entire mesh, first remove all VPCs from the config file except one (the tool will need one to be able to determine all the peerings that have to be deleted). Once all peerings are deleted, you can safely remove the last one from the config file.

Thanks

Shane Anderson, Nicolas Meessen, Abdul Karim, James Flemming, Michael Gehrmann, Joshua Baldock, Haishan Du, Rui Meireles, Brock Campbell

License

Copyright (c) 2020 Atlassian and others. Apache 2.0 licensed, see LICENSE.txt file. USA Patent Pending 15/788,229.

More Repositories

1

compiled

A familiar and performant compile time CSS-in-JS library for React.
TypeScript
1,986
star
2

storybook-addon-performance

๐Ÿšง A storybook addon to help better understand and debug performance for React components.
TypeScript
634
star
3

react-resource-router

Configuration driven routing solution for React SPAs that managesย route matching, data fetching and progressive rendering
TypeScript
200
star
4

nadel

A GraphQL execution engine for distributed schemas
Kotlin
155
star
5

react-loosely-lazy

Use advanced React async components patterns today
TypeScript
124
star
6

json-schema-viewer

A JSON Schema Viewer for any JSON Schema on earth.
TypeScript
120
star
7

webpack-deduplication-plugin

Plugin for webpack that de-duplicates transitive dependencies in yarn and webpack-based projects.
JavaScript
76
star
8

Flowbius

Kotlin Flow <-> Spotify Mobius interop
Kotlin
57
star
9

atlassian-slack-integration-server

Slack plugins for Jira, Confluence and Bitbucket Server
Java
32
star
10

data-center-grafana-dashboards

22
star
11

cyclops

Cyclops Kubernetes Node Auto Cycling Toolset
Go
22
star
12

compass-examples

Example apps and code snippets for Atlassian Compass
Python
22
star
13

data-center-terraform

This project provides App vendors in Atlassian ecosystem with ready to use environment setup tool for Data Center products.
HCL
19
star
14

babel-plugin-storybook-csf-title

A Babel plugin to generate titles for Storybook CSF stories at compile time, typically based on the story file's file name.
JavaScript
17
star
15

connect-security-req-tester

A tool to check your Atlassian Connect app against Atlassian's security requirements.
Python
15
star
16

gitlab-for-compass

Compass integration with source code management tool GitLab.
TypeScript
14
star
17

Jira-DC-Grafana-Dashboards

12
star
18

issue-status-helper

An example Forge application for automatically managing Jira issue status
TypeScript
12
star
19

jira-release-blocker

Shell
10
star
20

bootgraph

Kotlin
9
star
21

db-replica

Automatically chooses between database connections to read-write main or read-only replica
Java
8
star
22

msteams-jira-server

Microsoft Teams plugin for Jira Server
C#
7
star
23

compiled-website

The documentation website for Compiled (CSS-in-JS). Please don't merge to this repo - we have moved to https://github.com/atlassian-labs/compiled !
MDX
7
star
24

Earl

Earl is a tool designed to help estimate how much you spent on DynamoDb in the last week. It can help you tweak your auto scaling settings to help you minimise wastage and compare the cost of provisioned vs. on-demand capacity modes.
Kotlin
6
star
25

msteams-jira-server-addon

Official plugin for Jira Server that integrates with Microsoft Teams.
Java
5
star
26

inline-require-webpack-plugin

Optimise generated bundles by inline requiring ES modules, without CommonJS deoptimisations
TypeScript
5
star
27

FSRT

A static analyzer for finding Forge app vulnerabilities
Rust
4
star
28

observe

@observe is a Python decorator
Python
4
star
29

transfer-api-ref-client

Reference API implementation that supports large file uploads (>100GB) in a chunked and resumable fashion to https://transfer.atlassian.com
Python
4
star
30

oss-maven-template

A template for Maven-based projects that should be published to Maven Central.
Java
4
star
31

aql

Go library for generating various Atlassian Query Language(s)
Go
4
star
32

DC-App-monitoring-EAP-dashboards

Grafana dashboards to accompany the DC App monitoring EAP Java agent
2
star
33

artifact-publish-token

Custom Action to retrieve temporary tokens to publish artifacts
JavaScript
2
star
34

Compass-Orb

An orb for reporting the status of CircleCI builds and deployments to Atlassian Compass
Shell
2
star
35

kotlin-url-dsl

Build URL as Kotlin code which resembles the URL it generates.
Kotlin
2
star
36

figma-for-jira

A Connect app for integrating Figma designs into Jira.
TypeScript
2
star
37

visually-complete

TypeScript
2
star
38

prosemirror-kotlin

Kotlin implementation of Prosemirror
Kotlin
2
star
39

zephyr-squad-to-scale-migration

Java
2
star
40

jql-kotlin

Build JQL query as Kotlin code which resembles the query it generates.
Kotlin
1
star
41

gradle-release

Gradle plugin which can release an open source Atlassian lib to Maven.
Kotlin
1
star
42

tectonics

Atlaskit, but with Web Components
TypeScript
1
star
43

oss-gradle-template

A template for Atlassian open source projects based on Gradle
Java
1
star
44

prosemirror-test-builder

1
star