Installing Custom Plugins

This page describes how to install custom plugins in your Cloud Composer environment.

You can install custom plugins, such as custom in-house Apache Airflow operators, hooks, sensors, or interfaces, in your Cloud Composer environment.

When you create an environment, Cloud Composer creates a Cloud Storage bucket and associates the bucket with your environment. You use the plugins folder in the associated bucket to install custom plugins. To determine the Cloud Storage bucket attached to your environment, see Adding and Updating DAGs.

Before you begin

  • The following permission is required to add and update plugins in the Cloud Storage bucket for the Cloud Composer environment: storage.objectAdmin. For more information, see Cloud Composer Access Control.

  • This installation method applies only to Airflow plugins. For example, you cannot use this method to install common Python modules or other libraries.

  • Plugins must conform to the Airflow plugins template guidelines.

Installing a plugin

To install a custom plugin into your Cloud Composer environment, copy the plugin code to the plugins folder in the Cloud Storage bucket attached to your Cloud Composer environment.

To install a plugin, choose an option:

gcloud composer environments storage plugins import --environment ENVIRONMENT_NAME \
    --location LOCATION \
    --source PATH_TO_LOCAL_FILE \
    --destination PATH_IN_SUBFOLDER

where:

  • ENVIRONMENT_NAME is the name of the environment.
  • LOCATION is the Compute Engine region where the environment is located.
  • PATH_TO_LOCAL_FILE is the path of the file to upload.
  • --destination is an option to upload a plugin to a subfolder in the plugins folder. PATH_IN_SUBFOLDER is the subfolder path such as foo/bar.

Viewing a list of plugins

To view a list of plugins, choose an option:

gcloud composer environments storage plugins list --environment ENVIRONMENT_NAME \
    --location LOCATION

Deleting a plugin

To delete a plugin from your Cloud Composer environment, delete the plugin code from the plugins folder in the Cloud Storage bucket attached to your Cloud Composer environment.

To delete a plugin, choose an option:

gcloud composer environments storage plugins delete --environment ENVIRONMENT_NAME \
    --location LOCATION PLUGIN_TO_DELETE

Downloading plugins

To download plugins, choose an option:

gcloud composer environments storage plugins export --environment ENVIRONMENT_NAME \
    --location LOCATION \
    --destination PATH_TO_LOCAL_DESTINATION \
    --source PATH_IN_FOLDER

where:

  • ENVIRONMENT_NAME is the name of the environment.
  • LOCATION is the Compute Engine region where the environment is located.
  • PATH_TO_LOCAL_DESTINATION is the destination for downloaded file.
  • --source is an option to download only one plugin. PATH_IN_FOLDER is the folder path such as /foo.

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Cloud Composer