-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating

Infrastructure as Code Cookbook
By :

Amazon's security groups are similar to traditional firewalls, with ingress (incoming traffic) and egress (outgoing traffic) rules applied to EC2 instances. Those rules can be updated on-demand. We'll create an initial security group allowing ingress Secure Shell (SSH) traffic only for our own IP address, while allowing all outgoing traffic.
To step through this recipe, you will need the following:
A working Terraform installation
An AWS provider configured in Terraform (refer to the previous recipe)
An Internet connection
The resource we're using is called aws_security_group
. Here's the basic structure:
resource "aws_security_group" "base_security_group" { name = "base_security_group" description = "Base Security Group" ingress { } egress { } }
We know we want to allow inbound TCP/22 for SSH only for our own IP (replace 1.2.3.4/32 with yours!), and allow everything outbound. Here's how it looks:
ingress { from_port...
Change the font size
Change margin width
Change background colour