위시켓은 AWS Cloud Development Kit (이하 CDK)를 주요 Infrastructure-as-Code 도구로 활용하여 배포 자동화를 구현하고 있습니다. CDK는 TypeScript를 기반으로 하며, 프로그래밍 언어의 장점을 활용하여 인프라를 코드로 관리합니다.
CDK는 L1(CloudFormation 직접 매핑), L2(추상화된 리소스), L3(패턴) 세 가지 수준의 Construct를 제공합니다. 위시켓은 L3 Construct(패턴) 우선 사용을 원칙으로 합니다:
L3 Construct 활용 예시:
// ECS Fargate 서비스 + ALB (aws-ecs-patterns)
import { ApplicationLoadBalancedFargateService } from 'aws-cdk-lib/aws-ecs-patterns';
new ApplicationLoadBalancedFargateService(this, 'Service', {
cluster,
taskImageOptions: {
image: ContainerImage.fromEcrRepository(repository),
},
});
// API Gateway + Lambda (aws-apigateway)
import { LambdaRestApi } from 'aws-cdk-lib/aws-apigateway';
new LambdaRestApi(this, 'Api', {
handler: myFunction,
});
참고: AWS CDK Constructs, L3 Constructs - AWS Prescriptive Guidance
CDK 배포 전 다음 검증 단계를 기본으로 수행합니다:
cdk synth - CloudFormation 템플릿 생성 및 검증cfn-lint - CloudFormation 베스트 프랙티스 검증