> ## Documentation Index
> Fetch the complete documentation index at: https://prefect-bd373955-pytest-markdown.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Connect to external systems

> Prefect blocks package configuration storage, infrastructure, and secrets for use with deployments or flow scripts.

## About blocks

Prefect blocks store configuration and provide an interface for interacting with external systems.

Blocks expose methods that provide functionality specific to these systems.
For example, you can use blocks to:

* Download data from, or upload data to, an S3 bucket
* Query data from, or write data to, a database
* Send a message to a Slack channel.

Block types are Python classes with a UI webform for configuration.
Blocks are instantiation of these classes with specific values.

Configure blocks through Python code or through the UI.
Access blocks for use in Python code.

Block values are stored in Prefect Cloud or your self-hosted Prefect server instance.
You can share blocks with other users in your Prefect Cloud workspace.

To see block types available for configuration, use `prefect block type ls`
from the CLI or navigate to the **Blocks** page in the UI and click **+**.

![The block catalogue in the UI](https://mintlify.s3-us-west-1.amazonaws.com/prefect-bd373955-pytest-markdown/3.0rc/img/ui/block-library.png)

<Tip>
  **Blocks and parameters**

  Blocks are useful for sharing configuration across flow runs and between flows.

  For configuration that will change between flow runs, we recommend using [parameters](/3.0rc/develop/write-flows/#parameters).
</Tip>

## Prefect built-in blocks

Commonly used block types come built-in with Prefect.
You can create and use these block types through the UI and without installing any additional packages.

| Block                                                                                                                      | Slug                                                     | Description                                                                                       |
| -------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| [Azure](/3.0rc/concepts/filesystems/#azure)                                                                                | `azure`                                                  | Stores data as a file on Azure Data Lake and Azure Blob Storage.                                  |
| [Custom Webhook](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.CustomWebhookNotificationBlock)               | `custom-webhook`                                         | Calls custom webhooks.                                                                            |
| [Discord Webhook](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.DiscordWebhook)                              | `discord-webhook`                                        | Calls Discord webhooks.                                                                           |
| [GCS](/3.0rc/concepts/filesystems/#gcs)                                                                                    | `gcs`                                                    | Store data as a file on Google Cloud Storage.                                                     |
| [GitHub](/3.0rc/concepts/filesystems/#github)                                                                              | `github`                                                 | Interacts with files stored on public GitHub repositories.                                        |
| [Kubernetes Cluster Config](/3.0rc/api-ref/prefect/blocks/kubernetes/#prefect.blocks.kubernetes.KubernetesClusterConfig)   | <span class="no-wrap">`kubernetes-cluster-config`</span> | Stores configuration for interaction with Kubernetes clusters.                                    |
| [Local File System](/3.0rc/concepts/filesystems/#local-filesystem)                                                         | `local-file-system`                                      | Stores data as a file on a local file system.                                                     |
| [Mattermost Webhook](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.Mattermost)                               | `mattermost-webhook`                                     | Sends notifications through a provided Mattermost webhook.                                        |
| [Microsoft Teams Webhook](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.notifications.MicrosoftTeamsWebhook) | `ms-teams-webhook`                                       | Sends notifications through a provided Microsoft Teams webhook.                                   |
| [Opsgenie Webhook](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.notifications.OpsgenieWebhook)              | `opsgenie-webhook`                                       | Sends notifications through a provided Opsgenie webhook.                                          |
| [Pager Duty Webhook](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.notifications.PagerDutyWebHook)           | `pager-duty-webhook`                                     | Sends notifications through a provided PagerDuty webhook.                                         |
| [Remote File System](/3.0rc/concepts/filesystems/#remote-file-system)                                                      | `remote-file-system`                                     | Stores data as a file on any remote file system that supports `fsspec`.                           |
| [S3](/3.0rc/concepts/filesystems/#s3)                                                                                      | `s3`                                                     | Stores data as a file on AWS S3.                                                                  |
| [Secret](/3.0rc/api-ref/prefect/blocks/system/#prefect.blocks.system.Secret)                                               | `secret`                                                 | Stores a secret value. The value will be obfuscated when this block is logged or shown in the UI. |
| [Sendgrid Email](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.notifications.SendgridEmail)                  | `sendgrid-email`                                         | Sends notifications through Sendgrid email.                                                       |
| [Slack Webhook](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.notifications.SlackWebhook)                    | `slack-webhook`                                          | Sends notifications through a provided Slack webhook.                                             |
| [SMB](/3.0rc/concepts/filesystems/#smb)                                                                                    | `smb`                                                    | Stores data as a file on a SMB share.                                                             |
| [Twilio SMS](/3.0rc/api-ref/prefect/blocks/notifications/#prefect.blocks.notifications.TwilioSMS)                          | `twilio-sms`                                             | Sends notifications through Twilio SMS.                                                           |

<Warning>
  The `S3`, `Azure`, `GCS`, and `GitHub` blocks are deprecated in favor of the the corresponding `S3Bucket`,
  `AzureBlobStorageCredentials`, `GCSBucket`, and `GitHubRepository` blocks found in the
  [Prefect integration libraries](/integrations/).
  The JSON, DateTime, and String blocks are deprecated in favor of [Variables](/3.0rc/develop/variables/).
</Warning>

## Blocks in Prefect integration libraries

Some block types that appear in the UI can be created immediately, with the corresponding integration library installed for use.
For example, an AWS Secret block can be created, but not used until the [`prefect-aws` library](/integrations/prefect-aws/) is installed.

Anyone can create block types and optionally share them with the community.
Find available block types in many of the published [Prefect integrations libraries](/integrations/).
If a block type is not available in the UI, you can [register it](#register-blocks) through the CLI.

| Integration                                             | Block                                                                                                                                         | Slug                                   |
| ------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------- |
| [prefect-aws](/integrations/prefect-aws/)               | [ECS Task](/integrations/prefect-aws/ecs/#prefect_aws.ecs.ECSTask)                                                                            | `ecs-task`                             |
| [prefect-aws](/integrations/prefect-aws/)               | [MinIO Credentials](/integrations/prefect-aws/credentials/#prefect_aws.credentials.MinIOCredentials)                                          | `minio-credentials`                    |
| [prefect-aws](/integrations/prefect-aws/)               | [S3 Bucket](/integrations/prefect-aws/s3/#prefect_aws.s3.S3Bucket)                                                                            | `s3-bucket`                            |
| [prefect-azure](/integrations/prefect-azure/)           | [Azure Blob Storage Credentials](/integrations/prefect-azure/credentials/#prefect_azure.credentials.AzureBlobStorageCredentials)              | `azure-blob-storage-credentials`       |
| [prefect-azure](/integrations/prefect-azure/)           | [Azure Container Instance Credentials](/integrations/prefect-azure/credentials/#prefect_azure.credentials.AzureContainerInstanceCredentials)  | `azure-container-instance-credentials` |
| [prefect-azure](/integrations/prefect-azure/)           | [Azure Container Instance Job](/integrations/prefect-azure/container_instance/#prefect_azure.container_instance.AzureContainerInstanceJob)    | `azure-container-instance-job`         |
| [prefect-azure](/integrations/prefect-azure/)           | [Azure Cosmos DB Credentials](/integrations/prefect-azure/credentials/#prefect_azure.credentials.AzureCosmosDbCredentials)                    | `azure-cosmos-db-credentials`          |
| [prefect-azure](/integrations/prefect-azure/)           | [AzureML Credentials](/integrations/prefect-azure/credentials/#prefect_azure.credentials.AzureMlCredentials)                                  | `azureml-credentials`                  |
| [prefect-bitbucket](/integrations/prefect-bitbucket/)   | [BitBucket Credentials](/integrations/prefect-bitbucket/credentials/)                                                                         | `bitbucket-credentials`                |
| [prefect-bitbucket](/integrations/prefect-bitbucket/)   | [BitBucket Repository](/integrations/prefect-bitbucket/repository/)                                                                           | `bitbucket-repository`                 |
| [prefect-databricks](/integrations/prefect-databricks/) | [Databricks Credentials](/integrations/prefect-databricks/credentials/#prefect_databricks.credentials.DatabricksCredentials)                  | `databricks-credentials`               |
| [prefect-dbt](/integrations/prefect-dbt/)               | [dbt CLI BigQuery Target Configs](/integrations/prefect-dbt/cli/configs/bigquery/#prefect_dbt.cli.configs.bigquery.BigQueryTargetConfigs)     | `dbt-cli-bigquery-target-configs`      |
| [prefect-dbt](/integrations/prefect-dbt/)               | [dbt CLI Profile](/integrations/prefect-dbt/cli/credentials/#prefect_dbt.cli.credentials.DbtCliProfile)                                       | `dbt-cli-profile`                      |
| [prefect-dbt](/integrations/prefect-dbt/)               | [dbt Cloud Credentials](/integrations/prefect-dbt/cloud/credentials/#prefect_dbt.cloud.credentials.DbtCloudCredentials)                       | `dbt-cloud-credentials`                |
| [prefect-dbt](/integrations/prefect-dbt/)               | [dbt CLI Global Configs](/integrations/prefect-dbt/cli/configs/base/#prefect_dbt.cli.configs.base.GlobalConfigs)                              | `dbt-cli-global-configs`               |
| [prefect-dbt](/integrations/prefect-dbt/)               | [dbt CLI Postgres Target Configs](/integrations/prefect-dbt/cli/configs/postgres/#prefect_dbt.cli.configs.postgres.PostgresTargetConfigs)     | `dbt-cli-postgres-target-configs`      |
| [prefect-dbt](/integrations/prefect-dbt/)               | [dbt CLI Snowflake Target Configs](/integrations/prefect-dbt/cli/configs/snowflake/#prefect_dbt.cli.configs.snowflake.SnowflakeTargetConfigs) | `dbt-cli-snowflake-target-configs`     |
| [prefect-dbt](/integrations/prefect-dbt/)               | [dbt CLI Target Configs](/integrations/prefect-dbt/cli/configs/base/#prefect_dbt.cli.configs.base.TargetConfigs)                              | `dbt-cli-target-configs`               |
| [prefect-docker](/integrations/prefect-docker/)         | [Docker Host](/integrations/prefect-docker/host/)                                                                                             | `docker-host`                          |
| [prefect-docker](/integrations/prefect-docker/)         | [Docker Registry Credentials](/integrations/prefect-docker/credentials/)                                                                      | `docker-registry-credentials`          |
| [prefect-email](/integrations/prefect-email/)           | [Email Server Credentials](/integrations/prefect-email/credentials/)                                                                          | `email-server-credentials`             |
| [prefect-gcp](/integrations/prefect-gcp/)               | [BigQuery Warehouse](/integrations/prefect-gcp/bigquery/#prefect_gcp.bigquery.BigQueryWarehouse)                                              | `bigquery-warehouse`                   |
| [prefect-gcp](/integrations/prefect-gcp/)               | [GCP Cloud Run Job](/integrations/prefect-gcp/cloud_run/#prefect_gcp.cloud_run.CloudRunJob)                                                   | `cloud-run-job`                        |
| [prefect-gcp](/integrations/prefect-gcp/)               | [GCP Credentials](/integrations/prefect-gcp/credentials/#prefect_gcp.credentials.GcpCredentials)                                              | `gcp-credentials`                      |
| [prefect-gcp](/integrations/prefect-gcp/)               | [GcpSecret](/integrations/prefect-gcp/secret_manager/#prefect_gcp.secret_manager.GcpSecret)                                                   | `gcpsecret`                            |
| [prefect-gcp](/integrations/prefect-gcp/)               | [GCS Bucket](/integrations/prefect-gcp/cloud_storage/#prefect_gcp.cloud_storage.GcsBucket)                                                    | `gcs-bucket`                           |
| [prefect-gcp](/integrations/prefect-gcp/)               | [Vertex AI Custom Training Job](/integrations/prefect-gcp/aiplatform/#prefect_gcp.aiplatform.VertexAICustomTrainingJob)                       | `vertex-ai-custom-training-job`        |
| [prefect-github](/integrations/prefect-github/)         | [GitHub Credentials](/integrations/prefect-github/credentials/)                                                                               | `github-credentials`                   |
| [prefect-github](/integrations/prefect-github/)         | [GitHub Repository](/integrations/prefect-github/repository/)                                                                                 | `github-repository`                    |
| [prefect-gitlab](/integrations/prefect-gitlab/)         | [GitLab Credentials](/integrations/prefect-gitlab/credentials/)                                                                               | `gitlab-credentials`                   |
| [prefect-gitlab](/integrations/prefect-gitlab/)         | [GitLab Repository](/integrations/prefect-gitlab/repositories/)                                                                               | `gitlab-repository`                    |
| [prefect-kubernetes](/integrations/prefect-kubernetes/) | [Kubernetes Credentials](/integrations/prefect-kubernetes/credentials/)                                                                       | `kubernetes-credentials`               |
| [prefect-shell](/integrations/prefect-shell/)           | [Shell Operation](/integrations/prefect-shell/commands/)                                                                                      | `shell-operation`                      |
| [prefect-slack](/integrations/prefect-slack/)           | [Slack Credentials](/integrations/prefect-slack/credentials/#prefect_slack.credentials.SlackCredentials)                                      | `slack-credentials`                    |
| [prefect-slack](/integrations/prefect-slack/)           | [Slack Incoming Webhook](/integrations/prefect-slack/credentials/#prefect_slack.credentials.SlackWebhook)                                     | `slack-incoming-webhook`               |
| [prefect-snowflake](/integrations/prefect-snowflake/)   | [Snowflake Connector](/integrations/prefect-snowflake/database/#prefect_snowflake.database.SnowflakeConnector)                                | `snowflake-connector`                  |
| [prefect-snowflake](/integrations/prefect-snowflake/)   | [Snowflake Credentials](/integrations/prefect-snowflake/credentials/#prefect_snowflake.credentials.SnowflakeCredentials)                      | `snowflake-credentials`                |
| [prefect-sqlalchemy](/integrations/prefect-sqlalchemy/) | [Database Credentials](/integrations/prefect-sqlalchemy/credentials/#prefect_sqlalchemy.credentials.DatabaseCredentials)                      | `database-credentials`                 |
| [prefect-sqlalchemy](/integrations/prefect-sqlalchemy/) | [SQLAlchemy Connector](/integrations/prefect-sqlalchemy/database/#prefect_sqlalchemy.database.SqlAlchemyConnector)                            | `sqlalchemy-connector`                 |

## Use existing block types

Blocks are classes that subclass the `Block` base class. You can instantiate and use them like normal classes.

### Instantiate blocks

To instantiate a block that stores an S3 bucket value, use the `S3Bucket` block:

```python
from prefect_aws.s3 import S3Bucket

bucket_block = S3Bucket(bucket_name="data-bucket")

```

### Save blocks

To retrieve this saved value use the `.save()` method:

```python
bucket_block.save(name="my-data-bucket-block")
```

To update saved block value stored for a given block, overwrite the existing block by passing `overwrite=True`:

```python
bucket_block.save(overwrite=True)
```

Create a new `S3Bucket` by setting the `name` parameter to a new value:

```python
new_bucket_block.save(name="my-new-data-bucket-block")
```

### Load blocks

You can use the block name to load the block:

```python hl_lines="6"
from prefect import flow
from prefect_aws.s3 import S3Bucket

@flow
def what_is_the_bucket():
    bucket = S3Bucket.load("my-data-bucket-block")
    print(bucket.bucket_name)

if __name__ == "__main__":
    what_is_the_bucket() # data-bucket
```

Alternatively, load a block with the unique slug that is a combination of the block type slug and the block name.

To load the `S3Bucket` block from above, run the following:

```python hl_lines="3"
from prefect_aws.s3 import S3Bucket

s3_block = Block.load("S3Bucket/my_s3_bucket_block")
print(s3_bucket.bucket_name) # data-bucket
```

### Delete blocks

Delete a block with the `.delete()` method:

```python
from prefect.blocks.core import Block

Block.delete("s3-bucket/my-data-bucket-block")
```

Alternatively, use the CLI to delete specific blocks with a given slug or id:

```bash
prefect block delete s3-bucket/my-data-bucket-block
```

```bash
prefect block delete --id <my-id>
```

## Create a new block type

To create a custom block type, define a class that subclasses `Block`. The `Block` base class builds
on Pydantic's `BaseModel`, so you can declare custom blocks just like a [Pydantic model](https://pydantic-docs.helpmanual.io/usage/models/#basic-model-usage).

Here's a block that represents a cube and holds information about the length of each edge in inches:

```python
from prefect.blocks.core import Block

class Cube(Block):
    edge_length_inches: float
```

You can include methods on a block to provide functionality.
Here's the same cube block with methods to calculate the volume and surface area of the cube:

```python hl_lines="6-10"
from prefect.blocks.core import Block

class Cube(Block):
    edge_length_inches: float

    def get_volume(self):
        return self.edge_length_inches**3

    def get_surface_area(self):
        return 6 * self.edge_length_inches**2
```

Use the new `Cube` block type in a flow:

```python
from prefect import flow

rubiks_cube = Cube(edge_length_inches=2.25)
rubiks_cube.save("rubiks-cube")

@flow
def calculate_cube_surface_area(cube_name):
    cube = Cube.load(cube_name)
    print(cube.get_surface_area())

if __name__ == "__main__":
    calculate_cube_surface_area("rubiks-cube") # 30.375
```

### Secret fields

All block values are encrypted before being stored.
If you have values that you would not like visible in the UI or in logs,
use the `SecretStr` field type provided by Pydantic to automatically obfuscate those values.
You can use this functionality for fields that store credentials such as passwords and API tokens.

Here's an example of an `AWSCredentials` block that uses `SecretStr`:

```python hl_lines="8"
from typing import Optional

from prefect.blocks.core import Block
from pydantic import SecretStr  # if pydantic version >= 2.0, use: from pydantic.v1 import SecretStr

class AWSCredentials(Block):
    aws_access_key_id: Optional[str] = None
    aws_secret_access_key: Optional[SecretStr] = None
    aws_session_token: Optional[str] = None
    profile_name: Optional[str] = None
    region_name: Optional[str] = None
```

Since `aws_secret_access_key` has the `SecretStr` type hint assigned to it,
the value of that field is not exposed if the object is logged:

```python
aws_credentials_block = AWSCredentials(
    aws_access_key_id="AKIAJKLJKLJKLJKLJKLJK",
    aws_secret_access_key="secret_access_key"
)

print(aws_credentials_block)
# aws_access_key_id='AKIAJKLJKLJKLJKLJKLJK' aws_secret_access_key=SecretStr('**********') aws_session_token=None profile_name=None region_name=None
```

Prefect's `SecretDict` field type allows you to add a dictionary field to your block
that automatically obfuscates values at all levels in the UI or in logs.
This functionality is useful for blocks where typing or structure of secret fields is not known until configuration time.

Here's an example of a block that uses `SecretDict`:

```python
from typing import Dict

from prefect.blocks.core import Block
from prefect.blocks.fields import SecretDict


class SystemConfiguration(Block):
    system_secrets: SecretDict
    system_variables: Dict


system_configuration_block = SystemConfiguration(
    system_secrets={
        "password": "p@ssw0rd",
        "api_token": "token_123456789",
        "private_key": "<private key here>",
    },
    system_variables={
        "self_destruct_countdown_seconds": 60,
        "self_destruct_countdown_stop_time": 7,
    },
)
```

`system_secrets` is obfuscated when `system_configuration_block` is displayed, but `system_variables` show up in plain-text:

```python
print(system_configuration_block)
# SystemConfiguration(
#   system_secrets=SecretDict('{'password': '**********', 'api_token': '**********', 'private_key': '**********'}'), 
#   system_variables={'self_destruct_countdown_seconds': 60, 'self_destruct_countdown_stop_time': 7}
# )
```

### Block type metadata

Set metadata fields on a block type's subclass to control how a block displays.

Available metadata fields include:

| Property            | Description                                                                                                                                  |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| \_block\_type\_name | Display name of the block in the UI. Defaults to the class name.                                                                             |
| \_block\_type\_slug | Unique slug used to reference the block type in the API. Defaults to a lowercase, dash-delimited version of the block type name.             |
| \_logo\_url         | URL pointing to an image that should be displayed for the block type in the UI. Default to `None`.                                           |
| \_description       | Short description of block type. Defaults to docstring, if provided.                                                                         |
| \_code\_example     | Short code snippet shown in UI for how to load/use block type. Default to first example provided in the docstring of the class, if provided. |

### Nested blocks

Blocks are composable: a block can be used within other blocks.
You can create a block type that uses functionality from another block type by declaring it as an attribute.

Nestable blocks are loosely coupled, and configuration can be changed for each block independently.
This allows sharing configuration across multiple use cases.

For example, here's an expanded `AWSCredentials` block that enables an authenticated session through the `boto3` library:

```python
from typing import Optional

import boto3
from prefect.blocks.core import Block
from pydantic import SecretStr

class AWSCredentials(Block):
    aws_access_key_id: Optional[str] = None
    aws_secret_access_key: Optional[SecretStr] = None
    aws_session_token: Optional[str] = None
    profile_name: Optional[str] = None
    region_name: Optional[str] = None

    def get_boto3_session(self):
        return boto3.Session(
            aws_access_key_id = self.aws_access_key_id
            aws_secret_access_key = self.aws_secret_access_key
            aws_session_token = self.aws_session_token
            profile_name = self.profile_name
            region_name = self.region
        )
```

You can use the `AWSCredentials` block within an `S3Bucket` block to provide authentication when interacting with an S3 bucket:

```python hl_lines="5"
import io

class S3Bucket(Block):
    bucket_name: str
    credentials: AWSCredentials

    def read(self, key: str) -> bytes:
        s3_client = self.credentials.get_boto3_session().client("s3")

        stream = io.BytesIO()
        s3_client.download_fileobj(Bucket=self.bucket_name, key=key, Fileobj=stream)

        stream.seek(0)
        output = stream.read()

        return output

    def write(self, key: str, data: bytes) -> None:
        s3_client = self.credentials.get_boto3_session().client("s3")
        stream = io.BytesIO(data)
        s3_client.upload_fileobj(stream, Bucket=self.bucket_name, Key=key)
```

You can use this `S3Bucket` block with previously saved `AWSCredentials` block values in order to interact with the configured S3 bucket:

```python
my_s3_bucket = S3Bucket(
    bucket_name="my_s3_bucket",
    credentials=AWSCredentials.load("my_aws_credentials")
)

my_s3_bucket.save("my_s3_bucket")
```

This creates a reference from the AWSCredentials block my\_aws\_credentials to the S3Bucket block my\_s3\_bucket,
so that changes to the values in my\_aws\_credentials propogate to my\_s3\_bucket.

Values for nested blocks can also be specified in place:

```python
my_s3_bucket = S3Bucket(
    bucket_name="my_s3_bucket",
    credentials=AWSCredentials(
        aws_access_key_id="AKIAJKLJKLJKLJKLJKLJK",
        aws_secret_access_key="secret_access_key"
    )
)

my_s3_bucket.save("my_s3_bucket")
```

In the above example, the values for `AWSCredentials` are saved with `my_s3_bucket` and are not usable with any other blocks.

### Update custom `Block` types

Here's an example of how to add a `bucket_folder` field to your custom `S3Bucket` block; it represents the default path to
read and write objects from (this field exists on [our implementation](https://github.com/PrefectHQ/prefect-aws/blob/main/prefect_aws/s3.py#L292)).

Add the new field to the class definition:

```python hl_lines="4"
class S3Bucket(Block):
    bucket_name: str
    credentials: AWSCredentials
    bucket_folder: Optional[str] = None
    ...
```

Then [register the updated block type](#register-blocks) with either Prefect Cloud or your self-hosted Prefect server instance.

If you have any existing blocks of this type that were created before the update and
you'd prefer to not re-create them, migrate them to the new version of your block type by adding the missing values:

```python
# Bypass Pydantic validation to allow your local Block class to load the old block version
my_s3_bucket_block = S3Bucket.load("my-s3-bucket", validate=False)

# Set the new field to an appropriate value
my_s3_bucket_block.bucket_path = "my-default-bucket-path"

# Overwrite the old block values and update the expected fields on the block
my_s3_bucket_block.save("my-s3-bucket", overwrite=True)
```

## Register blocks

Prefect comes with many blocks pre-registered and ready to use.
If you do not have a block available for use, you can register it.

Register blocks from a Python module available in the current environment with a CLI command:

<div class="terminal">
  ```bash
  prefect block register --module prefect_aws.credentials
  ```
</div>

This command is useful for registering all blocks found within a module in a [Prefect Integration library](/integrations/).

Alternatively, if a custom block was created in a `.py` file, you can register the block with the CLI command:

<div class="terminal">
  ```bash
  prefect block register --file my_block.py
  ```
</div>

The registered block is now available for configuration.
