January 2019
Intermediate to advanced
484 pages
11h 48m
English
Once VPC and subnets with related gateways/routes are ready, you can create EC2 instances. However, at least one access control needs to be created beforehand; this is called a security group. It can define ingress (incoming network access) and egress (outgoing network access) firewall rules.
In the following example, a security group and a rule for public subnet hosts are created that allows SSH from your machine's IP address, as well as open HTTP (80/tcp) world-wide:
//create one security group for public subnet
$ aws ec2 create-security-group --vpc-id vpc-0ca37d4650963adbb --group-name public --description "public facing host"{ "GroupId": "sg-03973d9109a19e592"}
//check your machine's public IP (if not sure, use 0.0.0.0/0 ...Read now
Unlock full access