FROM lambci/lambda:build-python3.6 WORKDIR /var/task # Fancy prompt to remind you are in zappashell RUN echo 'export PS1="\[\e[36m\]zappashell>\[\e[m\] "' >> /root/.bashrc # Additional RUN commands here # RUN yum clean all && \ # yum -y install <stuff> CMD ["bash"]
Tip: AWS_PROFILE 대신에 AWS_SECRET_ACCESS_KEY, AWS_ACCESS_KEY_ID, AWS_DEFAULT_REGION 환경변수를 대신 설정하셔도 됩니다.
zappa init
1 2 3 4 5 6 7 8 9
zappa init 실행 (ve) zappashell> zappa init 웰컴 메세지 ███████╗ █████╗ ██████╗ ██████╗ █████╗ ╚══███╔╝██╔══██╗██╔══██╗██╔══██╗██╔══██╗ ███╔╝ ███████║██████╔╝██████╔╝███████║ ███╔╝ ██╔══██║██╔═══╝ ██╔═══╝ ██╔══██║ ███████╗██║ ██║██║ ██║ ██║ ██║ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═╝ ╚═╝ ╚═╝ Welcome to Zappa! Zappa is a system for running server-less Python web applications on AWS Lambda and AWS API Gateway. This `init` command will help you create and configure your new Zappa deployment. Let's get started!
배포 구분 : dev (개발), staging (비프로덕션 테스트), production (실서 비스)
1
Your Zappa configuration can support multiple production stages, like 'dev', 'staging', and 'production'. What do you want to call this environment (default 'dev'):
AWS Credential - Profile 선택
1 2
AWS Lambda and API Gateway are only available in certain regions. Let's check to make sure you have a profile set up in one that will work. Okay, using profile zappa!
zappa 이름의 profile*이 있어서,* 디폴트 지정되었습니다.
배포코드를 저장할 S3 버킷명
1 2
Your Zappa deployments will need to be uploaded to a private S3 bucket. If you don't have a bucket yet, we'll create one for you too. What do you want call your bucket? (default 'zappa-1i7vt2z5p'):
구동할 장고 애플리케이션 settings 경로
1 2 3 4
It looks like this is a Django application! What is the module path to your projects's Django settings? We discovered: askdjango.settings Where are your project's settings? (default 'askdjango.settings'):
글로벌 배포 여부
1 2
You can optionally deploy to all available regions in order to provide fast global service. If you are using Zappa for the first time, you probably don't want to do this! Would you like to deploy this application globally? (default 'n') [y/n/(p)rimary]: n
생성된 zappa_settings.json 내역
1 2 3 4 5 6 7 8 9 10
Okay, here's your zappa_settings.json: { "dev": { "aws_region": "ap-northeast-2", "django_settings": "askdjango.settings", "profile_name": "zappa", "project_name": "task", "runtime": "python3.6", "s3_bucket": "zappa-1i7vt2z5p" } } Does this look okay? (default 'y') [y/n]: y
나머지 안내
1 2 3 4 5 6 7 8 9 10 11
Done! Now you can deploy your Zappa application by executing: $ zappa deploy dev After that, you can update your application code with: $ zappa update dev To learn more, check out our project page on GitHub here: https://github.com/Miserlou/Zappa and stop by our Slack channel here: https://slack.zappa.io
Enjoy!, ~ Team Zappa!
첫배포수행
1 2 3 4 5 6 7 8 9 10 11 12 13
(ve) zappashell> zappa deploy dev (botocore 1.8.6 (/var/task/ve/lib/python3.6/site-packages), Requirement.parse('botocore<1.8.0,>=1.7.0'), {'boto3'}) Calling deploy for stage dev.. Downloading and installing dependencies.. - pillow==4.3.0: Downloading 100%|███████████████████████████████████████| 5.82M/5.82M [00:01<00:00, 5.35MB/s] - sqlite==python36: Using precompiled lambda package Packaging project as zip. Uploading task-dev-1512376218.zip (21.9MiB).. 100%|███████████████████████████████████████| 23.0M/23.0M [00:03<00:00, 5.99MB/s] Scheduling.. Scheduled task-dev-zappa-keep-warm-handler.keep_warm_callback with expression rate(4 minutes)! Uploading task-dev-template-1512376324.json (1.6KiB).. 100%|███████████████████████████████████████| 1.61K/1.61K [00:00<00:00, 50.7KB/s] Waiting for stack task-dev to create (this can take a bit).. 100%|███████████████████████████████████████| 4/4 [00:12<00:00, 4.31s/res] Deploying API Gateway.. Deployment complete!: https://rw8qusuhq7.execute-api.ap-northeast-2.amazonaws.com/dev
접속 URL
1 2 3 4 5
https://rw8qusuhq7.execute-api.ap-northeast-2.amazonaws.com/dev/ ^^^^^^^^^^^^^^^^^^^^^^ Auto Generated API Gateway ^^^ Your Zappa Environment
추후 업데이트 시
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
(ve) zappashell> zappa update dev (botocore 1.8.6 (/var/task/ve/lib/python3.6/site-packages), Requirement.parse('botocore<1.8.0,>=1.7.0'), {'boto3'}) Calling update for stage dev.. Downloading and installing dependencies.. - pillow==4.3.0: Using locally cached manylinux wheel - sqlite==python36: Using precompiled lambda package Packaging project as zip. Uploading task-dev-1512376455.zip (21.9MiB).. 100%|███████████████████████████████████████| 23.0M/23.0M [00:03<00:00, 6.20MB/s] Updating Lambda function code.. Updating Lambda function configuration.. Uploading task-dev-template-1512376560.json (1.6KiB).. 100%|███████████████████████████████████████| 1.61K/1.61K [00:00<00:00, 44.0KB/s] Deploying API Gateway.. Scheduling.. Unscheduled task-dev-zappa-keep-warm-handler.keep_warm_callback. Scheduled task-dev-zappa-keep-warm-handler.keep_warm_callback with expression rate(4 minutes)! Your updated Zappa deployment is live!: https://rw8qusuhq7.execute-api.ap-northeast-2.amazonaws.com/dev