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) us-east-2 : US East (Ohio) 14) ca-central-1 : Canada (Central) 15) eu-west-2 : EU (London) (default is 3): 1
Select an application to use 1) GTCafe-Pay 2) [ Create new Application ] (default is 2): 2
Enter Application Name (default is "NodeApp"): Application NodeApp has been created.
It appears you are using Node.js. Is this correct? (Y/n): y 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) virginia.lab 2) [ Create new KeyPair ] (default is 1): 1
eb create Enter Environment Name (default is NodeApp-dev): ec2-classic Enter DNS CNAME prefix (default is ec2-classic):
Select a load balancer type 1) classic 2) application (default is 1): 1 Creating application version archive "app-170722_122611". Uploading NodeApp/app-170722_122611.zip to S3. This may take a while. Upload Complete. Environment details for: ec2-classic Application name: NodeApp Region: us-east-1 Deployed Version: app-170722_122611 Environment ID: e-pwhi9zpuun Platform: arn:aws:elasticbeanstalk:us-east-1::platform/Node.js running on 64bit Amazon Linux/4.2.0 Tier: WebServer-Standard CNAME: ec2-classic.us-east-1.elasticbeanstalk.com Updated: 2017-07-22 04:26:31.635000+00:00 Printing Status: INFO: createEnvironment is starting.
... 略 ...
INFO: Environment health has transitioned from Pending to Ok. Initialization completed 14 seconds ago and took 3 minutes. INFO: Successfully launched environment: ec2-classic
順利的話就可以點選 URL 看到 express 的頁面。
建立 EB 環境 - EC2 in VPC
實務上會建議把 EC2 建立在 VPC 裡面,以下是我的建立設定:
ELB 放在 Public Subnet
EC2 放在 Public Subnet with EIP for Testing (因為沒有 NAT Instance)
~ eb terminate The environment "NodeApp-Dev2" and all associated instances will be terminated. To confirm, type the environment name: NodeApp-Dev2 INFO: terminateEnvironment is starting. INFO: Deleted CloudWatch alarm named: awseb-e-bmnvy3e2gs-stack-AWSEBCloudwatchAlarmHigh-HKSCZ06VXFVF INFO: Deleted CloudWatch alarm named: awseb-e-bmnvy3e2gs-stack-AWSEBCloudwatchAlarmLow-Y7CLMSR42ARI