View a markdown version of this page

Use DeleteComponent with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use DeleteComponent with an AWS SDK or CLI

The following code examples show how to use DeleteComponent.

Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:

CLI
AWS CLI

To delete a component version

The following delete-component example deletes a Hello World component.

aws greengrassv2 delete-component \ --arn arn:aws:greengrass:us-west-2:123456789012:components:com.example.HelloWorld:versions:1.0.0

This command produces no output.

For more information, see Manage components in the AWS IoT Greengrass V2 Developer Guide.

Python
SDK for Python (Boto3)
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

def delete_component(self, component_version_arn: str) -> None: """ Deletes a specific version of a component. :param component_version_arn: The ARN of the component version to delete. """ try: self.client.delete_component(arn=component_version_arn) logger.info("Deleted component version %s.", component_version_arn) except ClientError as err: if err.response["Error"]["Code"] == "ConflictException": logger.error( "Component version cannot be deleted because it is referenced by an " "active deployment. Cancel or update the deployment first. %s", err.response["Error"]["Message"], ) raise
  • For API details, see DeleteComponent in AWS SDK for Python (Boto3) API Reference.