Now you need to upload your ssh public key and then launch the EC2 instance on both the public subnet and the private subnet:
- Upload your ssh public key (assume you have a public key that is located at ~/.ssh/id_rsa.pub):
$ aws ec2 import-key-pair --key-name=chap6-key --public-key-material "`cat ~/.ssh/id_rsa.pub`"
- Launch the first EC2 instance with the following parameters:
- Use Amazon Linux image: ami-1853ac65 (Amazon Linux)
- T2.nano instance type: t2.nano
- Ssh key: chap6-key
- Public Subnet: subnet-6296863f
- Public Security Group: sg-dd8a3f94
$ aws ec2 run-instances --image-id ami-1853ac65 --instance-type t2.nano --key-name chap6-key --security-group-ids sg-dd8a3f94 --subnet-id subnet-6296863f
- Launch the second EC2 instance with ...