Search code examples
amazon-web-servicesaws-code-deployaws-samaws-sam-cli

specify custom CodeDeployServiceRole role to CodeDeployHook in aws sam DeploymentPreference


I'm implementing PreTrafficHook validation lambda function and want to use pre-created CodeDeployServiceRole but AWS SAM is attempting to create new role arn:aws:iam:::role/-CodeDeployServiceRole-.

I've found a related issue here https://github.com/awslabs/serverless-application-model/issues/1496 , so looks like it's a bug. But anyway is there a way to bypass this issue?


Solution

  • I could get around this by removing "Enabled: false" in DeploymentPreference of my preTrafficHook function resource in sam template