åœèšäºã§ã¯ãGoogle CloudïŒæ§ç§° GCPïŒã® Private Service Connect ãã Google Cloud APIs ãžã®ã¢ã¯ã»ã¹ã Private Service Connect Endpoint çµç±ã§ãã©ã€ããŒãæ¥ç¶ã§ããŠããã確èªããæ¹æ³ã玹ä»ããŸãã Private Service Connect ãšã¯ æ€èšŒã®èæ¯ ã€ã³ã¿ãŒããããçµç±ããŠãªããç¢ºèª å®æœå
容 ç¢ºèªæ¹æ³ åæ æ§æå³ æ§ç¯ ãããžã§ã¯ãã®äœæãšè«æ±å
ã¢ã«ãŠã³ãã®çŽã¥ã ããã©ã«ããããžã§ã¯ãã®ã»ãã API ã®æå¹å VPC ãšãµããããã®äœæ ãã¡ã€ã¢ãŠã©ãŒã«ã«ãŒã«ã®äœæ Compute Engine ã®äœæ Private Service Connect ã®äœæ Private Service Connect ã®ç¢ºèª çµè·¯ã®ç¢ºèª ãã±ããã®äœæ storage.googleapis.com curl ã³ãã³ã tcpdump ã³ãã³ã VPC ãããŒãã° storage-pscendpoint.p.googleapis.com curl ã³ãã³ã tcpdump ã³ãã³ã VPC ãããŒãã° ããã©ã«ãã«ãŒãã®åé€ çµæ storage.googleapis.com storage-pscendpoint.p.googleapis.com ãã®ä»ã®ç¢ºèªæ¹æ³ Private Service Connect ãšã¯ Private Service Connect ãšã¯ã å€éš IP ãæããªã VM ããªã³ãã¬ãã¹ã®ã¯ã©ã€ã¢ã³ãããå
éšãããã¯ãŒã¯çµç±ã§ Google Cloud APIs ããGoogle Cloud ã§ãã¹ãããç¬èªãµãŒãã¹ãžã¢ã¯ã»ã¹ã§ããããã«ããããã®ä»çµã¿ã§ãã VPC å
ã« IP ã¢ãã¬ã¹ãæã€ãšã³ããã€ã³ããäœããããã®ãšã³ããã€ã³ãçµç±ã§ Google Cloud APIs ãç¬èªãµãŒãã¹ã«ã¢ã¯ã»ã¹ã§ããããã«ãªããŸãã é¡äŒŒæ©èœãšã㊠éå®å
¬éã® Google ã¢ã¯ã»ã¹ ïŒPrivate Google AccessïŒããããŸãããã® 2 ã€ã®éãã«ã€ããŠã¯åœèšäºã§ã¯è§ŠããŸããã®ã§ã以äžã®èšäºããåç
§ãã ããã blog.g-gen.co.jp blog.g-gen.co.jp æ€èšŒã®èæ¯ ã€ã³ã¿ãŒããããçµç±ããŠãªããç¢ºèª äžè¿°ã®éããPrivate Service Connect ã䜿ãããšã§ VM ããªã³ãã¬ãã¹ã®ã¯ã©ã€ã¢ã³ãããå
éšãããã¯ãŒã¯çµç±ã§ Google Cloud APIs ãžã¢ã¯ã»ã¹ã§ããŸããããããèšå®ã«èª€ãããã£ãå Žåãæå³ããªãèšå®ã«ãããPrivate Service Connect ãçµç±ãããããã©ã«ãã«ãŒãããã€ã³ã¿ãŒããããçµç±ããŠãããçã®ã±ãŒã¹ãèããããŸãã ããã§ãåœèšäºã§ã¯ Private Service Connect ãçµç±ã㊠Google Cloud APIs ãžã¢ã¯ã»ã¹ããŠããã確èªããæ¹æ³ã玹ä»ããŸããäœããããã§ç¢ºèªã§ããã®ã¯ãããŸã§ VM ãã Private Service Connect Endpoint ãŸã§ã®éä¿¡ ã§ããGoogle Cloud ã管çãããããã¯ãŒã¯ïŒãµãŒãã¹ãããã¥ãŒãµãŒïŒã¯ãŠãŒã¶ãŒåŽã§ç¢ºèªã¯ã§ããŸããã 宿œå
容 ç¢ºèªæ¹æ³ Private Service Connect ã®èšå®ãããäžã§ãVM äžã§ curl ã³ãã³ããå®è¡ããŸãããã®æã®éä¿¡å
ãšéä¿¡å
ãŸã§ã®ã¢ã¯ã»ã¹çµè·¯ã以äžã® 2 ã€ã®æ¹æ³ã§ç¢ºèªããŸãã tcpdump ã³ãã³ã VPC ãããŒãã° åæ Private Service Connect ã®ãšã³ããã€ã³ã p.googleapis.com ã® DNS åãäœ¿çš å®è¡ç°å¢ Cloud Shell ããåãªãœãŒã¹ãäœæ # gcloud CLI ã®ããŒãžã§ã³ fujioka@cloudshell:~ ( xxxx ) $ gcloud version | grep ' Google Cloud SDK ' Google Cloud SDK 441 . 0 . 0 fujioka@cloudshell:~ ( xxxx ) $ VM ãžã®æ¥ç¶ VM ãžã®æ¥ç¶ã¯Â Cloud IAP  ãäœ¿çš åœèšäºã§æ±ããªãããš åãªãœãŒã¹ã®äœæã«å¿
èŠãªæš©é æ§æå³ ä»¥äžã® 2 ã€ã®çµè·¯ã§ç¢ºèªããŸãã Default Internet Gateway ããã€ã³ã¿ãŒããããçµç±ããå ŽåïŒèµ€ç·ïŒãã€ã³ã¿ãŒãããã«å
¬éãããŠãã Cloud Storage ã®ãšã³ããã€ã³ãïŒ storage.googleapis.com ïŒãžã¢ã¯ã»ã¹ããŸãã Private Service Connect ã䜿ãå ŽåïŒéç·ïŒãå
éšãããã¯ãŒã¯ãçµç±ãã Cloud Storage ã®ãšã³ããã€ã³ãïŒ storage-pscendpoint.p.googleapis.com ïŒãžã¢ã¯ã»ã¹ããŸãã æ§æå³ æ§ç¯ ãããžã§ã¯ãã®äœæãšè«æ±å
ã¢ã«ãŠã³ãã®çŽã¥ã ãããžã§ã¯ããäœæããäœæãããããžã§ã¯ãã«è«æ±å
ã¢ã«ãŠã³ããçŽã¥ããŸãã $ gcloud projects create ${PROJECT_ID} --name = ${PROJECT_NAME} --organization = ${ORGANIZATION_ID} && \ gcloud beta billing projects link ${PROJECT_ID} --billing-account = ${BILLING_ACCOUNT_ID} åè gcloud projects create gcloud beta billing projects link ããã©ã«ããããžã§ã¯ãã®ã»ãã äœæãããããžã§ã¯ããããã©ã«ããããžã§ã¯ããšããŠã»ããããçµæã確èªããŸãã $ gcloud config set project ${PROJECT_ID} && \ gcloud config list project åè gcloud config API ã®æå¹å å¿
èŠãª API ãæå¹åããŸãã Compute Engine API Service Directory API Cloud DNS API $ gcloud services enable compute.googleapis.com servicedirectory.googleapis.com dns.googleapis.com åè gcloud services VPC ãšãµããããã®äœæ VPC ãšãµãããããäœæããŸããåŸè¿°ã®çµè·¯ã®ç¢ºèªã§ VPC ãããŒãã° ã䜿ãããæå¹åããŸãããµã³ãã«ã¬ãŒãã 1.0ïŒ100%ããã¹ãŠã®ãã°ãšã³ããªãä¿æïŒãšããŠããŸãããå®éã«åŠçããããã±ããã¯å¹³åã§çŽ 3% ã§ãã gcloud compute networks create customer-vpc \ --subnet-mode = custom && gcloud compute networks subnets create customer-subnet \ --network = customer-vpc \ --range = 10 . 0 . 0 . 0 / 24 \ --region = asia-northeast1 \ --enable-flow-logs \ --logging-flow-sampling = 1 . 0 \ --enable-private-ip-google-access åè ãã°ã®ãµã³ããªã³ã°ãšåŠç gcloud compute networks gcloud compute networks subnets ã³ã³ãœãŒã«ããäœæããå Žåã¯ä»¥äžã®èšäºããåç
§ãã ããã blog.g-gen.co.jp ãã¡ã€ã¢ãŠã©ãŒã«ã«ãŒã«ã®äœæ Cloud IAP çµç±ã§ VM ãž SSH æ¥ç¶ããããã 35.235.240.0/20 ãèš±å¯ããã«ãŒã«ãäœæããŸãã $ gcloud compute firewall-rules create allow-ssh-from-iap \ --network customer-vpc \ --direction ingress \ --action allow \ --source-ranges 35 . 235 . 240 . 0 / 20 \ --rules = tcp:22 åè gcloud compute firewall-rules Compute Engine ã®äœæ VM ãäœæããŸããäžæçã«å€éš IP ã¯ä»äžããŠããŸãã $ gcloud compute instances create vm \ --image = debian-10-buster-v20230711 \ --image-project debian-cloud \ --machine-type e2-micro \ --network = customer-vpc \ --subnet = customer-subnet \ --zone asia-northeast1-b VM ã« dnsutils ãã€ã³ã¹ããŒã«åŸãå€éš IP ã¯å€ããŸãã # ããã±ãŒãžã®ã¢ããããŒã fujioka@vm:~$ sudo apt update # dnsutils ã®ã€ã³ã¹ããŒã« fujioka@vm:~$ sudo apt install -y dnsutils åè gcloud compute instances ãã®ç¶æ
ã§ã¯ Cloud Storage ãšã³ããã€ã³ãã¯ã€ã³ã¿ãŒãããäžã®ã¢ãã¬ã¹ïŒ storage.googleapis.com ïŒãè¿ã£ãŠããŸãã fujioka@vm:~$ dig storage.googleapis.com ; <<>> DiG 9.11.5-P4-5.1+deb10u9-Debian <<>> storage.googleapis.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 37777 ;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;storage.googleapis.com. IN A ;; ANSWER SECTION: storage.googleapis.com. 300 IN A 142.250.207.48 storage.googleapis.com. 300 IN A 142.250.196.112 storage.googleapis.com. 300 IN A 142.250.196.144 storage.googleapis.com. 300 IN A 172.217.175.80 storage.googleapis.com. 300 IN A 216.58.220.144 storage.googleapis.com. 300 IN A 142.250.199.112 storage.googleapis.com. 300 IN A 172.217.175.112 storage.googleapis.com. 300 IN A 142.251.222.16 storage.googleapis.com. 300 IN A 142.251.42.144 storage.googleapis.com. 300 IN A 142.251.42.176 storage.googleapis.com. 300 IN A 142.251.42.208 storage.googleapis.com. 300 IN A 142.251.222.48 storage.googleapis.com. 300 IN A 172.217.26.240 storage.googleapis.com. 300 IN A 172.217.31.144 storage.googleapis.com. 300 IN A 172.217.161.80 storage.googleapis.com. 300 IN A 142.250.198.16 ;; Query time: 4 msec ;; SERVER: 169.254.169.254#53(169.254.169.254) ;; WHEN: Sun Aug 06 22:55:49 UTC 2023 ;; MSG SIZE rcvd: 307 fujioka@vm:~$ Private Service Connect ã®äœæ ãšã³ããã€ã³ãã«å²ãæ¯ãå
éš IP ã¢ãã¬ã¹ãäºçŽããŸãã gcloud compute addresses create psc-address \ --global \ --purpose = PRIVATE_SERVICE_CONNECT \ --addresses = 10 . 0 . 20 . 1 \ --network = customer-vpc 転éã«ãŒã«ãäœæããŸãã gcloud compute forwarding-rules create pscendpoint \ --global \ --network = customer-vpc \ --address = psc-address \ --target-google-apis-bundle = all-apis åè ãšã³ããã€ã³ããäœæãã gcloud compute addresses gcloud compute forwarding-rules Private Service Connect ã®ç¢ºèª ãšã³ããã€ã³ããæ©èœããŠããããšã確èªããŸãããšã³ããã€ã³ããæ©èœããŠããå Žåã以äžã®ããã« HTTP 204 ã¬ã¹ãã³ã¹ ã³ãŒããè¿ãããŸãããšã³ããã€ã³ãã¯ãpingïŒICMPïŒã«å¿çããªããã以äžã®ããã«ç¢ºèªããŸãã fujioka@vm:~$ curl -v 10 . 0 . 20 . 1 /generate_204 * Expire in 0 ms for 6 ( transfer 0x5636b4fb80f0 ) * Trying 10 . 0 . 20 . 1 ... * TCP_NODELAY set * Expire in 200 ms for 4 ( transfer 0x5636b4fb80f0 ) * Connected to 10 . 0 . 20 . 1 ( 10 . 0 . 20 . 1 ) port 80 ( #0) > GET /generate_204 HTTP/ 1 . 1 > Host: 10 . 0 . 20 . 1 > User-Agent: curl/ 7 . 64 . 0 > Accept: */* > < HTTP/ 1 . 1 204 No Content < Content-Length: 0 < Cross-Origin-Resource-Policy: cross-origin < Date: Sun, 06 Aug 2023 22:56:48 GMT < * Connection #0 to host 10.0.20.1 left intact fujioka@vm:~$ 443 ããŒãã§ãæåããŸãã fujioka@vm:~$ curl -v 10 . 0 . 20 .1:443/generate_204 * Expire in 0 ms for 6 ( transfer 0x5591c9b4c0f0 ) * Trying 10 . 0 . 20 . 1 ... * TCP_NODELAY set * Expire in 200 ms for 4 ( transfer 0x5591c9b4c0f0 ) * Connected to 10 . 0 . 20 . 1 ( 10 . 0 . 20 . 1 ) port 443 ( #0) > GET /generate_204 HTTP/ 1 . 1 > Host: 10 . 0 . 20 .1:443 > User-Agent: curl/ 7 . 64 . 0 > Accept: */* > * Empty reply from server * Connection #0 to host 10.0.20.1 left intact curl: ( 52 ) Empty reply from server fujioka@vm:~$ åè ãšã³ããã€ã³ããæ©èœããŠããããšã確èªãã ãšã³ããã€ã³ããäœæãããšããã®ãšã³ããã€ã³ãã䜿çšããŠå©çšå¯èœ API ãšãµãŒãã¹ã® DNS ã¬ã³ãŒãã Service Directory ã«ãã£ãŠäœæãããŸãã Private Service Connect ã«ãã£ãŠäœããããŸãŒã³ Service Directory ã«ãã£ãŠäœæãããã¬ã³ãŒãã«ãããCloud Storage ã®ãšã³ããã€ã³ãïŒ storage-pscendpoint.p.googleapis.com ïŒãžå
éšãããã¯ãŒã¯ã§ã¢ã¯ã»ã¹ã§ããŠããŸãã fujioka@vm:~$ dig storage-pscendpoint.p.googleapis.com ; <<>> DiG 9.11.5-P4-5.1+deb10u9-Debian <<>> storage-pscendpoint.p.googleapis.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 25971 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;storage-pscendpoint.p.googleapis.com. IN A ;; ANSWER SECTION: storage-pscendpoint.p.googleapis.com. 60 IN A 10.0.20.1 ;; Query time: 9 msec ;; SERVER: 169.254.169.254#53(169.254.169.254) ;; WHEN: Sun Aug 06 23:03:30 UTC 2023 ;; MSG SIZE rcvd: 81 fujioka@vm:~$ åè p.googleapis.com DNS åã䜿çšãã storage.googleapis.com ã¯ãšã³ããã€ã³ãäœæåãšå€ãããã€ã³ã¿ãŒãããäžã«å
¬éãããŠããã¢ãã¬ã¹ãè¿ã£ãŠããŸãã fujioka@vm:~$ dig storage.googleapis.com ; <<>> DiG 9.11.5-P4-5.1+deb10u9-Debian <<>> storage.googleapis.com ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 29405 ;; flags: qr rd ra; QUERY: 1, ANSWER: 16, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;storage.googleapis.com. IN A ;; ANSWER SECTION: storage.googleapis.com. 300 IN A 142.250.196.112 storage.googleapis.com. 300 IN A 142.250.196.144 storage.googleapis.com. 300 IN A 172.217.175.80 storage.googleapis.com. 300 IN A 216.58.220.144 storage.googleapis.com. 300 IN A 142.250.199.112 storage.googleapis.com. 300 IN A 142.251.222.16 storage.googleapis.com. 300 IN A 142.251.42.144 storage.googleapis.com. 300 IN A 142.251.42.176 storage.googleapis.com. 300 IN A 142.251.42.208 storage.googleapis.com. 300 IN A 142.251.222.48 storage.googleapis.com. 300 IN A 172.217.26.240 storage.googleapis.com. 300 IN A 172.217.31.144 storage.googleapis.com. 300 IN A 142.250.198.16 storage.googleapis.com. 300 IN A 172.217.31.176 storage.googleapis.com. 300 IN A 172.217.161.48 storage.googleapis.com. 300 IN A 142.250.207.16 ;; Query time: 6 msec ;; SERVER: 169.254.169.254#53(169.254.169.254) ;; WHEN: Sun Aug 06 23:03:54 UTC 2023 ;; MSG SIZE rcvd: 307 fujioka@vm:~$ ãããŸã§ã§ä»¥äžã®æ§æãšãªã£ãŠããŸãã åæ²ïŒæ§æå³ ãã以éã¯ãCloud Storage ã®ãšã³ããã€ã³ããã€ã³ã¿ãŒãããçµç±ã®ãšã³ããã€ã³ãïŒ storage.googleapis.com ïŒãš Private Service Connect çµç±ã®ãšã³ããã€ã³ãïŒ storage-pscendpoint.p.googleapis.com ïŒã®ã©ã¡ãã«ã¢ã¯ã»ã¹ããŠããã確èªããæ¹æ³ã玹ä»ããŸãã çµè·¯ã®ç¢ºèª ãã±ããã®äœæ 確èªçšã«ãã±ãããäœæããŸãã $ gcloud storage buckets create gs://test-bucket-20230807 -l asia-northeast1 --uniform-bucket-level-access storage.googleapis.com Default Internet Gateway çµç±ã§ Cloud Storage ã®ãšã³ããã€ã³ãïŒ storage.googleapis.com ïŒãžã¢ã¯ã»ã¹ããŠããæã®çµæã確èªããŸãã curl ã³ãã³ã curl ã³ãã³ãã§ç¢ºèªããŸããåé¡ãªãçµæãè¿ã£ãŠããŸãã fujioka@vm:~$ curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://storage.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)" { "kind": "storage#buckets", "items": [ { "kind": "storage#bucket", "selfLink": "https://www.googleapis.com/storage/v1/b/test-bucket-20230807", "id": "test-bucket-20230807", "name": "test-bucket-20230807", "projectNumber": "012345", "metageneration": "1", "location": "ASIA-NORTHEAST1", "storageClass": "STANDARD", "etag": "CAE=", "timeCreated": "2023-08-06T12:53:47.056Z", "updated": "2023-08-06T12:53:47.056Z", "iamConfiguration": { "bucketPolicyOnly": { "enabled": true, "lockedTime": "2023-11-04T12:53:47.056Z" }, "uniformBucketLevelAccess": { "enabled": true, "lockedTime": "2023-11-04T12:53:47.056Z" }, "publicAccessPrevention": "inherited" }, "locationType": "region" } ] } fujioka@vm:~$ åè ãªã¯ãšã¹ã ãšã³ããã€ã³ã tcpdump ã³ãã³ã äžèšã® curl å®è¡æã«ãå¥ã¿ãŒããã«ãã tcpdump ã§ã¢ã¯ã»ã¹å
ã確èªããŸãã ãã® 216.58.220.112 ã¯å
çš dig ã§è¿ã£ãŠãã storage.googleapis.com ã®ã¢ãã¬ã¹ã§ãã fujioka@vm:~$ sudo tcpdump -nn -tttt dst port 443 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on ens4, link-type EN10MB (Ethernet), capture size 262144 bytes 2023-08-06 23:07:25.122857 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [S], seq 289325051, win 65320, options [mss 1420,sackOK,TS val 2811924983 ecr 0,nop,wscale 7], length 0 2023-08-06 23:07:25.123628 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [.], ack 3659639751, win 511, options [nop,nop,TS val 2811924983 ecr 1285463732], length 0 2023-08-06 23:07:25.124890 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [P.], seq 0:517, ack 1, win 511, options [nop,nop,TS val 2811924985 ecr 1285463732], length 517 2023-08-06 23:07:25.125667 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [.], ack 4321, win 491, options [nop,nop,TS val 2811924985 ecr 1285463734], length 0 2023-08-06 23:07:25.126753 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [P.], seq 517:597, ack 4321, win 501, options [nop,nop,TS val 2811924986 ecr 1285463734], length 80 2023-08-06 23:07:25.126993 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [P.], seq 597:643, ack 4383, win 501, options [nop,nop,TS val 2811924987 ecr 1285463735], length 46 2023-08-06 23:07:25.127043 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [P.], seq 643:692, ack 4383, win 501, options [nop,nop,TS val 2811924987 ecr 1285463735], length 49 2023-08-06 23:07:25.127145 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [P.], seq 692:727, ack 4383, win 501, options [nop,nop,TS val 2811924987 ecr 1285463735], length 35 2023-08-06 23:07:25.127292 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [P.], seq 727:1640, ack 4414, win 501, options [nop,nop,TS val 2811924987 ecr 1285463735], length 913 2023-08-06 23:07:25.127412 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [P.], seq 1640:1671, ack 4414, win 501, options [nop,nop,TS val 2811924987 ecr 1285463735], length 31 2023-08-06 23:07:25.308584 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [P.], seq 1671:1695, ack 5654, win 501, options [nop,nop,TS val 2811925168 ecr 1285463916], length 24 2023-08-06 23:07:25.308882 IP 10.0.0.2.50926 > 216.58.220.112.443: Flags [R.], seq 1695, ack 5655, win 501, options [nop,nop,TS val 2811925169 ecr 1285463917], length 0 ^C 12 packets captured 12 packets received by filter 0 packets dropped by kernel fujioka@vm:~$ VPC ãããŒãã° VMïŒ 10.0.0.2 ïŒãã Cloud Storage ãšã³ããã€ã³ãã¢ãã¬ã¹ïŒ 216.58.220.112 ïŒãžã®ãããŒãã°ã§ãã { "insertId": "1w9cwmwfsezc3l", "jsonPayload": { "bytes_sent": "4504", "reporter": "SRC", "start_time": "2023-08-06T23:07:25.123378275Z", "packets_sent": "16", "connection": { "dest_ip": "216.58.220.112", "src_port": 50926, "protocol": 6, "dest_port": 443, "src_ip": "10.0.0.2" }, "end_time": "2023-08-06T23:07:25.308756331Z" }, "resource": { "type": "gce_subnetwork", "labels": { "subnetwork_id": "5059267080321417437", "project_id": "xxxxx", "location": "asia-northeast1-b", "subnetwork_name": "customer-subnet" } }, "timestamp": "2023-08-06T23:07:36.397651875Z", "logName": "projects/xxxx/logs/compute.googleapis.com%2Fvpc_flows", "receiveTimestamp": "2023-08-06T23:07:36.397651875Z" } Cloud Storage ãšã³ããã€ã³ãã¢ãã¬ã¹ïŒ 216.58.220.112 ïŒãã VMïŒ 10.0.0.2 ïŒãžã®ãããŒãã°ã§ãã { " insertId " : " 1w9cwmwfsezc3m " , " jsonPayload " : { " end_time " : " 2023-08-06T23:07:25.308756331Z " , " connection " : { " protocol " : 6 , " dest_ip " : " 10.0.0.2 " , " src_ip " : " 216.58.220.112 " , " dest_port " : 50926 , " src_port " : 443 } , " reporter " : " DEST " , " bytes_sent " : " 248 " , " start_time " : " 2023-08-06T23:07:25.123378275Z " , " packets_sent " : " 16 " } , " resource " : { " type " : " gce_subnetwork " , " labels " : { " location " : " asia-northeast1-b " , " subnetwork_id " : " 5059267080321417437 " , " subnetwork_name " : " customer-subnet " , " project_id " : " xxxx " } } , " timestamp " : " 2023-08-06T23:07:36.397651875Z " , " logName " : " projects/xxxx/logs/compute.googleapis.com%2Fvpc_flows " , " receiveTimestamp " : " 2023-08-06T23:07:36.397651875Z " } storage-pscendpoint.p.googleapis.com å
éšãããã¯ãŒã¯ãçµç±ãã Cloud Storage ã®ãšã³ããã€ã³ãïŒ storage-pscendpoint.p.googleapis.com ïŒãžã¢ã¯ã»ã¹ããŠããæã®çµæã確èªããŸãã curl ã³ãã³ã curl ã³ãã³ãã§ç¢ºèªããŸããåé¡ãªãçµæãè¿ã£ãŠããŸãã fujioka@vm:~$ curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://storage-pscendpoint.p.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)" { "kind": "storage#buckets", "items": [ { "kind": "storage#bucket", "selfLink": "https://www.googleapis.com/storage/v1/b/test-bucket-20230807", "id": "test-bucket-20230807", "name": "test-bucket-20230807", "projectNumber": "012345", "metageneration": "1", "location": "ASIA-NORTHEAST1", "storageClass": "STANDARD", "etag": "CAE=", "timeCreated": "2023-08-06T12:53:47.056Z", "updated": "2023-08-06T12:53:47.056Z", "iamConfiguration": { "bucketPolicyOnly": { "enabled": true, "lockedTime": "2023-11-04T12:53:47.056Z" }, "uniformBucketLevelAccess": { "enabled": true, "lockedTime": "2023-11-04T12:53:47.056Z" }, "publicAccessPrevention": "inherited" }, "locationType": "region" } ] } fujioka@vm:~$ tcpdump ã³ãã³ã äžèšã® curl å®è¡æã«ãå¥ã¿ãŒããã«ãã tcpdump ã§ã¢ã¯ã»ã¹å
ã確èªããŸãã ãã® 10.0.20.1 㯠Private Service Connect Endpoint ã®ã¢ãã¬ã¹ã§ãã fujioka@vm:~$ sudo tcpdump -nn -tttt dst port 443 tcpdump: verbose output suppressed, use -v or -vv for full protocol decode listening on ens4, link-type EN10MB (Ethernet), capture size 262144 bytes 2023-08-06 23:11:40.027044 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [S], seq 2145849587, win 65320, options [mss 1420,sackOK,TS val 3419769925 ecr 0,nop,wscale 7], length 0 2023-08-06 23:11:40.027954 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [.], ack 1219629433, win 511, options [nop,nop,TS val 3419769926 ecr 250771621], length 0 2023-08-06 23:11:40.029234 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [P.], seq 0:517, ack 1, win 511, options [nop,nop,TS val 3419769927 ecr 250771621], length 517 2023-08-06 23:11:40.062691 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [.], ack 7041, win 479, options [nop,nop,TS val 3419769960 ecr 250771656], length 0 2023-08-06 23:11:40.062707 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [.], ack 9835, win 467, options [nop,nop,TS val 3419769960 ecr 250771656], length 0 2023-08-06 23:11:40.064094 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [P.], seq 517:597, ack 9835, win 501, options [nop,nop,TS val 3419769962 ecr 250771656], length 80 2023-08-06 23:11:40.064468 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [P.], seq 597:643, ack 9897, win 501, options [nop,nop,TS val 3419769962 ecr 250771658], length 46 2023-08-06 23:11:40.064537 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [P.], seq 643:692, ack 9897, win 501, options [nop,nop,TS val 3419769962 ecr 250771658], length 49 2023-08-06 23:11:40.064576 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [P.], seq 692:727, ack 9897, win 501, options [nop,nop,TS val 3419769962 ecr 250771658], length 35 2023-08-06 23:11:40.064691 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [P.], seq 727:1650, ack 9897, win 501, options [nop,nop,TS val 3419769962 ecr 250771658], length 923 2023-08-06 23:11:40.064777 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [P.], seq 1650:1681, ack 9928, win 501, options [nop,nop,TS val 3419769962 ecr 250771658], length 31 2023-08-06 23:11:40.240570 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [.], ack 11099, win 501, options [nop,nop,TS val 3419770138 ecr 250771834], length 0 2023-08-06 23:11:40.240903 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [P.], seq 1681:1705, ack 11130, win 501, options [nop,nop,TS val 3419770138 ecr 250771834], length 24 2023-08-06 23:11:40.241162 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [R], seq 2145851293, win 0, length 0 2023-08-06 23:11:40.241170 IP 10.0.0.2.52156 > 10.0.20.1.443: Flags [R.], seq 1705, ack 11169, win 501, options [nop,nop,TS val 3419770139 ecr 250771834], length 0 ^C 15 packets captured 15 packets received by filter 0 packets dropped by kernel fujioka@vm:~$ VPC ãããŒãã° VMïŒ 10.0.0.2 ïŒããPrivate Service Connect EndpointïŒ 10.0.20.1 ïŒãžã®ãããŒãã°ã§ãã { "insertId": "rr9iweg19nih87", "jsonPayload": { "start_time": "2023-08-06T23:11:04.052467571Z", "packets_sent": "8", "reporter": "SRC", "connection": { "src_port": 49890, "src_ip": "10.0.0.2", "protocol": 6, "dest_port": 443, "dest_ip": "10.0.20.1" }, "rtt_msec": "0", "bytes_sent": "1944", "end_time": "2023-08-06T23:11:04.261488665Z" }, "resource": { "type": "gce_subnetwork", "labels": { "location": "asia-northeast1-b", "subnetwork_id": "5059267080321417437", "subnetwork_name": "customer-subnet", "project_id": "xxxx" } }, "timestamp": "2023-08-06T23:11:16.402034721Z", "logName": "projects/xxxx/logs/compute.googleapis.com%2Fvpc_flows", "receiveTimestamp": "2023-08-06T23:11:16.402034721Z" } Private Service Connect EndpointïŒ 10.0.20.1 ïŒãã VMïŒ 10.0.0.2 ïŒãžã®ãããŒãã°ã§ãã { "insertId": "rr9iweg19nih88", "jsonPayload": { "bytes_sent": "10442", "packets_sent": "20", "end_time": "2023-08-06T23:11:04.261488665Z", "reporter": "DEST", "rtt_msec": "0", "connection": { "dest_port": 49890, "src_ip": "10.0.20.1", "src_port": 443, "dest_ip": "10.0.0.2", "protocol": 6 }, "start_time": "2023-08-06T23:11:04.052467571Z" }, "resource": { "type": "gce_subnetwork", "labels": { "location": "asia-northeast1-b", "subnetwork_id": "5059267080321417437", "subnetwork_name": "customer-subnet", "project_id": "xxxx" } }, "timestamp": "2023-08-06T23:11:16.402034721Z", "logName": "projects/xxxx/logs/compute.googleapis.com%2Fvpc_flows", "receiveTimestamp": "2023-08-06T23:11:16.402034721Z" } ããã©ã«ãã«ãŒãã®åé€ ããã©ã«ãã«ãŒããåé€ããŸããããã«ãã£ãŠãDefault Internet Gateway ãžã®ã«ãŒãããªããªããCloud Storage ã®ãšã³ããã€ã³ãã® storage.googleapis.com ãžã¢ã¯ã»ã¹ã§ããªããªãã storage-pscendpoint.p.googleapis.com ãžã¢ã¯ã»ã¹ã§ããã°ãPrivate Service Connect ãçµç±ããŠããããšã蚌æãããŸãã ããã©ã«ãã«ãŒãåé€æã®æ§æ # ããã©ã«ãã«ãŒãã®åé€å fujioka@cloudshell:~ (xxxxj)$ gcloud compute routes list NAME: default-route-cfca000dac79779e NETWORK: customer-vpc DEST_RANGE: 10.0.0.0/24 NEXT_HOP: customer-vpc PRIORITY: 0 NAME: default-route-edbfb93b447ab755 NETWORK: customer-vpc DEST_RANGE: 0.0.0.0/0 NEXT_HOP: default-internet-gateway PRIORITY: 1000 fujioka@cloudshell:~ (xxxxj)$ # ããã©ã«ãã«ãŒãã®åé€ fujioka@cloudshell:~ (xxxxj)$ gcloud compute routes delete default-route-edbfb93b447ab755 The following routes will be deleted: - [default-route-edbfb93b447ab755] Do you want to continue (Y/n)? Y Deleted [https://www.googleapis.com/compute/v1/projects/xxxx/global/routes/default-route-edbfb93b447ab755]. fujioka@cloudshell:~ (xxxxj)$ # ããã©ã«ãã«ãŒãã®åé€åŸ fujioka@cloudshell:~ (xxxxj)$ gcloud compute routes list NAME: default-route-cfca000dac79779e NETWORK: customer-vpc DEST_RANGE: 10.0.0.0/24 NEXT_HOP: customer-vpc PRIORITY: 0 fujioka@cloudshell:~ (xxxxj)$ åè gcloud compute routes çµæ storage.googleapis.com storage.googleapis.com ãžã¢ã¯ã»ã¹ã§ããªããªããŸããã fujioka@vm:~$ curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://storage.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)" curl: (28) Connection timed out after 300001 milliseconds fujioka@vm:~$ ^C storage-pscendpoint.p.googleapis.com storage-pscendpoint.p.googleapis.com ãžã¯åé¡ãªãã¢ã¯ã»ã¹ã§ããŸãã fujioka@vm:~$ curl -X GET -H "Authorization: Bearer $(gcloud auth print-access-token)" "https://storage-pscendpoint.p.googleapis.com/storage/v1/b?project=$(gcloud config get-value project)" { "kind": "storage#buckets", "items": [ { "kind": "storage#bucket", "selfLink": "https://www.googleapis.com/storage/v1/b/test-bucket-20230807", "id": "test-bucket-20230807", "name": "test-bucket-20230807", "projectNumber": "012345", "metageneration": "1", "location": "ASIA-NORTHEAST1", "storageClass": "STANDARD", "etag": "CAE=", "timeCreated": "2023-08-06T12:53:47.056Z", "updated": "2023-08-06T12:53:47.056Z", "iamConfiguration": { "bucketPolicyOnly": { "enabled": true, "lockedTime": "2023-11-04T12:53:47.056Z" }, "uniformBucketLevelAccess": { "enabled": true, "lockedTime": "2023-11-04T12:53:47.056Z" }, "publicAccessPrevention": "inherited" }, "locationType": "region" } ] } fujioka@vm:~$ 以äžãããPrivate Service Connect ãæ©èœããŠãããå
éšãããã¯ãŒã¯ã§ã¢ã¯ã»ã¹ã§ããŠããããšãããããŸãã ãã®ä»ã®ç¢ºèªæ¹æ³ åœèšäºã§ã¯ãè€æ°ã®èгç¹ãã確èªãããŸãããã Network Intelligence Center ã®æ¥ç¶ãã¹ãã§ã Private Service Connect ãå®å
ãšããŠæå®ã§ããŸããäœãããã¡ããåæ§ã«ç¢ºèªã§ããã®ã¯ VM ãã Private Service Connect Endpoint ãŸã§ã®éä¿¡ã§ããGoogle Cloud ã管çãããããã¯ãŒã¯ïŒãµãŒãã¹ãããã¥ãŒãµãŒïŒã¯ãŠãŒã¶ãŒåŽã§ç¢ºèªã¯ã§ããŸããã åè ãµããŒããããŠããæ§æ G-gen ç·šééš (èšäºäžèЧ) æ ªåŒäŒç€ŸG-genã¯ããµãŒããŒã¯ãŒã¯ã¹ã°ã«ãŒããšããŠãã¯ã©ãŠãã§ãäžçãããã£ãšãã¯ããããããããããžã§ã³ã«æ²ããã¯ã©ãŠãã®å°å
¥ããæé©åãŸã§ãæ¯æŽããŠãã Google Cloud å°æ¥ã®ã¯ã©ãŠãã€ã³ãã°ã¬ãŒã¿ãŒã§ãã