æ¬è¨äºã¯
NRIãããã³ã Advent Calendar 2022
11æ¥ç®ã®è¨äºã§ãã
ð 10æ¥ç®
â¶â¶æ¬è¨äº â¶â¶
12æ¥ç®
ð
ããã«ã¡ã¯ï¼ãre:Inventã§è²°ã£ãã©ã¤ãã»ã¼ãã¼ãè©æãããã¯ã«å ¥ãã¦æã«æã¤ã¨SAMURAIã¹ã¿ã¤ã«ã«ãªã£ã¦ããå¿æ°´ã§ãããã¯ãæµ·å¤è¡ãã¨èªç¶ã«åºã¡ããã¾ããããµã ã©ã¤ãã¼ããã
ã¯ããã«
ãã¦ãã¿ãªããã¯re:Inventæéä¸ã«çºè¡¨ãããæ°ãµã¼ãã¹ã»æ°æ©è½ã§å¿æ¹ããããã®ã¯ããã¾ããï¼ãç§ã¯ãã³ããã§AWS Application Composerï¼ä»¥éApplication Composerï¼ã§ããã
Wernerããçºè¡¨ãããã¨ããã¤ãã«ãã¼ã³ã¼ãããããã¨ãã³ã·ã§ã³çä¸ãããã¦ã¾ãããæè¿IaCã®æè²æ¹æ³ã«ã¤ãã¦æ©ãã§ããã®ã§ãå¿ã«é¿ãã¾ããã
ãããã¼ãã®ã ããããªCDKããã¨ã®æ£²ã¿åãã¯ã©ããªãã®ï¼ãApplication Composerã«CDKãµãã¼ãããããã¨ã®æ義ã£ã¦ããã®ï¼ãã¨æã£ãã®ã§ãããã¤ãã®è¦³ç¹ã§æ¯è¼ãã¦ãçãã¦ããã¾ãã
ã¡ãªã¿ã«ã¿ã¤ãã«ã®Application Composerã¨CDKã§ã¯ã¿ã¼ã²ãããéã£ã¦ããã®ã§ãæ£ç¢ºã«ã¯Application Composer+SAMã¨CDKãæ¯è¼ãããã¨ã«ãªãã¾ãã
Application Composerã¨ã¯
Application Composerã«ã¤ãã¦èª¬æãã¾ããApplication Composerã¨ã¯ããµã¼ãã¬ã¹ã¢ã¼ããã¯ãã£ã«ãããã¤ã³ãã©ã®ãã¼ã³ã¼ããã¼ã«ã§ãç»é¢ä¸ã§ãµã¼ãã¬ã¹ãµã¼ãã¹ã®ã¢ã¤ã³ã³ãç½®ãããç¹ããã ãã§ã¤ã³ãã©ã®ã³ã¼ããä½ãã¾ããLambdaã®ã¢ããªã±ã¼ã·ã§ã³ã³ã¼ãã¯Hello Worldçãªã³ã¼ããèªåçæããã¾ãã
ã¾ããäºåã«ä½æãããã¤ã³ãã©ã³ã¼ããã¤ã³ãã¼ãããã¨ããã®å 容ã«æ²¿ã£ãã¢ã¤ã³ã³ã¨ãã®ç¹ããã表示ãããæ´ã«ãããä¿®æ£ãããã¨ãåºæ¥ã¾ãããã®çºãç¾ç¶ã³ã¼ãããç¡ãæ§æå³ãç¡ããã¼ã ã§ããApplication Composerãå©ç¨ãã¦æ§æå³ãä½æãããã¨ãå¯è½ã«ãªãã¾ããApplication Composerã§ãµãã¼ãããã¦ããªããªã½ã¼ã¹ãåãè¾¼ããã¨ã¯å¯è½ã§ãããè¨å®ã®å¤æ´çã¯åºæ¥ãç»é¢ã«åºã¦ããã ãã§ãã
ã¡ãªã¿ã«ãApplication Composeråä½ã§ã¯ãããã¤ãåºæ¥ãªããããã¤ã³ãã©ã³ã¼ãä½æã®æ¯æ´ãã¼ã«ã¨ããç«ã¡ä½ç½®ã«ãªãã¾ãã ã¾ããApplication Composerã®çºè¡¨æç¹ã§ä½æã§ããã³ã¼ãã¯SAMãã³ãã¬ã¼ãã®ã¿ã¨ãªã£ã¦ããã¾ããCDKãTerraformã®ãµãã¼ãã¯ç¾ç¶ç¡ãã¿ããã§ãããå¿ è¦æ§ã説ãã¦ããã°è¿½å ãããã¨éçºTã®æ¹ãè¨ã£ã¦ãã¾ããããªã®ã§ãã®ããã°ãæ¸ãã¦ãã¾ãã
ãã£ã¦ã¿ã
ä¸è¨ã®ããã«æåã ãã®èª¬æã ã¨åããã«ããã®ã§ãå®éã«Application Composerãå©ç¨ãã¦ã¿ã¾ãããã
S3âLambdaã®æ§æãä¾ã¨ãã¦ä½ã£ã¦ã¿ã¾ãã ã¾ãå·¦ã®ã¡ãã¥ã¼ããS3æ¢ããå³å´ã¸ãã©ãã°&ãããããã¦ã¿ã¾ãã
ããã¨ãã³ã¼ãã«ä¸è¨ã®ãããªS3ãªã½ã¼ã¹ãä½ããã¾ãã
Resources: Bucket: Type: AWS::S3::Bucket Properties: BucketName: !Sub ${AWS::StackName}-bucket-${AWS::AccountId} BucketEncryption: ServerSideEncryptionConfiguration: - ServerSideEncryptionByDefault: SSEAlgorithm: aws:kms KMSMasterKeyID: alias/aws/s3 PublicAccessBlockConfiguration: IgnorePublicAcls: true RestrictPublicBuckets: true BucketBucketPolicy: Type: AWS::S3::BucketPolicy Properties: Bucket: !Ref Bucket PolicyDocument: Id: RequireEncryptionInTransit Version: '2012-10-17' Statement: - Principal: '*' Action: '*' Effect: Deny Resource: - !GetAtt Bucket.Arn - !Sub ${Bucket.Arn}/* Condition: Bool: aws:SecureTransport: 'false'
S3ãã±ããã®è¨å®ã¨ãã¦ããµã¼ããµã¤ãæå·åãå ¥ã£ã¦ããããæå·åãããéä¿¡ã®ã¿æ¥ç¶åºæ¥ãããã«ãªã£ã¦ãããã¨Well-Architectedãªè¨å®ã«ãªã£ã¦ãããã¨ãåããã¾ãã
次ã«ãS3ã®ã¢ã¤ã³ã³ãã¯ãªãã¯ããã¨ä¸è¨ã®ããã«ç¾å¨ã®è¨å®ãè¦ããã¾ãã ããã§ãS3ã®è¨å®ãä¸è¨ã®ããã«ãããªãã¯ã¢ã¯ã»ã¹ãããã¯ãç¡ãã«å¤æ´ãã¦ã¿ã¾ãã
ããã¨ãã³ã¼ããããã«åããã¦å¤æ´ããã¦ãããã¨ãåããã¾ãã
SSEAlgorithm: aws:kms KMSMasterKeyID: alias/aws/s3 - PublicAccessBlockConfiguration: - IgnorePublicAcls: true - RestrictPublicBuckets: true BucketBucketPolicy: Type: AWS::S3::BucketPolicy
ã§ã¯ã次ã«Lambdaãé ç½®ããã¨ããã®ã³ã¼ãã追å ããã¾ãã
Bool: aws:SecureTransport: 'false' + Function: + Type: AWS::Serverless::Function + Properties: + Description: !Sub + - Stack ${AWS::StackName} Function ${ResourceName} + - ResourceName: Function + CodeUri: src/Function + Handler: index.handler + Runtime: nodejs18.x + MemorySize: 3008 + Timeout: 30 + Tracing: Active + FunctionLogGroup: + Type: AWS::Logs::LogGroup + DeletionPolicy: Retain + Properties: + LogGroupName: !Sub /aws/lambda/${Function} +Transform: AWS::Serverless-2016-10-31
ããã§S3ã¨éãã®ããLambdaãé ç½®ããã¨ãã³ãã¬ã¼ãä¿®æ£ã ãã§ãªããã¢ããªã±ã¼ã·ã§ã³ã³ã¼ãã®éå½¢ãä½ããã¾ããæåã¯Lambdaã®è¨èªè¨å®ãNode.jsãæå®ãã¦ããã®ã§ãindex.jsã¨package.jsonãä½æããã¾ãããããPythonã«å¤æ´ããã¨handler.pyã¨requirements.txtãåºæ¥ã¾ãã
ã¡ãªã¿ã«ãç¾å¨Lambdaã®ååãè¨èªã®å¤æ´ãããã¨å¤æ´åã®ãã¡ã¤ã«ããã£ã¬ã¯ããªãæ®ã£ã¦ãã¾ãäºã«æ³¨æãå¿ è¦ã§ããç¾å¨ãã¬ãã¥ã¼ä¸ãªã®ã§ãé©å®ä¿®æ£ãããã¨æãã¾ãã
ããã¦ãS3ããLambdaã«ç·ãå¼ãã¨ãä¸è¨ã®ããã«S3ã«ãªãã¸ã§ã¯ããé ç½®ã»åé¤ãããã¨ã§Lambdaãèµ·åãããããã«ä¿®æ£ããã¾ãã
Timeout: 30 Tracing: Active + Events: + Bucket: + Type: S3 + Properties: + Bucket: !Ref Bucket + Events: + - s3:ObjectCreated:* + - s3:ObjectRemoved:* FunctionLogGroup: Type: AWS::Logs::LogGroup
çºç«ããã¤ãã³ãã¯Application Composerããã¯è¨å®åºæ¥ãªãã®ã§ãåºåå¾ã®ãã³ãã¬ã¼ããä¿®æ£ãããã¨ã«ãªãã¾ãã
ããã«é¢ç½ãã®ããS3ã¨Lambdaã®é çªãéã«ããã¨ã
ä¸è¨ã®ããã«Lambdaã®ç°å¢å¤æ°ã«S3ã®ååã¨arnãèªåã§ã»ããããã¾ãã
Timeout: 30 Tracing: Active + Environment: + Variables: + BUCKET_NAME: !Ref Bucket + BUCKET_ARN: !GetAtt Bucket.Arn + Policies: + - S3CrudPolicy: + BucketName: !Ref Bucket FunctionLogGroup: Type: AWS::Logs::LogGroup
ãã®ããã«ããªã½ã¼ã¹éã®åå¾é¢ä¿ããã£ããç解ãã¦ãã³ãã¬ã¼ããåºæ¥ãã®ã§ã触ã£ã¦ãã¦é常ã«æ¥½ããã§ããã¾ããå¤æ´ãããå 容ãè¦ã¦ããããæ¸ãæ¹ãããã®ãã¨åå¼·ã«ããªãã®ã§ãåå¼·ãã¼ã«ã¨ãã¦ãè¯ãæ°ããã¾ãããç¹ããã¨ãåºæ¥ãªãå ´åã¯ã¨ã©ã¼ãåºãã®ã§ãã¢ã¼ããã¯ãã£çã«æ¥ç¶åºæ¥ãªããã¨ã«ã¤ãã¦ãå¦ã¶ãã¨ãåºæ¥ã¾ãã
ã¡ãªã¿ã«ããããã¤ãåºæ¥ãªãé¨åã¯SAMã§è£ããã¨ã«ãªãã¾ããApplication Composerç»é¢ã¯ãã¼ã«ã«ã®ãã¡ã¤ã«ã¨åæåºæ¥ã¾ãããã®ããã sam sync --watch
ãå®è¡ããã¨ãç»é¢ããå¤æ´ããæã«èªåçã«SAMãããããã¤ããäºãåºæ¥ãã®ã§é常ã«ä¾¿å©ã§ãããããApplication Composerã®åºåã«CDKããµãã¼ããããããã«ãªãã¨ãåãããã«cdk watch
ã³ãã³ãã§åããã¨ãåºæ¥ãããã«ãªãã¯ãã§ãã
CloudFormationãã¶ã¤ãã¼ã¨ã®éã
ã¡ãªã¿ã«ãä¼¼ã¦ãããµã¼ãã¹ã¨ãã¦CloudFormationãã¶ã¤ãã¼ãããã¾ãã使ãåãã¨ãã¦ã¯ãCloudFormationãã¶ã¤ãã¼ã¯CloudFormationãã³ãã¬ã¼ãã®è¦è¦åã§ãApplication Composerã¯SAMãã³ãã¬ã¼ãã®è¦è¦åã«ãªãã¾ããCloudFormationãã¶ã¤ãã¼ã¯IAMãªã©å ¨ãªã½ã¼ã¹ã®è¡¨ç¤ºãããã¾ãããApplication Composerã¯å¿ è¦æä½éã«ãªãã¾ããåããã³ãã¬ã¼ããCloudFormationãã¶ã¤ãã¼ã¨Application Composerã§åºåãããã®ãä¸è¨ã«ãªãã¾ãã
å·¦ãCloudFormationãã¶ã¤ãã¼ã§ãå³ãApplication Composerã«ãªãã¾ããCloudFormationãã¶ã¤ãã¼ã®ã»ãã¯ãã°ã¨ãã±ããããªã·ã¼ã追å ã§åºã¦ãã¾ãããã±ããããªã·ã¼ã¯S3ãã±ããã¸ç¢å°ãåºã¦ãã®ã§ç¹ãã£ã¦ãããã¨ãåããã¾ããããã°ã«ã¤ãã¦ã¯å¤ç«ãã¦ããã®ã§ä½ã®ããã®ãã®ããã®å³ããã¯å¤æåºæ¥ã¾ãããéã«Application Composerã«é¢ãã¦ã¯ãã±ããããªã·ã¼ããã°ã«ã¤ãã¦ã®è¨è¼ãç¡ãã·ã³ãã«ã§ããããã®2ã¤ãããã®ãã©ãããå¤æãåºæ¥ã¾ãããæãªããã®ã¤ã³ãã©ãªæ¹ã¯ãã®ç¶æ³ãå°ãè¦æããããã¾ãããã©ã¡ããè¯ãæªããªã©ã¯ç¡ãã§ãããå ¨ã¦è¦ããã®ããã£ããè¦ããã®ãã§ä½¿ãåãã¦ããã°è¯ãã§ãããã
Application Composer + SAMã¨CDKã®æ¯è¼
ãµã¼ãã¬ã¹ã¢ã¼ããã¯ãã£ãæ§ç¯ããAWSã®ã¡ã¸ã£ã¼ãªIaCãã¼ã«ã¯SAMã§ãããç§ã¯å¤§å¥½ããªCDKã使ã£ã¦ãã¾ãããªã®ã§ãApplication Composer + SAMã¨CDKãããããæ¯è¼ãã¦ããããã®ã¿ã¼ã²ãããè¦ã¦ããã¾ããTerraformãPulumiã«é¢ãã¦ã¯æ¯è¼ã¯è¡ãã¾ããããCDKã¨ããã¾ã§å¤§ããå¤ãããã¨ãç¡ãã®ã§CDKã§ã®æ¯è¼ãåèã«ãã¦ãã ããã
ã§ãããã¨
ãµã¼ãã¬ã¹ã¢ã¼ããã¯ãã£ãæ§ç¯ããã«ããã£ã¦ãåãã¼ã«ã®ã§ããç¯å²ã¯ä¸è¨ã®éãã«ãªãã¾ãã
SAMã¯ãã³ãã¬ã¼ããç´æ¥ã³ã¼ãã£ã³ã°ããã®ã«å¯¾ãã¦CDKã¯ããã°ã©ãã³ã°è¨èªãä»ãã¦ãã³ãã¬ã¼ããçæãã¦ãã¾ããã¾ããApplication Composerã¯GUIã®ç»é¢ãéãã¦ãã³ãã¬ã¼ããçæãã¦ãã¾ããããããã¤ã¯åºæ¥ã¾ããããã®ããããããã¤é¨åãSAMã§å©ç¨ãããã¨ã§ãCDKã¨åãããã«ã³ã¼ãã£ã³ã°ãããããã¤ã¾ã§ä¸è²«ãã¦è¡ããã¨ãã§ãã¾ãã
å¿ è¦ãªç¥è
å¿ è¦ãªç¥èã¨ãã¦ã¯ãã©ã®ãã¼ã«ãå©ç¨ããã«ããã£ã¦ããæ§ç¯ãããµã¼ãã¬ã¹ã¢ã¼ããã¯ãã£ã«é¢ããç¥èã¯å¿ è¦ãã¨æãã¾ããApplication Composerã¯ä»ã«ç»é¢ã®æä½æ¹æ³ãåããã°ããªã½ã¼ã¹ãçµã¿åãããã ãã§ãã³ãã¬ã¼ããä½ãã¾ããä»ã®SAMãCDKã¯ãµã¼ãã¬ã¹ã¢ã¼ããã¯ãã£ã«é¢ããç¥èããã¼ã«ã®æä½æ¹æ³ã¯åããå¿ è¦ã§ã追å ã§ã³ã¼ãã«é¢ããyaml/jsonãå種è¨èªã®ç¥èãå¿ è¦ã«ãªãã¾ãã
Application Composerã¯å¿ è¦ãªç¥èãå°ãªãã®ã§ãæ§ç¯åå¿è ã®æ¹ãªã©ã«é常ã«è¯ããã¼ã«ãã¨æããã¾ããã¾ããApplication Composerãå©ç¨ãã¦å¦ã¶ãã¨ãåºæ¥ãã®ã§æ§ç¯åå¿è ã®æ¹ã¯æ¯é使ã£ã¦ã»ãããµã¼ãã¹ã«ãªãã¾ããããç¨åº¦SAMã®ç¥èãããå ´åã¯ãæåã¯Application Composerãå©ç¨ãã¦å¾ããSAMã§è©³ç´°ãè©°ããå©ç¨æ¹æ³ãæãå¹çã®è¯ãé²ãæ¹ã«ãªãã¾ããApplication Composer+SAMã¨CDKãæ¯è¼ããã¨ãå¿ è¦ãªç¥èéã«å·®ã¯ãã¾ãç¡ãã§ãã
æ§ç¯ã¹ãã¼ã
æ§ç¯ããéãã¨ãã¦ã¯ãå§åçã«Application Composerãæ©ãã§ãããããæ©ããã¦ãããã¤è¿½ãã¤ããªãåé¡ãåºã¦ããããªã¬ãã«ã§ããSAMæ¯è¼ããã¨è¥å¹²CDKã®æ¹ãããã°ã©ãã³ã°è¨èªãå©ç¨ãã¦ããã¨ããã¡ãªãããããããæ§ç¯ã¹ãã¼ãã¯æ©ãã§ãããªã®ã§ãApplication Composerã§ä½æãããã³ãã¬ã¼ãããä¿®æ£ããç¹ãå¤ããã°å¤ãã»ã©Application COmposer+SAMããCDKã®æ¹ãæ©ãæ§ç¯ã§ãã¾ãã
ç¶²ç¾ ç
Application Composerã®ã¹ãã¼ãã¯æ©ãã§ããããµãã¼ãããã¦ããªããªã½ã¼ã¹ãç´°ããè¨å®ã¯åºæ¥ãªãã®ã§ããã®é¨åã¯SAMã§è¨å®ãããã¨ã«ãªãã¾ããããã«å¯¾ãã¦ãCDKã¯å¤§ä½ã®ãªã½ã¼ã¹ã¨ãã®è¨å®ã¯å¯è½ã§ãããã®ããããµã¼ãã¬ã¹ä»¥å¤ã®ãªã½ã¼ã¹ãåããã¦å©ç¨ããå ´åããç´°ããè¨å®ã»æ¨©éå¶å¾¡ãå ¥ãããå ´åã¯æåããCDKãè¯ããã¨æããã¾ããä¾ãã°S3->Lambdaæ§æãApplication Composerããä½ãã¨ããªãã¸ã§ã¯ãã®ä½æã»åé¤ã§Lambdaãèµ·åãããããªãã³ãã¬ã¼ããä½ããã¾ããããããåé¤æã«Lambdaãèµ·åããããªãå ´åã¯SAMããä¿®æ£ãå¿ è¦ã§ãããã®ãããªApplication Composerã ãã§çµãããªãä¿®æ£ãæã å ¥ãã®ã§ããã°CDKãè¯ãã§ãã
ã³ã¼ãé
SAMã¨CDKã§ã³ã¼ãéã®æ¯è¼ããã¦ã¿ã¾ãã対象ãªã½ã¼ã¹ãå°ãªããã¡ã¯SAMã¨CDKã¯åããããã®ã³ã¼ãéã«ãªããã¨æãã¾ãããããã対象ãªã½ã¼ã¹ãå¢ãã¦ããã¨ãCDKã ã¨åããã®ãæ¬ã£ã¦é¢æ°ååºæ¥ãã®ã§ããã®åã³ã¼ãéã¯æ¸ãã¾ããã¾ãCDKã¯æ¸ãã¹ãè¨å®ãæå°éã«ãªã£ã¦ããã®ã§ããã®åå°ãªãæ¸ããã¨ãåºæ¥ã¾ãããã®ããã大è¦æ¨¡ãªãã®ã¯CDKã®æ¹ãã³ã¼ãéã¨ãã¦ã¯å°ãªããªãã¾ãã
æ¯è¼ã®ã¾ã¨ã
ã§ã¯ãæ¯è¼ããå 容ãã¾ã¨ãã¾ãã
Application Composer + SAM | CDK | |
---|---|---|
ããã㤠| å¯è½ | å¯è½ |
èªåããã㤠| å¯è½ | å¯è½ |
ã¤ã³ã¿ãã§ã¼ã¹ | GUI/CUI | CUI |
è¨èª | yaml/json | Python/TypeScript/JavaScript/Java/C#/Go |
å¿ è¦ãªç¥è | ãµã¼ãã¬ã¹ã¢ã¼ããã¯ã㣠ãã¼ã«ã®ä½¿ãæ¹ yaml/json |
ãµã¼ãã¬ã¹ã¢ã¼ããã¯ã㣠ãã¼ã«ã®ä½¿ãæ¹ ããã°ã©ãã³ã°è¨èª |
æ§ç¯ã¹ãã¼ã | æ©ãï¼é ã | æ®é |
ç¶²ç¾ æ§ | åºã | åºã |
ã³ã¼ãé | å¤ã | å°ãªã |
ä¸è¨ãã¾ã¨ããã¨ãApplication Composer + SAMã®ã¿ã¼ã²ããã¨ãã¦ã¯ãä¸è¨ã«ãªãã¾ãã
- ãµã¼ãã¬ã¹ã¢ã¼ããã¯ãã£åå¿è ãå¤ããã¼ã
- å°è¦æ¨¡ã¢ã¼ããã¯ãã£
- ãµã¼ãã¬ã¹ä»¥å¤ã®ã¢ã¼ããã¯ãã£ãå°ãªããã®
- ã»ãã¥ãªãã£ãªã©ã®ç¬èªè¦ä»¶ãå¤ããªããã®
éã«CDKã®ã¿ã¼ã²ããã¨ãã¦ã¯ä¸è¨ã«ãªãã¾ãã
- 大è¦æ¨¡ã¢ã¼ããã¯ãã£
- ãµã¼ãã¬ã¹ä»¥å¤ã®ã¢ã¼ããã¯ãã£ãå¤ãæ¡ç¨ãã¦ãã
- æ§ã ãªè¦ä»¶ãçºçãããã®
ãã®ãããèªåãã¡ã®ãã¼ã ãã©ãã«å½ã¦ã¯ã¾ãããèãã¦é¸æãã¦ããã¹ãã§ãã
Application Composerã«CDKãé©ç¨ããæ義
ä»ã¾ã§ã®è©±ã§Application Composerã使ããã¨ã®ã¡ãªããã¯ä¸è¨ã«ãªãã¾ãã
- åå¿è ãã³ã¼ãã®æ¸ãæ¹ãå¦ã¹ã
- ã³ã¼ãã£ã³ã°ã®ã¹ãã¼ãã¢ãã
- ã³ã¼ããWell-Architectedãªç¶æ ã«ãªã
CDKã¨ãã¦ã3çªç®ã®ãWell-Architectedãªç¶æ ã«ãªããã«é¢ãã¦ã¯ã¯ãªã¢åºæ¥ã¦ãã¾ãããããã1çªç®ã¨2çªç®ã«é¢ãã¦ã¯CDKã ãã§ã¯å¯¾å¿åºæ¥ã¾ããã
ããã§ãApplication Composerã«CDKãé©ç¨ãããã¨ãä¸è¨ã®ãããªæ§æã«ãªãã¾ãã
ã¾ãã¯ã¦ã¼ã¶ã¯Application Composerã®GUIç»é¢ã§ã¢ã¼ããã¯ãã£ãä½ããããããCDKã®ã³ã¼ããåºåããã¾ããä»ã¾ã§ã¯CDKããã¥ã¡ã³ããçºãã¦å¿ è¦ãªãªã½ã¼ã¹ã®ãã¼ã¸ãããµã³ãã«ãã³ãã¼ãã¦ãã©ã¤ã¢ã³ãã¨ã©ã¼ãç¹°ãè¿ãã¦ä½ã£ã¦ããã¾ãããå ¬å¼ããã¥ã¡ã³ãã§ããééã£ã¦ããã³ã¼ããããã®ã§ããããé©å®ä¿®æ£ããå¿ è¦ãããã¾ããããããApplication Composerããå¤æã§ããã°ãåºæ¬çã«ã¯ä¿®æ£ããå¿ è¦ã®ãªãã³ã¼ããåºæ¥ä¸ããã®ã§ãæåã®ããã¥ã¡ã³ãæ¢ãã¨ã³ã¼ãä¿®æ£ã®æéãä¸è¦ã«ãªãã¾ãã
ã¾ããä»åå©ç¨ããS3->Lambdaã®æ§æã§S3ããLambdaã«ç·ãç¹ãã æã«CDKã³ã¼ãã§lambda_.add_event_source
ã®ã³ã¼ãã追å ããããã¨ã§ãLambdaã®é¢æ°ããã¤ãã³ãã®è¿½å ãåºæ¥ãäºãå¦ã¹ã¾ããä»ã¾ã§ã¯æ¤ç´¢ãããããã¥ã¡ã³ããããªãã¨ãæ¢ãå½ã¦ãããç¡ãã£ãã®ã§ãå§åçãªæéã®ç¯ç´ã«ãªãã¾ãã
ãªã®ã§ãApplication ComposerããCDKãµãã¼ããããã¨ãåå¿è ã®æ·å± ãä¸ããã³ã¼ãã£ã³ã°ã¹ãã¼ããåçã«ä¸ããã®ã§ãCDK人å£ãã©ãã©ãå¢ãã¦ãããã¼ã«ãªãæªæ¥ããè¦ãã¾ãããçããã¬ã³ã¬ã³è¦æä¸ãã¦ããã¾ãããã
ãããã«
Application Composerã¯ãµã¼ãã¬ã¹ã¢ã¼ããã¯ãã£ãå§ããã°ããã®æ¹ã«ã¨ã£ã¦ã¯è¦è¦çã«ä½ããã®ã§ãããè¯ããµã¼ãã¹ãªã®ã§ãå¨ãã«ãã³ãã³å§ãã¦ãã£ã¦ãµã¼ãã¬ã¹ä½ãã人æãå¢ããã¦ããã¾ããããããã¦ãCDKããµãã¼ããããã¨ããã°ã©ãã³ã°è¨èªã ããã¨æ¬é ãã¦ãã人ãã¡ãå ¥ãããããªãã®ã§ãCDKãµãã¼ããããæ¥ã楽ãã¿ã«ãã¦ãã¾ãã
ã§ã¯ãè¸ã¾ãã¦å£ããã©ã¤ãã»ã¼ãã¼ã®æ¨ã¦æ¹ã調ã¹ã¦ãã¾ãã