Parameters:
  BucketName:
    Type: String
    Description: 생성할 S3 버킷 이름
    Default: "wsi-static-bucket-2025-local"

  MainPageFileName:
    Type: String
    Description: 업로드할 메인 페이지 파일 이름
    Default: "index.html"

  AllowHost:
    Type: String
    Description: 접근을 허용할 IP 주소 쉼표로 구분된 목록. "all"은 모든 사용자, "none"은 허용 안함
    Default: "all"

  DenyHost:
    Type: String
    Description: 접근을 거부할 IP 주소 쉼표로 구분된 목록. "all"은 모든 사용자, "none"은 거부 없음
    Default: "none"

  LambdaFunctionArn:
    Type: String
    Description: 커스텀 리소스에 사용할 Lambda 함수의 ARN
    Default: "arn:aws:lambda:ap-northeast-2:362708816803:function:wsi-lambda"

Resources:
  CustomS3StaticPage:
    Type: AWS::CloudFormation::CustomResource
    Properties:
      ServiceToken: !Ref LambdaFunctionArn
      s3BucketName: !Ref BucketName
      mainPage: !Ref MainPageFileName
      allowHost: !Ref AllowHost
      denyHost: !Ref DenyHost

Outputs:
  BucketName:
    Description: 생성된 S3 버킷 이름
    Value: !GetAtt CustomS3StaticPage.BucketName

  WebsiteURL:
    Description: 정적 웹사이트 URL
    Value: !GetAtt CustomS3StaticPage.WebsiteURL
aws cloudformation create-stack \\
  --stack-name static-web-stack \\
  --template-body file://simplified-s3-template.yaml

스크린샷 2025-04-04 오후 11.35.04.png

스크린샷 2025-04-04 오후 11.35.32.png

image.png