putContainerRecipePolicy
inline suspend fun ImagebuilderClient.putContainerRecipePolicy(crossinline block: PutContainerRecipePolicyRequest.Builder.() -> Unit): PutContainerRecipePolicyResponse
Applies a policy to a container recipe. The preferred way to share resources is with the RAM API CreateResourceShare. If you use the PutContainerRecipePolicy operation instead, you must also call the RAM API PromoteResourceShareCreatedFromPolicy. Otherwise, the resource isn't visible to the principals that it's shared with.
Samples
// The following example applies a resource policy that grants another AWS account permission to view
// and use the specified container recipe.
val resp = imagebuilderClient.putContainerRecipePolicy {
containerRecipeArn = "arn:aws:imagebuilder:us-west-2:111122223333:container-recipe/my-example-container-recipe-shared/1.0.0"
policy = "{\"Version\": \"2012-10-17\", \"Statement\": [{\"Sid\": \"AllowSharedAccountContainerRecipeAccess\", \"Effect\": \"Allow\", \"Principal\": {\"AWS\": \"arn:aws:iam::444455556666:root\"}, \"Action\": [\"imagebuilder:GetContainerRecipe\", \"imagebuilder:ListContainerRecipes\"], \"Resource\": \"arn:aws:imagebuilder:us-west-2:111122223333:container-recipe/my-example-container-recipe-shared/1.0.0\"}]}"
}Content copied to clipboard