A 15 de setembro de 2026, todos os ambientes do Cloud Composer 1 e do Cloud Composer 2 versão 2.0.x vão atingir o fim da vida útil planeado e não vai poder usá-los. Recomendamos que planeie a migração para o Cloud Composer 3.
Esta página explica como desativar ou ativar o acesso à Internet ao instalar pacotes PyPI no seu ambiente.
Para ver informações sobre a instalação de pacotes e a configuração de origens personalizadas (como um repositório na sua rede VPC), consulte o artigo Instale dependências do Python.
Se quiser ativar o acesso à sua rede VPC a partir de um ambiente,
consulte o artigo Ligue um ambiente a uma rede VPC. Por exemplo, pode configurar a sua rede VPC para que o seu ambiente possa aceder à Internet através dela.
Acerca do acesso à Internet ao instalar pacotes PyPI
Por predefinição, o seu ambiente do Cloud Composer 3 pode aceder à Internet quando instala pacotes PyPI.
Agora, é possível instalar pacotes de origens públicas e privadas ao mesmo tempo. Isto não era possível no Cloud Composer 2.
Esta opção de configuração do ambiente é independente do tipo de rede do ambiente (IP privado ou público). Por exemplo, pode instalar pacotes do Python Package Index num ambiente de IP privado.
Pode definir esta opção de configuração quando criar um ambiente e é possível alterá-la para um ambiente existente.
Desative ou ative o acesso à Internet ao instalar pacotes PyPI
Consola
Na Google Cloud consola, aceda à página Ambientes.
[[["Fácil de entender","easyToUnderstand","thumb-up"],["Meu problema foi resolvido","solvedMyProblem","thumb-up"],["Outro","otherUp","thumb-up"]],[["Difícil de entender","hardToUnderstand","thumb-down"],["Informações incorretas ou exemplo de código","incorrectInformationOrSampleCode","thumb-down"],["Não contém as informações/amostras de que eu preciso","missingTheInformationSamplesINeed","thumb-down"],["Problema na tradução","translationIssue","thumb-down"],["Outro","otherDown","thumb-down"]],["Última atualização 2025-08-28 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,["\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- 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\nConsole\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\ngcloud\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\nAPI\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\nTerraform\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- [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)."]]