Amazon CodeBuild - Amazon Step Functions
Amazon Web Services 文档中描述的 Amazon Web Services 服务或功能可能因区域而异。要查看适用于中国区域的差异,请参阅 中国的 Amazon Web Services 服务入门 (PDF)

本文属于机器翻译版本。若本译文内容与英语原文存在差异,则一律以英文原文为准。

Amazon CodeBuild

这些示例模板显示了如何根据状态机定义中的资源 Amazon Step Functions 生成 IAM 策略。有关更多信息,请参阅:

资源:

{ "Version": "2012-10-17", "Statement": [ { "Action": [ "sns:Publish" ], "Resource": [ "arn:aws:sns:sa-east-1:123456789012:StepFunctionsSample-CodeBuildExecution1111-2222-3333-wJalrXUtnFEMI-SNSTopic-bPxRfiCYEXAMPLEKEY" ], "Effect": "Allow" }, { "Action": [ "codebuild:StartBuild", "codebuild:StopBuild", "codebuild:BatchGetBuilds", "codebuild:BatchGetReports" ], "Resource": "*", "Effect": "Allow" }, { "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:sa-east-1:123456789012:rule/StepFunctionsGetEventForCodeBuildStartBuildRule" ], "Effect": "Allow" } ] }

StartBuild

静态资源

Run a Job (.sync)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild", "codebuild:StopBuild", "codebuild:BatchGetBuilds" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:[[region]]:[[accountId]]:rule/StepFunctionsGetEventForCodeBuildStartBuildRule" ] } ] }
Request Response
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] } ] }

动态资源

Run a Job (.sync)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild", "codebuild:StopBuild", "codebuild:BatchGetBuilds" ], "Resource": [ "arn:aws:codebuild:[[region]]:*:project/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:[[region]]:[[accountId]]:rule/StepFunctionsGetEventForCodeBuildStartBuildRule" ] } ] }
Request Response
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuild" ], "Resource": [ "arn:aws:codebuild:[[region]]:*:project/*" ] } ] }

StopBuild

静态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StopBuild" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] } ] }

动态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StopBuild" ], "Resource": [ "arn:aws:codebuild:[[region]]:*:project/*" ] } ] }

BatchDeleteBuilds

静态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:BatchDeleteBuilds" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] } ] }

动态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:BatchDeleteBuilds" ], "Resource": [ "arn:aws:codebuild:[[region]]:*:project/*" ] } ] }

BatchGetReports

静态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:BatchGetReports" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:report-group/[[reportName]]" ] } ] }

动态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:BatchGetReports" ], "Resource": [ "arn:aws:codebuild:[[region]]:*:report-group/*" ] } ] }

StartBuildBatch

静态资源

Run a Job (.sync)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuildBatch", "codebuild:StopBuildBatch", "codebuild:BatchGetBuildBatches" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:[[region]]:[[accountId]]:rule/StepFunctionsGetEventForCodeBuildStartBuildBatchRule" ] } ] }
Request Response
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuildBatch" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] } ] }

动态资源

Run a Job (.sync)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuildBatch", "codebuild:StopBuildBatch", "codebuild:BatchGetBuildBatches" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/*" ] }, { "Effect": "Allow", "Action": [ "events:PutTargets", "events:PutRule", "events:DescribeRule" ], "Resource": [ "arn:aws:events:[[region]]:[[accountId]]:rule/StepFunctionsGetEventForCodeBuildStartBuildBatchRule" ] } ] }
Request Response
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StartBuildBatch" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/*" ] } ] }

StopBuildBatch

静态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StopBuildBatch" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] } ] }

动态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:StopBuildBatch" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/*" ] } ] }

RetryBuildBatch

静态资源

Run a Job (.sync)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:RetryBuildBatch", "codebuild:StopBuildBatch", "codebuild:BatchGetBuildBatches" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] } ] }
Request Response
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:RetryBuildBatch" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] } ] }

动态资源

Run a Job (.sync)
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:RetryBuildBatch", "codebuild:StopBuildBatch", "codebuild:BatchGetBuildBatches" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/*" ] } ] }
Request Response
{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:RetryBuildBatch" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/*" ] } ] }

DeleteBuildBatch

静态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:DeleteBuildBatch" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/[[projectName]]" ] } ] }

动态资源

{ "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "codebuild:DeleteBuildBatch" ], "Resource": [ "arn:aws:codebuild:[[region]]:[[accountId]]:project/*" ] } ] }