URL Fetch API、Sockets API、Mail API などのアウトバウンド サービスは、IP アドレスの大きなプールを利用します。このプールの IP アドレス範囲は、定期的な変更の対象です。実際、同じアプリからの 2 つの連続した API 呼び出しは、2 つの異なる IP アドレスから発生したように見えることがあります。
App Engine サービスの現在の IP アドレス範囲は、Google が公開している IP 範囲情報に基づいて確認できます。
Google では、インターネット上でユーザーが使用できる IP 範囲の完全なリストを goog.json で公開しています。
また、お客様の Google Cloud リソースで使用可能なグローバルとリージョンの外部 IP アドレス範囲のリストを cloud.json に公開しています。
Google API とサービスで使用される IP アドレスは、goog.json の範囲から cloud.json のすべての範囲を除いて計算された範囲のリスト内に収まります。このリストは頻繁に更新されます。
次の Python スクリプトを使用して、Google API とサービスで使用されている IP アドレス範囲のリストを作成できます。
from__future__importprint_functionimportjsontry:fromurllibimporturlopenexceptImportError:fromurllib.requestimporturlopenfromurllib.errorimportHTTPErrorimportnetaddrIPRANGE_URLS={"goog":"https://www.gstatic.com/ipranges/goog.json","cloud":"https://www.gstatic.com/ipranges/cloud.json",}defread_url(url):try:returnjson.loads(urlopen(url).read())except(IOError,HTTPError):print("ERROR: Invalid HTTP response from %s"%url)exceptjson.decoder.JSONDecodeError:print("ERROR: Could not parse HTTP response from %s"%url)defget_data(link):data=read_url(link)ifdata:print("{} published: {}".format(link,data.get("creationTime")))cidrs=netaddr.IPSet()foreindata["prefixes"]:if"ipv4Prefix"ine:cidrs.add(e.get("ipv4Prefix"))if"ipv6Prefix"ine:cidrs.add(e.get("ipv6Prefix"))returncidrsdefmain():cidrs={group:get_data(link)forgroup,linkinIPRANGE_URLS.items()}iflen(cidrs)!=2:raiseValueError("ERROR: Could process data from Google")print("IP ranges for Google APIs and services default domains:")foripin(cidrs["goog"]-cidrs["cloud"]).iter_cidrs():print(ip)if__name__=="__main__":main()
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003eOutbound services use a large pool of IP addresses that are subject to frequent changes, meaning sequential API calls from the same application may originate from different IP addresses.\u003c/p\u003e\n"],["\u003cp\u003eGoogle publishes two JSON files, \u003ccode\u003egoog.json\u003c/code\u003e and \u003ccode\u003ecloud.json\u003c/code\u003e, containing lists of IP ranges available to internet users and Google Cloud resources, respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe IP addresses used by Google APIs and services can be found by subtracting the IP ranges in \u003ccode\u003ecloud.json\u003c/code\u003e from those in \u003ccode\u003egoog.json\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eA Python script is provided to compute the list of IP address ranges that include those used by Google APIs and services, and instructions are available on how to run it.\u003c/p\u003e\n"],["\u003cp\u003eThe previously used \u003ccode\u003e_spf.google.com\u003c/code\u003e DNS TXT record is no longer a complete representation of all possible IP ranges used by Google APIs and services, although it is still accurate for SPF purposes.\u003c/p\u003e\n"]]],[],null,["# Outbound IP addresses for App Engine services\n\nOutbound services, such as the URL Fetch, Sockets, and Mail APIs, make use of\na large pool of IP addresses. The IP address ranges in this pool are subject to\nroutine changes. In fact, two sequential API calls from the same application may\nappear to originate from two different IP addresses.\n\n\u003cbr /\u003e\n\nYou can find the current IP address ranges for your App Engine services\nbased on IP range information that Google publishes:\n\n- Google publishes the complete list of IP ranges that it makes available to\n users on the internet in [goog.json](https://www.gstatic.com/ipranges/goog.json).\n\n- Google also publishes a list of global and regional external IP addresses\n ranges available for customers' Google Cloud resources in\n [cloud.json](https://www.gstatic.com/ipranges/cloud.json).\n\nThe IP addresses used by Google APIs and services fit\nwithin the list of ranges computed by taking away all ranges in `cloud.json`\nfrom those in `goog.json`. These lists are updated frequently.\n\nYou can use the following Python script to create a list of IP address ranges\nthat include those used by Google APIs and services.\n\nFor information about running this script, see [How to\nrun](https://github.com/GoogleCloudPlatform/networking-tools-python/tree/main/tools/cidr#how-to-run). \n\n from __future__ import print_function\n\n import json\n\n try:\n from urllib import urlopen\n except ImportError:\n from urllib.request import urlopen\n from urllib.error import HTTPError\n\n import netaddr\n\n IPRANGE_URLS = {\n \"goog\": \"https://www.gstatic.com/ipranges/goog.json\",\n \"cloud\": \"https://www.gstatic.com/ipranges/cloud.json\",\n }\n\n\n def read_url(url):\n try:\n return json.loads(urlopen(url).read())\n except (IOError, HTTPError):\n print(\"ERROR: Invalid HTTP response from %s\" % url)\n except json.decoder.JSONDecodeError:\n print(\"ERROR: Could not parse HTTP response from %s\" % url)\n\n\n def get_data(link):\n data = read_url(link)\n if data:\n print(\"{} published: {}\".format(link, data.get(\"creationTime\")))\n cidrs = netaddr.IPSet()\n for e in data[\"prefixes\"]:\n if \"ipv4Prefix\" in e:\n cidrs.add(e.get(\"ipv4Prefix\"))\n if \"ipv6Prefix\" in e:\n cidrs.add(e.get(\"ipv6Prefix\"))\n return cidrs\n\n\n def main():\n cidrs = {group: get_data(link) for group, link in IPRANGE_URLS.items()}\n if len(cidrs) != 2:\n raise ValueError(\"ERROR: Could process data from Google\")\n print(\"IP ranges for Google APIs and services default domains:\")\n for ip in (cidrs[\"goog\"] - cidrs[\"cloud\"]).iter_cidrs():\n print(ip)\n\n\n if __name__ == \"__main__\":\n main()\n\n| **Note:** In the past, Google Cloud published a list of IP address ranges in the `_spf.google.com` DNS TXT record (and the records it referenced). While this DNS TXT record continues to be accurate for [SPF\n| purposes](https://support.google.com/a/answer/33786), it does not contain the complete set of possible IP address ranges used by Google APIs and services.\n\n\u003cbr /\u003e"]]