EB CLI
Installation
$ pip install awsebcli --upgrade --user
$ pip install awsebcli --upgrade --user
참조.
https://docs.aws.amazon.com/ko_kr/elasticbeanstalk/latest/dg/eb-cli3-install.html
IAM (prerequirement)
IAM 에서 그룹을 만들고, 사용자를 추가한다. 그 후 사용주의 Access key ID 와 Secret access key를 저장해 놓는다. 이 정보를 향우 eb cli 에서 사용한다.
예시
Username : jjangga0214
Access key ID : AK27AIAJNZ4AROTLI2PF
Secret access key : hTVsON6Pcn3VS9pWmUNlufaDjeQBqvYxzCJwRvVB
Usage
eb init
리전, 애플리케이션, 플랫폼, keypair, ssh 설정을 한다. ssh 사용 설정을 하는 것이 핵심이다.
user@JJANGGA:~$ eb init
Select a default region
1) us-east-1 : US East (N. Virginia)
2) us-west-1 : US West (N. California)
3) us-west-2 : US West (Oregon)
4) eu-west-1 : EU (Ireland)
5) eu-central-1 : EU (Frankfurt)
6) ap-south-1 : Asia Pacific (Mumbai)
7) ap-southeast-1 : Asia Pacific (Singapore)
8) ap-southeast-2 : Asia Pacific (Sydney)
9) ap-northeast-1 : Asia Pacific (Tokyo)
10) ap-northeast-2 : Asia Pacific (Seoul)
11) sa-east-1 : South America (Sao Paulo)
12) cn-north-1 : China (Beijing)
13) cn-northwest-1 : China (Ningxia)
14) us-east-2 : US East (Ohio)
15) ca-central-1 : Canada (Central)
16) eu-west-2 : EU (London)
17) eu-west-3 : EU (Paris)
(default is 3): 10
Select an application to use
1) mama-test
2) mama
3) 첫 번째 Elastic Beanstalk 애플리케이션
4) [ Create new Application ]
(default is 4): 4
Enter Application Name
(default is "user"): mama-index
Application mama-index has been created.
Select a platform.
1) Node.js
2) PHP
3) Python
4) Ruby
5) Tomcat
6) IIS
7) Docker
8) GlassFish
9) Go
10) Java
11) Packer
(default is 1): 10
Select a platform version.
1) Java 8
2) Java 7
(default is 1): 1
Cannot setup CodeCommit because there is no Source Control setup, continuing with initialization
Do you want to set up SSH for your instances?
(Y/n): Y
Select a keypair.
1) codingeverybody_key
2) example_server
3) zaeval.ga
4) [ Create new KeyPair ]
(default is 3): 4
Type a keypair name.
(Default is aws-eb): mama-keypair
Generating public/private rsa key pair.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/user/.ssh/mama-keypair.
Your public key has been saved in /home/user/.ssh/mama-keypair.pub.
The key fingerprint is:
SHA256:yTBgiEDStw4ZosJb5npyoWupWk2HXJ7VBqGGZZ70CUw mama-keypair
The key's randomart image is:
+---[RSA 2048]----+
|=+ .ooE o. |
|+ +..B.= + |
|o. +..O + o |
|o.o+.= * o |
|. =o+ + S |
| . =.. |
| = o |
| B o |
|*.= |
+----[SHA256]-----+
Enter passphrase:
WARNING: Uploaded SSH public key for "mama-keypair" into EC2 for region ap-northeast-2.
환경 설정
Web Console 에 접속해 환경에 실제 jar 파일을 업로드 한다.
eb ssh ${EnvirnmentName}
user@JJANGGA:~$ eb ssh MamaIndex-env
INFO: Attempting to open port 22.
INFO: SSH port 22 open.
INFO: Running ssh -i /home/user/.ssh/mama-keypair [email protected]
The authenticity of host '13.125.226.183 (13.125.226.183)' can't be established.
ECDSA key fingerprint is SHA256:vMVlUg/oy+9yIe+CRS0Xbbn3d+mfh6tLXH08QniX4Q0.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '13.125.226.183' (ECDSA) to the list of known hosts.
_____ _ _ _ ____ _ _ _
| ____| | __ _ ___| |_(_) ___| __ ) ___ __ _ _ __ ___| |_ __ _| | | __
| _| | |/ _` / __| __| |/ __| _ \ / _ \/ _` | '_ \/ __| __/ _` | | |/ /
| |___| | (_| \__ \ |_| | (__| |_) | __/ (_| | | | \__ \ || (_| | | <
|_____|_|\__,_|___/\__|_|\___|____/ \___|\__,_|_| |_|___/\__\__,_|_|_|\_\
Amazon Linux AMI
This EC2 instance is managed by AWS Elastic Beanstalk. Changes made via SSH
WILL BE LOST if the instance is replaced by auto-scaling. For more information
on customizing your Elastic Beanstalk environment, see our documentation here:
http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customize-containers-ec2.html
[ec2-user@ip-172-31-15-211 ~]$