DNS 인프라가 이미 있거나 자신의 도메인 이름을 등록하려는 경우, 자세한 내용은 도메인 이름에서 API 제공을 참조하세요.
이 페이지에서는 .endpoints.PROJECT_ID.cloud.goog를 도메인 이름으로 사용하도록 Cloud Endpoints API를 구성하는 방법을 설명합니다. 이 페이지의 구성 단계는 Compute Engine, Google Kubernetes Engine 또는 Kubernetes에서 실행되는 gRPC를 사용하는 API에 적용될 수 있습니다.
.cloud.goog 도메인은 Google에서 관리하며 Google Cloud 고객이 공유합니다. Google Cloud 프로젝트의 프로젝트 ID는 전역에서 고유하므로 .endpoints.PROJECT_ID.cloud.goog 형식의 도메인 이름은 고유하며 API의 도메인 이름으로 사용할 수 있습니다. .endpoints.PROJECT_ID.cloud.goog 도메인 이름 구성은 선택사항입니다. 원하는 경우, 자신의 도메인 이름을 등록할 수 있습니다.
기본 요건
먼저 이 페이지에서는 Cloud Endpoints API를 이미 만들었고 Compute Engine, Google Kubernetes Engine 또는 Kubernetes에 이를 배포했다고 가정합니다. 테스트를 위해 API가 필요한 경우, 샘플 API 구성 및 배포를 안내하는 가이드 중 하나를 사용할 수 있습니다.
DNS 구성
다음 절차에서는 .endpoints.PROJECT_ID.cloud.goog를 Endpoints 서비스 이름으로 사용하는 Endpoints API를 위한 DNS를 구성하는 방법을 설명합니다. 편의를 위해 이 절차에서는 gRPC 서비스 구성 파일을 service.yaml이라 합니다.
DNS를 구성하려면 다음 안내를 따르세요.
service.yaml을 열고 endpoints 필드를 다음 코드 스니펫에 표시된 대로 파일에 추가합니다.
API_NAME을 API 이름(예: bookstore 또는 my-cool-api)으로 바꿉니다.
IP_ADDRESS를 IPv4 주소로 바꿉니다. IP 주소는 문자열이며 따옴표로 묶어야 합니다.
예를 들어 Endpoints API 서비스를 Compute Engine 가상 머신 인스턴스에 배포하는 경우 해당 가상 머신의 외부 IP 주소를 사용할 수 있습니다. 또는 부하 분산기를 지원하는 가상 머신 인스턴스(또는 GKE pod) 그룹에서 코드를 실행하는 경우, 부하 분산기의 IP 주소를 사용할 수 있습니다.
다음 명령어를 사용하여 업데이트된 gRPC 구성 파일을 Service Management에 배포합니다.
위의 gcloud 명령어를 사용하여 service.yaml 파일을 배포하면 Service Management는 대상 IP 주소 192.0.2.1로 해석되는 DNS A 레코드 my-cool-api.endpoints.my-project-id.cloud.goog를 생성합니다. 새 DNS 구성이 확산될 때까지 몇 분 정도 기다려야 할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-12-21(UTC)"],[[["\u003cp\u003eUsers need a domain name to access a deployed API, rather than an IP address.\u003c/p\u003e\n"],["\u003cp\u003eYou can use \u003ccode\u003e.endpoints.\u003c/code\u003e\u003cvar translate=no\u003ePROJECT_ID\u003c/var\u003e\u003ccode\u003e.cloud.goog\u003c/code\u003e as the domain name, which is managed by Google and unique to your Google Cloud project.\u003c/p\u003e\n"],["\u003cp\u003eConfiguring DNS involves updating your \u003ccode\u003eservice.yaml\u003c/code\u003e file with the \u003ccode\u003eendpoints\u003c/code\u003e field, including your API name and target IP address.\u003c/p\u003e\n"],["\u003cp\u003eDeploying the updated \u003ccode\u003eservice.yaml\u003c/code\u003e file to Service Management creates a DNS A-record that maps your API domain name to the specified IP address.\u003c/p\u003e\n"],["\u003cp\u003eAlternatively, users can register their own domain name and configure the relevant DNS infrastructure.\u003c/p\u003e\n"]]],[],null,["# Configuring DNS on the cloud.goog domain\n\n[OpenAPI](/endpoints/docs/openapi/cloud-goog-dns-configure \"View this page for the Cloud Endpoints OpenAPI docs\") \\| gRPC\n\n\u003cbr /\u003e\n\nAfter your API is deployed, users of your API need to access it through a domain name\nrather than an IP address. You can either:\n\n- Configure `.endpoints.`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.cloud.goog` as the domain name (where \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is your Google Cloud project ID).\n- Or register your own domain name, such as `example.com`, which entails:\n - Configuring DNS name servers (or using [Cloud DNS](/dns/docs)).\n - Updating registry addresses.\n - Creating and maintaining DNS records.\n\n If you already have a DNS infrastructure, or you want to register your own\n domain name, see [Serving an API from your domain name](/endpoints/docs/grpc/serving-apis-from-domains) for more information.\n\nThis page describes how to configure Cloud Endpoints APIs to use\n`.endpoints.`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.cloud.goog` as the domain\nname. The configuration steps on this page are applicable for APIs using\ngRPC running on Compute Engine, Google Kubernetes Engine, or Kubernetes.\n\nThe `.cloud.goog` domain is managed by Google and shared by Google Cloud\ncustomers. Because Google Cloud projects are guaranteed to have a globally unique project ID,\na domain name in the format `.endpoints.`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.cloud.goog` is unique and\ncan be used as the domain name for your API. Configuring the\n`.endpoints.`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.cloud.goog` domain name is optional. If you prefer, you\ncan register your own domain name.\n\nPrerequisites\n-------------\n\nAs a starting point, this page assumes that you have already created your\nCloud Endpoints API and deployed it to Compute Engine, Google Kubernetes Engine, or\nKubernetes. If you need an API for testing, you can use one of the\n[tutorials](/endpoints/docs/grpc/tutorials) that walk you through\nconfiguring and deploying a sample API.\n\nConfiguring DNS\n---------------\n\nThe following procedure describes how to configure DNS for\nEndpoints APIs that use\n`.endpoints.`\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.cloud.goog` as the\nEndpoints service name. For convenience, the procedure refers to\nyour gRPC service configuration file as `service.yaml`.\n\nTo configure DNS:\n\n1. Open `service.yaml`, and add the `endpoints` field to the file as shown in the following code snippet: \n\n ```\n type: google.api.Service\n name: API_NAME.endpoints.PROJECT_ID.cloud.goog\n endpoints:\n - name: API_NAME.endpoints.PROJECT_ID.cloud.goog\n target: \"IP_ADDRESS\"\n \n ```\n\n Typically, the `name` field and the `endpoints.name`\n field are the same.\n2. Replace \u003cvar translate=\"no\"\u003eAPI_NAME\u003c/var\u003e with the name of your API (for example, `bookstore` or `my-cool-api`).\n3. Replace \u003cvar translate=\"no\"\u003eIP_ADDRESS\u003c/var\u003e with an IPv4 address. The IP address is a string and must be enclosed in quotation marks.\n\n For example, if you deploy your Endpoints API service to a\n Compute Engine virtual machine instance, you can use the external IP address\n of that virtual machine. Alternatively, if you run your code on a group of virtual\n machine instances (or GKE pods) behind a load balancer,\n you can use the IP address of the load balancer.\n4. Deploy your updated gRPC configuration file to Service Management by using the following command: \n\n ```\n gcloud endpoints services deploy service.yaml service.pb\n ```\n\nFor example, if the following is specified in the `service.yaml` file: \n\n```\ntype: google.api.Service\nname: my-cool-api.endpoints.my-project-id.cloud.goog\nendpoints:\n- name: my-cool-api.endpoints.my-project-id.cloud.goog\n target: \"192.0.2.1\"\n```\n\nWhen you deploy the `service.yaml` file by using the precediing `gcloud` command,\nService Management creates a DNS A-record,\n`my-cool-api.endpoints.my-project-id.cloud.goog`, which resolves to the target\nIP address, `192.0.2.1`. You might need to wait a few minutes for the new DNS\nconfiguration to propagate.\n\nWhat's next\n-----------\n\n- [Configuring Endpoints](/endpoints/docs/grpc/configure-endpoints)\n- [Enabling SSL for Endpoints](/endpoints/docs/grpc/enabling-ssl)\n- [Reserving a static external IP address](/compute/docs/configure-ip-addresses)\n- [Serving an API from your domain name](/endpoints/docs/grpc/serving-apis-from-domains)"]]