참고: Python 2.7은 2024년 1월 31일 지원 종료됩니다. 기존 Python 2.7 애플리케이션을 계속 실행하고 트래픽을 받을 수 있습니다. 그러나 지원 종료 날짜 이후에는 해당 런타임을 사용하는 애플리케이션의 재배포를 App Engine에서 차단할 수 있습니다. 지원되는 최신 Python 버전으로 마이그레이션하는 것이 좋습니다.
Cloud Storage 버킷을 사용하여 영화, 이미지, 기타 정적 콘텐츠와 같은 파일을 저장하고 제공할 수 있습니다. 이 문서에서는 Cloud Storage용 App Engine 클라이언트 라이브러리를 사용하도록 환경을 설정하는 방법을 설명합니다.
프로젝트 설정
Google Cloud 프로젝트를 만들고 App Engine에서 Python 2 앱이 구조화되는 방식을 알아봅니다. 애플리케이션에서 사용할 프로젝트 ID를 기록해 둡니다.
Cloud Storage 버킷 활성화
Cloud Storage를 사용하려면 1개 이상의 버킷을 활성화해야 합니다. 저장용량 중 첫 5GB를 무료로 제공하는 기본 버킷을 사용할 수 있습니다. 다른 Cloud Storage 버킷을 활성화하고 사용할 수 있습니다. 기본 버킷에는 처음 5GB의 무료 스토리지가 포함되어 있습니다. 기본 버킷에는 Cloud Storage I/O 작업을 위한 무료 할당량도 포함되어 있습니다. 자세한 내용은 가격 책정, 할당량, 한도를 참조하세요.
앱의 기본 Cloud Storage 버킷을 활성화하려면 다음 단계를 따르세요.
프로젝트의 App Engine 설정 페이지에서 기본 Cloud Storage 버킷의 만들기를 클릭합니다. 이 버킷의 이름은 <project-id>.appspot.com 형식으로 되어 있습니다.
5GB 제한을 초과하는 저장용량이 필요할 경우 프로젝트에 결제를 사용 설정하여 유료 버킷으로 만들면 용량을 늘릴 수 있습니다. 5GB 제한을 초과하는 저장용량을 사용하면 요금이 청구됩니다.
--default_gcs_bucket_name [BUCKET_NAME] 플래그를 사용하여 dev_appserver.py를 실행합니다. 이때 [BUCKET_NAME]을 사용 중인 Cloud Storage 버킷의 이름으로 바꿉니다.
이 플래그는 애플리케이션이 file.DefaultBucketName(ctx)을 호출할 때 반환될 버킷을 제어합니다.
가격 책정, 할당량, 한도
App Engine의 클라이언트 라이브러리에서 Cloud Storage를 호출할 때는 대역폭 요금이 부과되지 않습니다. 하지만 작업 비용은 청구됩니다. 또한 라이브러리가 Cloud Storage와 상호작용하는 데 URL Fetch 서비스를 사용하므로 호출 수가 URL Fetch 할당량에 반영됩니다.
Cloud Storage는 유료 서비스이며 Cloud Storage 가격표에 따라 비용이 청구됩니다.
[[["이해하기 쉬움","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-08-19(UTC)"],[[["\u003cp\u003eCloud Storage buckets can be used to store and serve static content like movies and images, and this document explains how to set up the environment for using the App Engine client library for Cloud Storage.\u003c/p\u003e\n"],["\u003cp\u003eActivating a Cloud Storage bucket, such as the default bucket which offers 5GB of free storage, is necessary to use this feature.\u003c/p\u003e\n"],["\u003cp\u003eThe App Engine client library for Cloud Storage can be downloaded through \u003ccode\u003epip\u003c/code\u003e, Git, or a manual download from GitHub.\u003c/p\u003e\n"],["\u003cp\u003eWhen using the client library with the development app server, requests to read and write files are sent to an actual Cloud Storage bucket over the internet, requiring the \u003ccode\u003e--default_gcs_bucket_name\u003c/code\u003e flag.\u003c/p\u003e\n"],["\u003cp\u003eWhile there are no bandwidth charges, calls to Cloud Storage using the client library incur operations charges and contribute to the URL fetch quota.\u003c/p\u003e\n"]]],[],null,["# Setting Up Google Cloud Storage\n\nYou can use a Cloud Storage bucket\nto store and serve files, such as movies or images or other static content. This\ndocument describes how to set up your environment to use the App Engine client\nlibrary for Cloud Storage.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| python3\n|\n| /services/access). If you are updating to the App Engine Python 3 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/python-differences) to learn about your migration options for legacy bundled services.\n\nSetting up your project\n-----------------------\n\nCreate a Google Cloud project, and understand how Python 2 apps are\nstructured in App Engine. Write down and save your project ID for use\nwith your application.\n\nActivating a Cloud Storage bucket\n---------------------------------\n\nTo use Cloud Storage, you'll need to activate at least one bucket.\nYou might want to use the default bucket which provides the first 5GB of\nstorage for free. You can activate and use another Cloud Storage\nbucket. The default bucket includes\nthe first 5GB of storage for free. The default bucket\nalso includes a free quota for Cloud Storage I/O operations. See\n[Pricing, quotas, and limits](#pricing_quotas_and_limits)\nfor more details.\n\nTo activate the default Cloud Storage bucket for your app:\n\n1. Click **Create** under *Default Cloud Storage Bucket* in the\n [App Engine settings](https://console.cloud.google.com/appengine/settings) page for your project.\n Notice the name of this bucket: it is in the form `\u003cproject-id\u003e.appspot.com`.\n\n2. If you need more storage than the 5GB limit, you can\n increase this by [enabling billing](https://console.cloud.google.com/billing) for your project,\n making this a paid bucket. You will be charged for storage over the 5GB limit.\n\nIf you want to activate one or more paid buckets, follow the instructions under\n[Creating a bucket](/storage/docs/cloud-console#_creatingbuckets) to activate\nthem.\n| **Note:** When you create a default bucket, you also get a staging bucket with the same name except that `staging.` is prepended to it. You can use this staging bucket for temporary files used for staging and test purposes; it also has a 5 GB limit, but it is automatically emptied on a weekly basis.\n\n### Setting bucket and object permissions\n\nYou can find information on allowing your app's service account or other users\naccess the storage bucket and its contents in\n[Setting bucket permissions](/storage/docs/cloud-console#_bucketpermission) and\n[Setting object permissions](/storage/docs/cloud-console#_permissions).\n\nDownloading the client library\n------------------------------\n\nYou can download the App Engine client library for Cloud Storage using popular tools\nlike [`pip`](https://pip.pypa.io/en/latest/index.html) or\n[Git](http://git-scm.com). Alternatively, you can download\nthe library manually from GitHub. Choose your preferred method: \n\n### Git\n\nIf you have Git installed, you can clone the GitHub repository for\nApp Engine's Cloud Storage client library as follows: \n\n git clone https://github.com/googleapis/python-storage.git\n\n### pip\n\nYou can use `pip` to install the Cloud Storage\nclient library as follows: \n\n pip install google-cloud-storage\n\n| **Important:** The `pip` command downloads and installs the [PyPi distribution](https://pypi.org/project/google-cloud-storage/) of the Cloud Storage client library. This distribution does not include demo or test code. To obtain these files, clone or download the library's GitHub repository.\n\n### Manual download\n\nYou can download a ZIP file containing the App Engine client library for\nCloud Storage from GitHub:\n\n[App Engine client library for Cloud\nStorage on GitHub](https://github.com/googleapis/python-storage/archive/refs/heads/main.zip)\n\nInstall the library into the directory you are using for third-party libraries,\nsuch as `lib`. For more information, see [Using third-party\nlibraries](/appengine/docs/legacy/standard/python/tools/using-libraries-python-27).\n\nUsing the client library with the development app server\n--------------------------------------------------------\n\nYou can use the client library with the development server. However because\nthere is no local emulation of Cloud Storage, all requests to read and write\nfiles must be sent over the Internet to an actual Cloud Storage bucket.\n\nTo use the client library with the development app server:\n\n1. [Activate a Cloud Storage bucket](#activating_a_cloud_storage_bucket).\n\n2. Run `dev_appserver.py` with the flag `--default_gcs_bucket_name [BUCKET_NAME]`,\n replacing `[BUCKET_NAME]` with the name of the Cloud Storage bucket you are\n using.\n\n This flag controls the bucket that will be returned when your application\n calls `file.DefaultBucketName(ctx)`.\n\nPricing, quotas, and limits\n---------------------------\n\nThere are no bandwidth charges associated with making calls to Cloud Storage from\nApp Engine's client library. However, there are\n[operations charges](/storage/pricing#operations-pricing).\nIn addition, the calls count against your\n[URL fetch quota](/appengine/docs/quotas#UrlFetch)\nas the library uses the URL Fetch service to interact with Cloud Storage.\n\nNotice that Cloud Storage is a pay-to-use service;\nyou will be charged according to the Cloud Storage [price sheet](/storage/pricing).\n\nAlternative ways to access Cloud Storage\n----------------------------------------\n\nInstead of using the client library, you could use the following:\n\n- [Cloud Storage Browser](https://console.cloud.google.com/storage/browser) in the Google Cloud console, which is useful for uploading objects quickly.\n- [gsutil](/storage/docs/gsutil), which is a command-line tool for working with files in Cloud Storage.\n\nWhat's next\n-----------\n\n- Visit the [API Reference documentation](/appengine/docs/legacy/standard/python/googlecloudstorageclient/functions).\n- Learn how to [read and write to Cloud Storage](/appengine/docs/legacy/standard/python/googlecloudstorageclient/read-write-to-cloud-storage) with the App Engine client library for Cloud Storage.\n- Review the [App Engine and Google Cloud Storage sample](/appengine/docs/legacy/standard/python/googlecloudstorageclient/app-engine-cloud-storage-sample).\n- View the complete set of [Cloud Storage documentation](/storage/docs), including additional samples and tutorials."]]