Slide 21
Slide 21 text
© 2022, Amazon Web Services, Inc. or its affiliates. All rights reserved.
ΧελϜϦιʔε͔ΒAWS CodeBuildΛ͏ํ๏
ΧελϜϦιʔεͷAWS LambdaΛܦ༝͠
AWS CodeBuildΛ࣮ߦͯ͠Ϗϧυ/ϓογϡ
ར
• AWS CodeBuildͰϏϧυڥΛৄࡉʹ
ઃఆՄೳ
• ΠϝʔδͷෳϦϙδτϦอଘ͕ෆཁ
• AWS͕ఏڙ͢Δࢀߟ࣮͕͋Δ※
ܽ
• 2ճҎ߱ͷσϓϩΠΛ࣮ߦ͢ΔͨΊ
ελοΫͷมߋࠩΛڧ੍తʹ࡞ΔͳͲ
͕ඞཁ
// CI/CDαʔϏε্͔ΒCDKͷCLI࣮ߦ࣌ʹࠓճ͚Δλά໊ΛελοΫʹ͢
const imageTag = props.imageTag;
// ڧ੍σϓϩΠύλʔϯ1
// AwsCustomResourceͰid໊ʹλά໊(imageTag)ΛՃ͠ຖճLambdaΛߋ৽͢Δ
const project = new codebuild.Project(this, `${id}-project`, {
source: codebuild.Source.s3({
…
});
new cr.AwsCustomResource(this, `${id}-startBuilds-${imageTag}`, {
…
onCreate: sdkcallForStartBuild,
onUpdate: sdkcallForStartBuild,
});
// ڧ੍σϓϩΠύλʔϯ2
// Lambdaผ్࡞ΓɺΧελϜϦιʔεͷpropertiesʹtagNameΛ͚Δ
const provider = new cr.Provider(this, "Provider", {
onEventHandler: containerStartBuildLambda, // ࡞ࡁLambdaΛࢦఆ
});
new cdk.CustomResource(this, "Custom::EcsDeploy", {
serviceToken: provider.serviceToken,
properties: { imageTag },
});
※ https://github.com/aws-samples/baseline-environment-on-aws/blob/main/usecases/guest-webapp-sample/lib/blea-build-container-stack.ts