Regarding your first question about deleting a docker image that was pushed to an AWS ECR repository when you delete the deployment, it seems that there's not an automated way to accomplish this directly with Prefect. The process of building and pushing the docker image as part of the deployment is mentioned in the Prefect documentation, but it doesn't cover the deletion of the image from the registry. You may have to delete the image manually from AWS ECR or create a separate automated process for this purpose.
As for your second question on deleting a deployment via Prefect CLI or API, you can use the Prefect CLI to create a deployment which implicitly indicates that deletion might also be possible via the CLI or API. However, the specific command or API call to delete a deployment isn't directly provided in the documentation excerpts or the GitHub issues search results.
For precise details on deleting deployments through the CLI or API, I would suggest checking the latest Prefect documentation regarding deployment management or examining the Prefect CLI help by running
prefect deployment --help
to see if a delete command is available.
If you want more detailed instructions on deleting a Prefect deployment or docker images, or if you have any other questions, please let me know, and I can search for more specific information.