Amazon recommends caution when using shared AMI as they cannot vouch for the integrity of the data provided by other account holders. For more information, see the AWS documentation.
References:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/sharing-amis.html
Sharing of AMI allows other AWS accounts to access the AMI without any restrictions. Sharing of only allowed if the AMI is not encrypted. This can be updated in the console, CLI, or Terraform.
In AWS Console -
In Terraform -
References:
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cancel-sharing-an-AMI.html
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ami_launch_permission