외부 SFTP 서버 만들기

이 문서에서는 Cloud FTP를 사용하여 외부 SFTP 서버를 만드는 방법을 보여줍니다. 인터넷을 통해 외부 SFTP 서버에 액세스할 수 있습니다. 네트워크 외부에 있는 파트너는 서버를 사용하여 Cloud Storage로 파일을 안전하게 전송할 수 있습니다.

사용자의 IP 주소를 기반으로 외부 SFTP 서버에 대한 액세스를 제한할 수 있습니다.

Virtual Private Cloud (VPC) 네트워크 내에서만 액세스할 수 있는 내부 서버를 만드는 단계는 내부 SFTP 서버 만들기를 참조하세요. 서버가 생성된 후에는 서버가 외부인지 내부인지 변경할 수 없습니다.

시작하기 전에

콘솔

  1. Google Cloud 계정에 로그인합니다. Google Cloud를 처음 사용하는 경우 계정을 만들고 Google 제품의 실제 성능을 평가해 보세요. 신규 고객에게는 워크로드를 실행, 테스트, 배포하는 데 사용할 수 있는 $300의 무료 크레딧이 제공됩니다.
  2. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  3. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

  4. Verify that billing is enabled for your Google Cloud project.

  5. Enable the Cloud FTP API, if it is not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

  6. In the Google Cloud console, on the project selector page, select or create a Google Cloud project.

    Roles required to select or create a project

    • Select a project: Selecting a project doesn't require a specific IAM role—you can select any project that you've been granted a role on.
    • Create a project: To create a project, you need the Project Creator role (roles/resourcemanager.projectCreator), which contains the resourcemanager.projects.create permission. Learn how to grant roles.

    Go to project selector

  7. If you're using an existing project for this guide, verify that you have the permissions required to complete this guide. If you created a new project, then you already have the required permissions.

  8. Verify that billing is enabled for your Google Cloud project.

  9. Enable the Cloud FTP API, if it is not already enabled.

    Roles required to enable APIs

    To enable APIs, you need the serviceusage.services.enable permission. If you created the project, then you likely already have this permission through the Owner role (roles/owner). Otherwise, you can get this permission through the Service Usage Admin role (roles/serviceusage.serviceUsageAdmin). Learn how to grant roles.

    Enable the API

  10. 사용자의 IP 주소를 기준으로 서버에 대한 액세스를 제한하려면 서버에 액세스할 수 있는 CIDR 블록 목록을 수집합니다.

gcloud

  1. Google Cloud 계정에 로그인합니다. Google Cloud를 처음 사용하는 경우 계정을 만들고 Google 제품의 실제 성능을 평가해 보세요. 신규 고객에게는 워크로드를 실행, 테스트, 배포하는 데 사용할 수 있는 $300의 무료 크레딧이 제공됩니다.
  2. Google Cloud CLI를 설치합니다.

  3. 외부 ID 공급업체 (IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.

  4. gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.

    gcloud init
  5. Google Cloud 프로젝트를 만들거나 선택합니다.

    프로젝트를 선택하거나 만드는 데 필요한 역할

    • 프로젝트 선택: 프로젝트를 선택하는 데 특정 IAM 역할이 필요하지 않습니다. 역할이 부여된 모든 프로젝트를 선택할 수 있습니다.
    • 프로젝트 만들기: 프로젝트를 만들려면 resourcemanager.projects.create 권한이 포함된 프로젝트 생성자 역할(roles/resourcemanager.projectCreator)이 필요합니다. 역할 부여 방법 알아보기
    • Google Cloud 프로젝트를 만듭니다.

      gcloud projects create PROJECT_ID

      PROJECT_ID를 만들려는 Google Cloud 프로젝트의 이름으로 바꿉니다.

    • 만든 Google Cloud 프로젝트를 선택합니다.

      gcloud config set project PROJECT_ID

      PROJECT_ID을 Google Cloud 프로젝트 이름으로 바꿉니다.

  6. 이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우에는 이미 필요한 권한이 있습니다.

  7. Google Cloud 프로젝트에 결제가 사용 설정되어 있는지 확인합니다.

  8. Cloud FTP API가 아직 사용 설정되지 않은 경우 사용 설정합니다.

    API 사용 설정에 필요한 역할

    API를 사용 설정하려면 serviceusage.services.enable 권한이 필요합니다. 프로젝트를 만든 경우 소유자 역할 (roles/owner)을 통해 이 권한이 이미 있을 수 있습니다. 그렇지 않으면 서비스 사용량 관리자 역할 (roles/serviceusage.serviceUsageAdmin)을 통해 이 권한을 얻을 수 있습니다. 역할 부여 방법 알아보기

    gcloud services enable ftp.googleapis.com
  9. Google Cloud CLI를 설치합니다.

  10. 외부 ID 공급업체 (IdP)를 사용하는 경우 먼저 제휴 ID로 gcloud CLI에 로그인해야 합니다.

  11. gcloud CLI를 초기화하려면, 다음 명령어를 실행합니다.

    gcloud init
  12. Google Cloud 프로젝트를 만들거나 선택합니다.

    프로젝트를 선택하거나 만드는 데 필요한 역할

    • 프로젝트 선택: 프로젝트를 선택하는 데 특정 IAM 역할이 필요하지 않습니다. 역할이 부여된 모든 프로젝트를 선택할 수 있습니다.
    • 프로젝트 만들기: 프로젝트를 만들려면 resourcemanager.projects.create 권한이 포함된 프로젝트 생성자 역할(roles/resourcemanager.projectCreator)이 필요합니다. 역할 부여 방법 알아보기
    • Google Cloud 프로젝트를 만듭니다.

      gcloud projects create PROJECT_ID

      PROJECT_ID를 만들려는 Google Cloud 프로젝트의 이름으로 바꿉니다.

    • 만든 Google Cloud 프로젝트를 선택합니다.

      gcloud config set project PROJECT_ID

      PROJECT_ID을 Google Cloud 프로젝트 이름으로 바꿉니다.

  13. 이 가이드에 기존 프로젝트를 사용하는 경우 이 가이드를 완료하는 데 필요한 권한이 있는지 확인합니다. 새 프로젝트를 만든 경우에는 이미 필요한 권한이 있습니다.

  14. Google Cloud 프로젝트에 결제가 사용 설정되어 있는지 확인합니다.

  15. Cloud FTP API가 아직 사용 설정되지 않은 경우 사용 설정합니다.

    API 사용 설정에 필요한 역할

    API를 사용 설정하려면 serviceusage.services.enable 권한이 필요합니다. 프로젝트를 만든 경우 소유자 역할 (roles/owner)을 통해 이 권한이 이미 있을 수 있습니다. 그렇지 않으면 서비스 사용량 관리자 역할 (roles/serviceusage.serviceUsageAdmin)을 통해 이 권한을 얻을 수 있습니다. 역할 부여 방법 알아보기

    gcloud services enable ftp.googleapis.com
  16. 사용자의 IP 주소를 기준으로 서버에 대한 액세스를 제한하려면 서버에 액세스할 수 있는 CIDR 블록 목록을 수집합니다.

필요한 역할

SFTP 서버를 만드는 데 필요한 권한을 얻으려면 관리자에게 프로젝트에 대한 Cloud FTP 관리자 (roles/ftp.admin) IAM 역할을 부여해 달라고 요청하세요. 역할 부여에 대한 자세한 내용은 프로젝트, 폴더, 조직에 대한 액세스 관리를 참조하세요.

이 사전 정의된 역할에는 SFTP 서버를 만드는 데 필요한 권한이 포함되어 있습니다. 필요한 정확한 권한을 보려면 필수 권한 섹션을 펼치세요.

필수 권한

SFTP 서버를 만들려면 다음 권한이 필요합니다.

  • ftp.servers.create
  • Google Cloud 콘솔을 사용하여 이 작업을 수행하는 경우:
    • ftp.servers.list
    • ftp.locations.list

커스텀 역할이나 다른 사전 정의된 역할을 사용하여 이 권한을 부여받을 수도 있습니다.

외부 서버 만들기

콘솔

  1. Google Cloud 콘솔에서 Cloud FTP 페이지로 이동합니다.

    Cloud FTP로 이동

  2. 서버 만들기를 클릭합니다.

  3. 서버 구성 탭에서 서버의 기본 세부정보를 입력합니다.

    1. 서버 ID 필드에 서버의 고유 ID를 입력합니다.

    2. 리전 목록에서 서버의 Google Cloud 위치를 선택합니다.

      가장 빠른 데이터 전송 속도를 위해 데이터를 저장하는 Cloud Storage 버킷과 동일한 위치에 서버를 만듭니다. Cloud FTP에서 버킷 위치를 지원하지 않는 경우 사용 가능한 가장 가까운 위치를 선택합니다.

    3. (선택사항) 서버의 표시 이름을 입력합니다.

    4. 계속을 클릭합니다.

  4. 네트워킹 및 보안 탭에서 서버의 연결을 구성합니다.

    1. 외부 (공개 IP)를 선택합니다.

    2. 허용된 IP 범위 필드에 서버에 액세스할 수 있는 CIDR 블록을 입력한 후 Enter를 누릅니다. 예를 들면 192.0.2.0/24입니다. 값을 하나 이상 제공해야 하며 최대 500개의 CIDR 블록을 제공할 수 있습니다. 모든 IP 주소의 연결을 허용하려면 0.0.0.0/0를 사용합니다.

  5. 만들기를 클릭합니다.

    서버가 생성되는 데 약 10분이 걸립니다.

gcloud

외부 서버를 만들려면 gcloud alpha storage ftp servers create 명령어를 실행하고 --access-type=EXTERNAL 플래그를 제공합니다.

아래의 명령어 데이터를 사용하기 전에 다음을 바꿉니다.

  • SERVER_ID: 서버의 고유 ID입니다. 소문자로 시작하고 소문자나 숫자로 끝나야 합니다. 소문자, 숫자, 하이픈을 포함할 수 있습니다. goog 프리픽스로 시작하거나 google 문자열을 포함할 수 없습니다. 여기에는 g00gle와 같이 철자가 유사한 경우도 포함됩니다. 최대 길이는 30자(영문 기준)입니다.
  • LOCATION_ID: 서버의 Google Cloud 위치입니다(예: us-west1).

    가장 빠른 데이터 전송 속도를 위해 데이터를 저장하는 Cloud Storage 버킷과 동일한 위치에 서버를 만듭니다. 버킷 위치가 Cloud FTP에서 지원되지 않으면 가장 가까운 사용 가능한 위치를 선택합니다.

  • CIDR_BLOCK: 서버에 액세스할 수 있는 CIDR 블록입니다. 예를 들면 192.0.2.0/24입니다. 값을 하나 이상 제공해야 하며 쉼표로 구분된 목록으로 최대 500개의 CIDR 블록을 제공할 수 있습니다. 모든 IP 주소의 연결을 허용하려면 0.0.0.0/0를 사용합니다.

다음 명령어를 실행합니다.

Linux, macOS 또는 Cloud Shell

gcloud alpha storage ftp servers create SERVER_ID --access-type=EXTERNAL \
    --location=LOCATION_ID --allowed-cidr-blocks=CIDR_BLOCK

Windows(PowerShell)

gcloud alpha storage ftp servers create SERVER_ID --access-type=EXTERNAL `
    --location=LOCATION_ID --allowed-cidr-blocks=CIDR_BLOCK

Windows(cmd.exe)

gcloud alpha storage ftp servers create SERVER_ID --access-type=EXTERNAL ^
    --location=LOCATION_ID --allowed-cidr-blocks=CIDR_BLOCK

서버가 생성되는 데 약 10분이 걸립니다.

REST

외부 서버를 만들려면 servers.create 메서드를 사용하고 externalConfig 액세스 구성을 제공합니다.

요청 데이터를 사용하기 전에 다음을 바꿉니다.

  • PROJECT_ID: 서버의 Google Cloud 프로젝트 ID입니다.
  • LOCATION_ID: 서버의 Google Cloud 위치입니다(예: us-west1).

    가장 빠른 데이터 전송 속도를 위해 데이터를 저장하는 Cloud Storage 버킷과 동일한 위치에 서버를 만듭니다. 버킷 위치가 Cloud FTP에서 지원되지 않는 경우 사용 가능한 가장 가까운 위치를 선택합니다.

  • SERVER_ID: 서버의 고유 ID입니다. 소문자로 시작하고 소문자나 숫자로 끝나야 합니다. 소문자, 숫자, 하이픈을 포함할 수 있습니다. goog 프리픽스로 시작하거나 google 문자열을 포함할 수 없습니다. 여기에는 g00gle와 같이 철자가 유사한 경우도 포함됩니다. 최대 길이는 30자(영문 기준)입니다.
  • CIDR_BLOCK: 서버에 액세스할 수 있는 CIDR 블록입니다. 예를 들면 192.0.2.0/24입니다. 값을 하나 이상 제공해야 하며 최대 500개의 CIDR 블록을 제공할 수 있습니다. 모든 IP 주소의 연결을 허용하려면 0.0.0.0/0를 사용합니다.

HTTP 메서드 및 URL:

POST https://ftp.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION_ID/servers?serverId=SERVER_ID

JSON 요청 본문:

{
  "accessType": "EXTERNAL",
  "externalConfig": {
    "allowedCidrBlocks": [
      "CIDR_BLOCK"
      ]
  }
}

요청을 보내려면 다음 옵션 중 하나를 펼칩니다.

응답은 장기 실행 작업을 식별합니다.

서버가 생성되는 데 약 10분이 걸립니다.

클라이언트 라이브러리

외부 서버를 만들려면 액세스 유형을 외부로 설정하고 외부 액세스 구성을 제공합니다.

C#

Cloud FTP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud FTP 클라이언트 라이브러리를 참조하세요. 자세한 내용은 Cloud FTP C# API 참고 문서를 확인하세요.

Cloud FTP에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

using Google.Cloud.Ftp.V1;
using Google.LongRunning;
using System.Threading.Tasks;

public sealed partial class GeneratedCloudFtpClientSnippets
{
    /// <summary>Snippet for CreateServerAsync</summary>
    /// <remarks>
    /// This snippet has been automatically generated and should be regarded as a code template only.
    /// It will require modifications to work:
    /// - It may require correct/in-range values for request initialization.
    /// - It may require specifying regional endpoints when creating the service client as shown in
    ///   https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
    /// </remarks>
    public async Task CreateServerAsync()
    {
        // Create client
        CloudFtpClient cloudFtpClient = await CloudFtpClient.CreateAsync();
        // Initialize request argument(s)
        string parent = "projects/[PROJECT]/locations/[LOCATION]";
        Server server = new Server();
        string serverId = "";
        // Make the request
        Operation<Server, OperationMetadata> response = await cloudFtpClient.CreateServerAsync(parent, server, serverId);

        // Poll until the returned long-running operation is complete
        Operation<Server, OperationMetadata> completedResponse = await response.PollUntilCompletedAsync();
        // Retrieve the operation result
        Server result = completedResponse.Result;

        // Or get the name of the operation
        string operationName = response.Name;
        // This name can be stored, then the long-running operation retrieved later by name
        Operation<Server, OperationMetadata> retrievedResponse = await cloudFtpClient.PollOnceCreateServerAsync(operationName);
        // Check if the retrieved long-running operation has completed
        if (retrievedResponse.IsCompleted)
        {
            // If it has completed, then access the result
            Server retrievedResult = retrievedResponse.Result;
        }
    }
}

Go

Cloud FTP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud FTP 클라이언트 라이브러리를 참조하세요. 자세한 내용은 Cloud FTP Go API 참고 문서를 확인하세요.

Cloud FTP에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.


//go:build examples

package main

import (
	"context"

	ftp "cloud.google.com/go/ftp/apiv1"
	ftppb "cloud.google.com/go/ftp/apiv1/ftppb"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := ftp.NewCloudFtpRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &ftppb.CreateServerRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/ftp/apiv1/ftppb#CreateServerRequest.
	}
	op, err := c.CreateServer(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

Java

Cloud FTP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud FTP 클라이언트 라이브러리를 참조하세요. 자세한 내용은 Cloud FTP Java API 참고 문서를 확인하세요.

Cloud FTP에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

import com.google.api.core.ApiFuture;
import com.google.cloud.ftp.v1.CloudFtpClient;
import com.google.cloud.ftp.v1.CreateServerRequest;
import com.google.cloud.ftp.v1.LocationName;
import com.google.cloud.ftp.v1.Server;
import com.google.longrunning.Operation;

public class AsyncCreateServer {

  public static void main(String[] args) throws Exception {
    asyncCreateServer();
  }

  public static void asyncCreateServer() throws Exception {
    // This snippet has been automatically generated and should be regarded as a code template only.
    // It will require modifications to work:
    // - It may require correct/in-range values for request initialization.
    // - It may require specifying regional endpoints when creating the service client as shown in
    // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
    try (CloudFtpClient cloudFtpClient = CloudFtpClient.create()) {
      CreateServerRequest request =
          CreateServerRequest.newBuilder()
              .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
              .setServerId("serverId1379103678")
              .setServer(Server.newBuilder().build())
              .setRequestId("requestId693933066")
              .build();
      ApiFuture<Operation> future = cloudFtpClient.createServerCallable().futureCall(request);
      // Do something.
      Operation response = future.get();
    }
  }
}

Node.js

Cloud FTP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud FTP 클라이언트 라이브러리를 참조하세요. 자세한 내용은 Cloud FTP Node.js API 참고 문서를 확인하세요.

Cloud FTP에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

/**
 * This snippet has been automatically generated and should be regarded as a code template only.
 * It will require modifications to work.
 * It may require correct/in-range values for request initialization.
 * TODO(developer): Uncomment these variables before running the sample.
 */
/**
 *  Required. Value for parent.
 */
// const parent = 'abc123'
/**
 *  Required. A unique ID for the server. Must start with a lowercase letter,
 *  and end with a lowercase letter or number. Can contain lowercase letters,
 *  numbers, and hyphens. Maximum length is 30 characters.
 */
// const serverId = 'abc123'
/**
 *  Required. The resource being created
 */
// const server = {}
/**
 *  Optional. An optional request ID to identify requests. Specify a unique
 *  request ID so that if you must retry your request, the server will know to
 *  ignore the request if it has already been completed. The server will
 *  guarantee that for at least 60 minutes since the first request.
 *  For example, consider a situation where you make an initial request and the
 *  request times out. If you make the request again with the same request
 *  ID, the server can check if original operation with the same request ID
 *  was received, and if so, will ignore the second request. This prevents
 *  clients from accidentally creating duplicate commitments.
 *  The request ID must be a valid UUID with the exception that zero UUID is
 *  not supported (00000000-0000-0000-0000-000000000000).
 */
// const requestId = 'abc123'

// Imports the Ftp library
const {CloudFtpClient} = require('@google-cloud/ftp').v1;

// Instantiates a client
const ftpClient = new CloudFtpClient();

async function callCreateServer() {
  // Construct request
  const request = {
    parent,
    serverId,
    server,
  };

  // Run request
  const [operation] = await ftpClient.createServer(request);
  const [response] = await operation.promise();
  console.log(response);
}

callCreateServer();

PHP

Cloud FTP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud FTP 클라이언트 라이브러리를 참조하세요. 자세한 내용은 Cloud FTP PHP API 참고 문서를 확인하세요.

Cloud FTP에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

use Google\ApiCore\ApiException;
use Google\ApiCore\OperationResponse;
use Google\Cloud\Ftp\V1\Client\CloudFtpClient;
use Google\Cloud\Ftp\V1\CreateServerRequest;
use Google\Cloud\Ftp\V1\Server;
use Google\Cloud\Ftp\V1\Server\AccessType;
use Google\Rpc\Status;

/**
 * Creates a new Server in a given project and location.
 *
 * @param string $formattedParent  Value for parent. Please see
 *                                 {@see CloudFtpClient::locationName()} for help formatting this field.
 * @param string $serverId         A unique ID for the server. Must start with a lowercase letter,
 *                                 and end with a lowercase letter or number. Can contain lowercase letters,
 *                                 numbers, and hyphens. Maximum length is 30 characters.
 * @param int    $serverAccessType The access type of the Server.
 */
function create_server_sample(
    string $formattedParent,
    string $serverId,
    int $serverAccessType
): void {
    // Create a client.
    $cloudFtpClient = new CloudFtpClient();

    // Prepare the request message.
    $server = (new Server())
        ->setAccessType($serverAccessType);
    $request = (new CreateServerRequest())
        ->setParent($formattedParent)
        ->setServerId($serverId)
        ->setServer($server);

    // Call the API and handle any network failures.
    try {
        /** @var OperationResponse $response */
        $response = $cloudFtpClient->createServer($request);
        $response->pollUntilComplete();

        if ($response->operationSucceeded()) {
            /** @var Server $result */
            $result = $response->getResult();
            printf('Operation successful with response data: %s' . PHP_EOL, $result->serializeToJsonString());
        } else {
            /** @var Status $error */
            $error = $response->getError();
            printf('Operation failed with error data: %s' . PHP_EOL, $error->serializeToJsonString());
        }
    } catch (ApiException $ex) {
        printf('Call failed with message: %s' . PHP_EOL, $ex->getMessage());
    }
}

/**
 * Helper to execute the sample.
 *
 * This sample has been automatically generated and should be regarded as a code
 * template only. It will require modifications to work:
 *  - It may require correct/in-range values for request initialization.
 *  - It may require specifying regional endpoints when creating the service client,
 *    please see the apiEndpoint client configuration option for more details.
 */
function callSample(): void
{
    $formattedParent = CloudFtpClient::locationName('[PROJECT]', '[LOCATION]');
    $serverId = '[SERVER_ID]';
    $serverAccessType = AccessType::ACCESS_TYPE_UNSPECIFIED;

    create_server_sample($formattedParent, $serverId, $serverAccessType);
}

Python

Cloud FTP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud FTP 클라이언트 라이브러리를 참조하세요. 자세한 내용은 Cloud FTP Python API 참고 문서를 확인하세요.

Cloud FTP에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

# This snippet has been automatically generated and should be regarded as a
# code template only.
# It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
#   client as shown in:
#   https://googleapis.dev/python/google-api-core/latest/client_options.html
from google.cloud import ftp_v1


def sample_create_server():
    # Create a client
    client = ftp_v1.CloudFtpClient()

    # Initialize request argument(s)
    server = ftp_v1.Server()
    server.access_type = "INTERNAL"

    request = ftp_v1.CreateServerRequest(
        parent="parent_value",
        server_id="server_id_value",
        server=server,
    )

    # Make the request
    operation = client.create_server(request=request)

    print("Waiting for operation to complete...")

    response = operation.result()

    # Handle the response
    print(response)

Ruby

Cloud FTP용 클라이언트 라이브러리를 설치하고 사용하는 방법은 Cloud FTP 클라이언트 라이브러리를 참조하세요. 자세한 내용은 Cloud FTP Ruby API 참고 문서를 확인하세요.

Cloud FTP에 인증하려면 애플리케이션 기본 사용자 인증 정보를 설정합니다. 자세한 내용은 로컬 개발 환경의 인증 설정을 참조하세요.

require "google/cloud/ftp/v1"

##
# Snippet for the create_server call in the CloudFtp service
#
# This snippet has been automatically generated and should be regarded as a code
# template only. It will require modifications to work:
# - It may require correct/in-range values for request initialization.
# - It may require specifying regional endpoints when creating the service
# client as shown in https://cloud.google.com/ruby/docs/reference.
#
# This is an auto-generated example demonstrating basic usage of
# Google::Cloud::Ftp::V1::CloudFtp::Rest::Client#create_server.
#
def create_server
  # Create a client object. The client can be reused for multiple calls.
  client = Google::Cloud::Ftp::V1::CloudFtp::Rest::Client.new

  # Create a request. To set request fields, pass in keyword arguments.
  request = Google::Cloud::Ftp::V1::CreateServerRequest.new

  # Call the create_server method.
  result = client.create_server request

  # The returned object is of type Gapic::Operation. You can use it to
  # check the status of an operation, cancel it, or wait for results.
  # Here is how to wait for a response.
  result.wait_until_done! timeout: 60
  if result.response?
    p result.response
  else
    puts "No response received."
  end
end

다음 단계