Oggi ho scritto un altro IaaC (infrastructure as a code) per le mie esigenze. Puoi creare una connessione VPN sicura (IPsec) tra Amazon Web Services (AWS) e Google Cloud Platform (GCP).

Cosa può fare?

Creare un Customer Gateway su AWS. Creare un Virtual Private Gateway su AWS. Creare una Connessione VPN Site-to-Site su AWS. Creare un Security Group per l'accesso alla connessione VPN su AWS. Creare un indirizzo IP Esterno per la connessione VPN su GCP. Creare e gestire la regola del firewall per la connessione VPN su GCP. Creare una regola di Route su GCP.

Requisiti

Utilizzo

  1. Clona il repository

    git clone git@github.com:flightlesstux/aws-to-gcp-vpn-w-terraform.git

  2. Autenticati su Google Platform anche se google-sdk non è installato. È davvero utile per le pipeline CI/CD! Se hai già effettuato l'accesso al tuo progetto Google Cloud Platform con gcloud auth login, puoi saltare questo passaggio.

    export GOOGLE_APPLICATION_CREDENTIALS="service-account-key.json"

  3. Il Project ID è anche dichiarato via terraform ma se non esporti il valore, probabilmente otterrai un errore come quello qui sotto.

    export GOOGLE_PROJECT="0123456789012"

    │ Error: project: required field is not set

    │ with google_compute_instance_group_manager.this,
    │ on group_manager.tf line 1, in resource "google_compute_instance_group_manager" "this":
    │ 1: resource "google_compute_instance_group_manager" "this" {



  4. Esporta il tuo AWS Access Key ID e Secret Access Key per creare una risorsa nella tua Regione AWS.

    AWS_ACCESS_KEY_ID=AKIA1SFAESADASFASR5D
    AWS_SECRET_ACCESS_KEY=Aasdfiajfar1O9DFASDAA3rasdas02304adsq9re


  5. Imposta le tue variabili

    Modifica i valori per variables.tf

  6. Impostazioni del bucket di stato

    Imposta il tuo bucket di stato terraform tramite il file state.tf. Puoi usare AWS S3 o Google Cloud Storage.

  7. Inizializza

    terraform init

  8. Distribuisci!

    terraform apply o terraform apply -auto-approve

Indirizzo del Repository

https://github.com/flightlesstux/aws-to-gcp-vpn-w-terraform

Spero che l'articolo ti sia piaciuto...