1. 설치 작업
- Git
- AWS SAM CLI
- CloudFormation Linter (cfn-lint) > 필수는 아님 템플릿 커스터마이징 하고 싶으면 추천
2. private s3 버킷 생성
> 압축된 람다 함수와 압축된 템플릿을 넣기 위함
3. git clone 하기
git clone https://github.com/awslabs/aws-api-gateway-developer-portal.git
cd aws-api-gateway-developer-portal
4. 사용하는 IDE에서 디렉토리 열고 template.yaml 파일 찾기
5. 터미널 열어서 SAM CLI 명령어 실행
맥
# macOS, Linux, and similar
sam package --template-file ./cloudformation/template.yaml \
--output-template-file ./cloudformation/packaged.yaml \
--s3-bucket "YOUR_LAMBDA_ARTIFACTS_BUCKET"
윈도우
rem Windows
sam package --template-file .\cloudformation\template.yaml ^
--output-template-file .\cloudformation\packaged.yaml ^
--s3-bucket "YOUR_LAMBDA_ARTIFACTS_BUCKET"
6. 배포하기 위해 이어서 다음 명령어 실행
맥
# macOS, Linux, and similar
sam deploy --template-file ./cloudformation/packaged.yaml \
--stack-name "dev-portal" \
--s3-bucket "YOUR_LAMBDA_ARTIFACTS_BUCKET" \
--capabilities CAPABILITY_NAMED_IAM \
--parameter-overrides \
DevPortalSiteS3BucketName="YOUR_CUSTOM_PREFIX-dev-portal-static-assets" \
ArtifactsS3BucketName="YOUR_CUSTOM_PREFIX-dev-portal-artifacts" \
CognitoDomainNameOrPrefix="YOUR_CUSTOM_PREFIX"
윈도우
rem Windows
sam deploy --template-file .\cloudformation\packaged.yaml ^
--stack-name "dev-portal" ^
--s3-bucket "YOUR_LAMBDA_ARTIFACTS_BUCKET" ^
--capabilities CAPABILITY_NAMED_IAM ^
--parameter-overrides ^
DevPortalSiteS3BucketName="YOUR_CUSTOM_PREFIX-dev-portal-static-assets" ^
ArtifactsS3BucketName="YOUR_CUSTOM_PREFIX-dev-portal-artifacts" ^
CognitoDomainNameOrPrefix="YOUR_CUSTOM_PREFIX"
이때 CAPABILITY_NAMED_IAM 에도 값을 넣어야 함 placeholder 아님~
7. AWS CLI 설치했으면 명령어 실행
맥
# macOS, Linux, and similar
aws cloudformation describe-stacks --query \
"Stacks[?StackName=='dev-portal'][Outputs[?OutputKey=='WebsiteURL']][][].OutputValue"
윈도우
rem Windows
aws cloudformation describe-stacks --query ^
"Stacks[?StackName=='dev-portal'][Outputs[?OutputKey=='WebsiteURL']][][].OutputValue"
설치 안되어있으면 CloudFormation 콘솔을 열고 개발자 포털의 스택을 열고 "출력" 탭으로 이동
"WebsiteURL"을 검색
URL이 클릭 가능한 링크로 표시됨
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>참고
https://github.com/awslabs/aws-api-gateway-developer-portal/blob/main/BUILDING_SAM.md
'AWS' 카테고리의 다른 글
[AWS] Lambda 모듈 사용법 (cannot find module error) (0) | 2024.01.29 |
---|---|
[AWS] API Gateway란? (0) | 2024.01.24 |
[AWS] Lambda 함수란? (0) | 2024.01.19 |