Firebase용 Cloud Storage를 사용하면 이미지와 동영상 등 사용자 제작 콘텐츠를 업로드 및 공유하여 앱에 리치 미디어 콘텐츠를 빌드할 수 있습니다. 데이터는 고가용성과 글로벌 중복성을 갖춘 엑사바이트급 객체 스토리지 솔루션인 Google Cloud Storage 버킷에 저장됩니다. Firebase용 Cloud Storage를 이용하면 이러한 파일을 휴대기기 및 웹브라우저에서 직접 안전하게 업로드할 수 있으며, 네트워크가 불안정해도 문제가 없습니다.
기본 버킷의 Firebase Security Rules를 구성합니다. 개발 중에 공개 액세스 규칙을 설정하는 것이 좋습니다.
완료를 클릭합니다.
이제 Firebase Console의 Cloud Storage파일 탭에서 버킷을 볼 수 있습니다. 기본 버킷 이름 형식은 PROJECT_ID.firebasestorage.app입니다.
공개 액세스 설정
Firebase용 Cloud Storage에서 제공하는 선언적 규칙 언어로 데이터 구조화 방법, 색인 생성 방법, 데이터를 읽거나 쓸 수 있는 시기를 정의할 수 있습니다. 기본적으로 Cloud Storage에 대한 읽기 및 쓰기 액세스는 인증된 사용자만 데이터를 읽거나 쓸 수 있도록 제한됩니다. Firebase 인증을 설정하지 않고 시작하려면 공개 액세스 규칙을 구성하면 됩니다.
이렇게 하면 앱을 사용하지 않는 사람을 포함하여 모두에게 Cloud Storage가 공개되므로 인증을 설정할 때 Cloud Storage를 다시 제한해야 합니다.
Flutter 프로젝트 디렉터리에서 flutterfire configure를 실행합니다. 이렇게 하면 앱의 코드베이스에 있는 Firebase 구성 파일(firebase_options.dart)이 기본 Cloud Storage 버킷의 이름을 갖도록 업데이트됩니다.
FirebaseStorage 인스턴스를 만들어 Cloud Storage 버킷에 액세스합니다.
finalstorage=FirebaseStorage.instance;// Alternatively, explicitly specify the bucket name URL.// final storage = FirebaseStorage.instanceFor(bucket: "gs://<var>BUCKET_NAME</var>");
첫 번째 사용 사례는 사용자가 전 세계에 분포해 있고 사용자와 가까운 곳에 데이터를 저장하려는 경우에 적합합니다. 예를 들어 미국, 유럽, 아시아에 버킷을 만들고
해당 리전 사용자의 데이터를 저장하면 지연 시간을 줄일 수 있습니다.
두 번째 사용 사례는 데이터의 액세스 패턴이 다양할 때 유용합니다.
예를 들어 사진과 같은 자주 액세스하는 콘텐츠를 저장하는 멀티 리전 또는 리전 버킷을 설정하고, 사용자 백업과 같은 자주 액세스하지 않는 콘텐츠를 저장하는 Nearline 또는 Coldline 버킷을 설정할 수 있습니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["\u003cbr /\u003e\n\nCloud Storage for Firebase lets you upload and share user generated content, such\nas images and video, which allows you to build rich media content into your\napps. Your data is stored in a\n[Google Cloud Storage](//cloud.google.com/storage) bucket --- an\nexabyte scale object storage solution with high availability and global\nredundancy. Cloud Storage for Firebase lets you securely upload these files\ndirectly from mobile devices and web browsers, handling spotty networks with\nease.\n\nBefore you begin\n\n1. If you haven't already, make sure you've completed the\n [getting started guide for Flutter apps](/docs/flutter/setup).\n This includes:\n\n - Creating a Firebase project.\n\n - Installing and initializing the Firebase SDKs for Flutter.\n\n2. Make sure your Firebase project is on the [pay-as-you-go Blaze pricing plan](/pricing). If\n you're new to Firebase and Google Cloud, check if you're eligible for a\n [$300 credit](/support/faq#pricing-free-trial).\n\n| **Important** : The following changes to pricing plan requirements are happening for Cloud Storage for Firebase. Learn more in the [FAQs](/docs/storage/faqs-storage-changes-announced-sept-2024).\n|\n| - **Starting\n| October 30, 2024** , your Firebase project must be on the [pay-as-you-go Blaze pricing plan](/pricing) to provision a new Cloud Storage for Firebase default bucket. The bucket can optionally use the [\"Always Free\" tier](https://cloud.google.com/storage/pricing#cloud-storage-always-free) for Google Cloud Storage.\n| - **Starting\n| October 1, 2025** , your Firebase project must be on the [pay-as-you-go Blaze pricing plan](/pricing) to maintain access to your default bucket and all other Cloud Storage resources. Any `*.appspot.com` default bucket will maintain its current no-cost level of usage even on the Blaze pricing plan.\n\nCreate a default Cloud Storage bucket\n\n1. From the navigation pane of the [Firebase console](//console.firebase.google.com/), select **Storage**.\n\n If your project is not yet on the pay-as-you-go Blaze pricing plan, then you'll be\n prompted to upgrade your project.\n2. Click **Get started**.\n\n3. Select a [location](/docs/storage/locations) for your default bucket.\n\n - Buckets in `US-CENTRAL1`, `US-EAST1`, and `US-WEST1` can take advantage of the\n [\"Always Free\" tier](https://cloud.google.com/storage/pricing#cloud-storage-always-free) for Google Cloud Storage.\n Buckets in all other locations follow\n [Google Cloud Storage pricing and usage](https://cloud.google.com/storage/pricing).\n\n - If you'd like, you can later\n [create multiple buckets](#use_multiple_storage_buckets), each with its\n own location.\n\n4. Configure the Firebase Security Rules for your default bucket. During development,\n consider [setting up your rules for public access](#set_up_public_access).\n\n5. Click **Done**.\n\nYou can now view the bucket in the\n[Cloud Storage *Files* tab](https://console.firebase.google.com/project/_/storage/)\nof the Firebase console. Your default bucket name format is\n\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.firebasestorage.app`.\n| **Note:** Starting October 30, 2024, all new default Cloud Storage buckets have the name format \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.firebasestorage.app`. Any default buckets created *before* that date have the name format \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e`.appspot.com`. Learn more in the [FAQs](/docs/storage/faqs-storage-changes-announced-sept-2024#all-changes-default-storage-bucket).\n\nSet up public access\n\nCloud Storage for Firebase provides a declarative rules language that lets you\ndefine how your data should be structured, how it should be indexed, and when\nyour data can be read from and written to. By default, read and write access to\nCloud Storage is restricted so only authenticated users can read or write\ndata. To get started without setting up [Firebase Authentication](/docs/auth), you can\n[configure your rules for public access](/docs/storage/security/rules-conditions#public).\n\nThis does make Cloud Storage open to anyone, even people not using your\napp, so be sure to restrict your Cloud Storage again when you set up\nauthentication.\n\nAdd the Cloud Storage SDK to your app\n\n1. From the root of your Flutter project, run the following command to install\n the plugin:\n\n flutter pub add firebase_storage\n\n2. Once complete, rebuild your Flutter application:\n\n flutter run\n\n3. Import the plugin in your Dart code:\n\n import 'package:firebase_storage/firebase_storage.dart';\n\nSet up Cloud Storage\n\n1. Run `flutterfire configure` from your Flutter project directory. This\n updates the Firebase config file (`firebase_options.dart`) in your app's\n codebase so that it has the name of your default Cloud Storage bucket.\n\n | **Note:** Alternatively to updating your config file, you can explicitly specify the bucket name when you create an instance of `FirebaseStorage` (see next step). You can find the bucket name in the [Cloud Storage *Files* tab](https://console.firebase.google.com/project/_/storage/) of the Firebase console.\n2. Access your Cloud Storage bucket by creating an instance of\n `FirebaseStorage`:\n\n final storage = FirebaseStorage.instance;\n\n // Alternatively, explicitly specify the bucket name URL.\n // final storage = FirebaseStorage.instanceFor(bucket: \"gs://\u003cvar\u003eBUCKET_NAME\u003c/var\u003e\");\n\nYou're ready to start using Cloud Storage!\n\nNext step? Learn how to\n[create a Cloud Storage reference](/docs/storage/flutter/create-reference).\n\nAdvanced setup\n\nThere are a few use cases that require additional setup:\n\n- Using Cloud Storage buckets in [multiple geographic regions](//cloud.google.com/storage/docs/bucket-locations)\n- Using Cloud Storage buckets in [different storage classes](//cloud.google.com/storage/docs/storage-classes)\n- Using Cloud Storage buckets with multiple authenticated users in the same app\n\nThe first use case is perfect if you have users across the world, and want to\nstore their data near them. For instance, you can create buckets in the US,\nEurope, and Asia to store data for users in those regions to reduce latency.\n\nThe second use case is helpful if you have data with different access patterns.\nFor instance: you can set up a multi-regional or regional bucket that stores\npictures or other frequently accessed content, and a nearline or coldline bucket\nthat stores user backups or other infrequently accessed content.\n\nIn either of these use cases, you'll want to\n[use multiple Cloud Storage buckets](#use_multiple_storage_buckets).\n\nThe third use case is useful if you're building an app, like Google Drive, which\nlets users have multiple logged in accounts (for instance, a personal account\nand a work account). You can\n[use a custom Firebase App](#use_a_custom_firebaseapp)\ninstance to authenticate each additional account.\n\nUse multiple Cloud Storage buckets\n\nIf you want to use a Cloud Storage bucket other than the default provided above,\nor use multiple Cloud Storage buckets in a single app, you can create an instance\nof `FirebaseStorage` that references your custom bucket: \n\n // Get a non-default Storage bucket\n final storage = FirebaseStorage.instanceFor(bucket: \"gs://my-custom-bucket\");\n\nWorking with imported buckets\n\nWhen importing an existing Cloud Storage bucket into Firebase, you'll\nhave to grant Firebase the ability to access these files using the\n`gsutil` tool, included in the\n[Google Cloud SDK](//cloud.google.com/sdk/docs/): \n\n gsutil -m acl ch -r -u service-PROJECT_NUMBER@gcp-sa-firebasestorage.iam.gserviceaccount.com gs://YOUR-CLOUD-STORAGE-BUCKET\n\nYou can find your project number as described in the [introduction to\nFirebase projects](/docs/projects/learn-more#project-number).\n\nThis does not affect newly created buckets, as those have the default access\ncontrol set to allow Firebase. This is a temporary measure, and will be\nperformed automatically in the future.\n\nUse a custom Firebase App\n\nIf you're building a more complicated app using a custom `FirebaseApp`, you can\ncreate an instance of `FirebaseStorage` initialized with that app: \n\n // Use a non-default App\n final storage = FirebaseStorage.instanceFor(app: customApp);\n\nNext steps\n\n- Prepare to launch your app:\n - Enable [App Check](/docs/app-check) to help ensure that only your apps can access your storage buckets.\n - Set up [budget alerts](/docs/projects/billing/avoid-surprise-bills#set-up-budget-alert-emails) for your project in the Google Cloud Console.\n - Monitor the [*Usage and billing* dashboard](//console.firebase.google.com/project/_/usage) in the Firebase console to get an overall picture of your project's usage across multiple Firebase services. You can also visit the [Cloud Storage *Usage* dashboard](//console.firebase.google.com/project/_/storage/usage) for more detailed usage information.\n - Review the [Firebase launch checklist](/support/guides/launch-checklist)."]]