Pada 15 September 2026, semua lingkungan Cloud Composer 1 dan Cloud Composer 2 versi 2.0.x akan mencapai akhir masa pakainya yang direncanakan, dan Anda tidak akan dapat menggunakannya. Sebaiknya rencanakan migrasi ke Cloud Composer 3.
Halaman ini menjelaskan cara menonaktifkan atau mengaktifkan akses internet saat menginstal
paket PyPI di lingkungan Anda.
Untuk informasi tentang cara menginstal paket dan mengonfigurasi sumber kustom
(seperti repositori di jaringan VPC Anda), lihat
Menginstal dependensi Python.
Jika Anda ingin mengaktifkan akses ke jaringan VPC dari lingkungan, lihat Menghubungkan lingkungan ke jaringan VPC. Misalnya, Anda dapat mengonfigurasi jaringan VPC agar lingkungan Anda
dapat mengakses internet melalui jaringan tersebut.
Secara default, lingkungan Cloud Composer 3 Anda
dapat mengakses internet saat menginstal paket PyPI.
Paket kini dapat diinstal dari sumber publik dan pribadi secara
bersamaan. Hal ini tidak dapat dilakukan di Cloud Composer 2.
Opsi konfigurasi lingkungan ini tidak bergantung pada jenis jaringan
lingkungan (IP Pribadi atau Publik). Misalnya, Anda dapat menginstal
paket dari Python Package Index di
lingkungan IP Pribadi.
Anda dapat menetapkan opsi konfigurasi ini saat
membuat lingkungan dan opsi ini dapat diubah
untuk lingkungan yang ada.
Menonaktifkan atau mengaktifkan akses internet saat menginstal paket PyPI
Konsol
Di Google Cloud console, buka halaman Environments.
[[["Mudah dipahami","easyToUnderstand","thumb-up"],["Memecahkan masalah saya","solvedMyProblem","thumb-up"],["Lainnya","otherUp","thumb-up"]],[["Sulit dipahami","hardToUnderstand","thumb-down"],["Informasi atau kode contoh salah","incorrectInformationOrSampleCode","thumb-down"],["Informasi/contoh yang saya butuhkan tidak ada","missingTheInformationSamplesINeed","thumb-down"],["Masalah terjemahan","translationIssue","thumb-down"],["Lainnya","otherDown","thumb-down"]],["Terakhir diperbarui pada 2025-08-29 UTC."],[[["\u003cp\u003eCloud Composer 3 environments, by default, have internet access enabled for installing PyPI packages, allowing them to be installed from both public and private sources.\u003c/p\u003e\n"],["\u003cp\u003eInternet access for installing PyPI packages can be toggled on or off regardless of whether the environment uses a Private or Public IP network.\u003c/p\u003e\n"],["\u003cp\u003eYou can enable or disable internet access during environment creation or modify the setting for existing Cloud Composer 3 environments.\u003c/p\u003e\n"],["\u003cp\u003eThe internet access setting can be configured through the Google Cloud console, gcloud CLI, API, or Terraform, using the \u003ccode\u003eenable_private_builds_only\u003c/code\u003e parameter or \u003ccode\u003eAccess to public PyPI package repositories\u003c/code\u003e option.\u003c/p\u003e\n"]]],[],null,["# Configure access to the internet when installing PyPI packages\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\n**Cloud Composer 3** \\| Cloud Composer 2 \\| Cloud Composer 1\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\nThis page explains how to disable or enable internet access when installing\nPyPI packages in your environment.\n\nFor information about installing packages and configuring custom sources\n(such as a repository in your VPC network), see\n[Install Python dependencies](/composer/docs/composer-3/install-python-dependencies).\n\nIf you want to enable access to your VPC network from an environment,\nsee [Connect an environment to a VPC network](/composer/docs/composer-3/connect-vpc-network). For\nexample, you can configure your VPC network so that your environment\ncan access the internet through it.\n\nIf you want to change your environment to Private IP, see\n[Change environment networking type (Private or Public IP)](/composer/docs/composer-3/change-networking-type).\n\nAbout the internet access when installing PyPI packages\n-------------------------------------------------------\n\n- By default, your Cloud Composer 3 environment\n **can access the internet when installing PyPI packages**.\n\n- Packages can now be installed from both public and private sources at the\n same time. This wasn't possible in Cloud Composer 2.\n\n- This environment configuration option is independent of the environment's\n networking type (Private or Public IP). For example, you can install\n packages from [Python Package Index](https://pypi.org) in a\n Private IP environment.\n\n- You can set this configuration option when you\n [create an environment](/composer/docs/composer-3/create-environments) and it's possible to change this option\n for an existing environment.\n\nDisable or enable internet access when installing PyPI packages\n---------------------------------------------------------------\n\n### Console\n\n1. In the Google Cloud console, go to the **Environments** page.\n\n [Go to Environments](https://console.cloud.google.com/composer/environments)\n2. In the list of environments, click the name of your environment.\n The **Environment details** page opens.\n\n3. Go to the **Environment configuration** tab.\n\n4. In the **Network configuration** section, find the\n **Access to public PyPI package repositories** item and click **Edit**.\n\n5. In the **Access to public PyPI package repositories** dialog:\n\n - To enable internet access, select\n **Allow installation of packages from public internet repositories**.\n\n - To disable internet access, select\n **Don't allow installation of packages from public internet repositories**.\n\n6. Click **Save**.\n\n### gcloud\n\nThe following Google Cloud CLI arguments specify internet access\nconfiguration when installing PyPI packages:\n\n- `--disable-private-builds-only` **enables** internet access when installing\n packages (default).\n\n- `--enable-private-builds-only` **disables** internet access when installing\n packages.\n\nTo enable internet access when installing packages, run the following\nGoogle Cloud CLI command: \n\n gcloud beta composer environments update \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --disable-private-builds-only\n\nTo disable internet access when installing packages, run the following\nGoogle Cloud CLI command: \n\n gcloud beta composer environments update \u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e \\\n --location \u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e \\\n --enable-private-builds-only\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of the environment\n- `LOCATION`: the region where the environment is located\n\nExample (disable internet access): \n\n gcloud beta composer environments update example-environment \\\n --location us-central1 \\\n --enable-private-builds-only\n\n### API\n\n1. Create an [`environments.patch`](/composer/docs/reference/rest/v1beta1/projects.locations.environments/patch) API request.\n\n2. In this request:\n\n 1. In the `updateMask` parameter, specify\n the `config.private_environment_config.enable_private_builds_only`\n mask.\n\n 2. In the request body, in the `enablePrivateBuildsOnly` field, set the\n required value:\n\n - `false`: enable internet access when installing PyPI packages (default).\n - `true`: disable internet access when installing PyPI packages.\n\nExample (disable internet access): \n\n // PATCH https://composer.googleapis.com/v1beta1/projects/example-project/\n // locations/us-central1/environments/example-environment?updateMask=\n // config.private_environment_config.enable_private_builds_only\n\n \"config\": {\n \"privateEnvironmentConfig\": {\n \"enablePrivateBuildsOnly\": true\n }\n }\n\n### Terraform\n\nThe `enable_private_builds_only` field in the `config` block specifies\ninternet access configuration when installing PyPI packages:\n\n- `false` or omitted: **enables** internet access when installing\n packages (default).\n\n- `true`: **disables** internet access when installing packages.\n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"\u003cvar translate=\"no\"\u003eENVIRONMENT_NAME\u003c/var\u003e\"\n region = \"\u003cvar translate=\"no\"\u003eLOCATION\u003c/var\u003e\"\n\n config {\n enable_private_builds_only = \u003cvar translate=\"no\"\u003e\u003cspan class=\"devsite-syntax-err\"\u003ePRIVATE_BUILDS_MODE\u003c/span\u003e\u003c/var\u003e\n }\n }\n\nReplace the following:\n\n- `ENVIRONMENT_NAME`: the name of your environment.\n- `LOCATION`: the region where the environment is located.\n- `PRIVATE_BUILDS_MODE`: whether the internet access is disabled when installing PyPI packages.\n\nExample (disable internet access): \n\n resource \"google_composer_environment\" \"example\" {\n provider = google-beta\n name = \"example-environment\"\n region = \"us-central1\"\n\n config {\n\n enable_private_builds_only = true\n\n ... other configuration parameters\n\n }\n\nWhat's next\n-----------\n\n- [Install Python dependencies](/composer/docs/composer-3/install-python-dependencies)\n- [Connect an environment to a VPC network](/composer/docs/composer-3/connect-vpc-network)\n- [Change environment networking type (Private or Public IP)](/composer/docs/composer-3/change-networking-type)."]]