Skip to content

Instantly share code, notes, and snippets.

@tuannvm
Last active March 26, 2019 01:58
Show Gist options
  • Save tuannvm/09603ba28c50678b106eed18d99d9a08 to your computer and use it in GitHub Desktop.
Save tuannvm/09603ba28c50678b106eed18d99d9a08 to your computer and use it in GitHub Desktop.
#gcp #cheatsheet

GCP

VPCs

  • Can share accross projects
  • 5 networks per project
  • 7000 instances per network
  • Mode
    • Auto mode
      • Single subnet per region by default
    • Custom mode

IP Address

  • Internal
    • Change every 24 hours or VM restart
  • External
    • Ephemeral
      • Available only till VM stop / restart
    • Static
      • Regional: general usage for regional resources
      • Global: only use for global load balancing

Routes

  • 2 default routes

  • Spec:

    • Required
      • name
      • network
      • destRange
      • instanceTags
      • priority: to decide which route to go in case multiple routes matched
    • Optional
      • nextHopInstance
      • nextHopIp
      • nextHopNetwork
      • nextHopGateway
      • nextHopVpnTunnel
  • Routes apply to instance if tags match

  • No tag? then route is applied to all instances in that network

Firewall Rules

  • stateful
  • Can use tags to deny / allow traffic
  • Can also use service account for traffic management
  • IPv4 only
  • Can not be shared among networks

Service Accounts (preferred)

  • Instance's identity
  • Instance can only have 1 SA
  • Restricted by IAM
  • Need to stop / restart instance to change SA

Tags

  • For billing & applying firewall
  • Instance can have many tags

Cloud Router

  • Belong to particular network & region

Shared VPC

  • Multiple projects use one network
  • Host project: where shared vpc is hosted
  • Service project: project which has permission to use shared vpc
    • Can only associate with 1 host project at the same time
  • Standalone project: does not share same network

VPC Network Peering

  • Maximum 25 peers per VPC
  • Peered Networks can access all each other's resources by default, use FW to control the access.

Load Balancing

HTTP

@tuannvm
Copy link
Author

tuannvm commented Mar 26, 2019

Copy file from / to gcs:

gsutil -m cp -r file.txt gs://<bucket-name>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment