#20230518(terraform

eeapbh·2023년 5월 19일
0

MZC

목록 보기
43/61
  • terraform natgateway 만들기
    eip가 있어야함

이미지 생성후..

GCP CLI

# mkdir gcp_cli && cd $_
# tee -a /etc/yum.repos.d/google-cloud-sdk.repo << EOM
[google-cloud-cli]
name=Google Cloud CLI
baseurl=https://packages.cloud.google.com/yum/repos/cloud-sdk-el8-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=0
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
       https://packages.cloud.google.com/yum/doc/rpm-package-key.gpg
EOM

# yum install -y google-cloud-cli
# gcloud --version

새프로젝트 ㄱ

# gcloud init --console-only

여기에 copy 한거 붙여넣기

# gcloud compute networks create test-vpc
# gcloud compute networks subnets create test-subnet --network=test-vpc --range=192.168.0.0/16 --region=asia-northeast3
# gcloud compute firewall-rules list
# gcloud compute firewall-rules create test-vpc-allow-ssh --allow=tcp:22 --description="Allow incoming traffic on TCP port 22" --direction=INGRESS --network=test-vpc --source-ranges 106.253.56.124/32
# gcloud compute firewall-rules create test-vpc-allow-http --allow=tcp:80 --description="Allow incoming traffic on TCP port 80" --direction=INGRESS --network=test-vpc --source-ranges 0.0.0.0/0
# gcloud compute firewall-rules create test-vpc-allow-icmp --allow=icmp --description="Allow incoming traffic on ICMP" --direction=INGRESS --network=test-vpc --source-ranges 0.0.0.0/0

# gcloud compute images list
# gcloud compute images describe centos-7-v20230509 \
    --project=centos-cloud
# gcloud compute machine-types list --filter="zone:( asia-northeast3-a )"
# vi httpd-gcp.txt

#!/bin/bash
setenforce 0
yum install -y httpd wget
systemctl enable --now httpd
wget https://s3.ap-northeast-2.amazonaws.com/seoul.bong0918.shop/food.tar
tar xvf food.tar -C /var/www/html

gcloud compute instances create foodwagon \
    --image=centos-7-v20230509 \
    --image-project=centos-cloud \
    --machine-type=e2-micro \
    --network=test-vpc \
    --subnet=test-subnet \
    --tags http-server,https-server \
    --zone=asia-northeast3-a \
    --metadata-from-file=startup-script=httpd-gcp.txt

0개의 댓글