ladderlore
  • S3 や IAM などのサービス名を入力してください。

概念

Security in a VPC: security groups and network ACLs

Security groups guard each instance, network ACLs guard each subnet, and Amazon Inspector finds weak spots.

このレッスンはまだ翻訳されていないため、英語で表示しています。

  • Works at

    Security group
    Instance level. It is attached to each resource, such as an EC2 instance.
    Network ACL
    Subnet level. It covers every resource in the subnet.
  • Rules

    Security group
    Allow rules only
    Network ACL
    Allow rules and deny rules
  • Return traffic

    Security group
    Allowed automatically (stateful)
    Network ACL
    Needs a rule of its own (stateless)
  • How rules are checked

    Security group
    All rules together
    Network ACL
    In number order. The first match decides.
  • At the start

    Security group
    A new group allows no inbound traffic and all outbound traffic.
    Network ACL
    The default network ACL allows all traffic. A new custom one denies all traffic.
  • Typical use

    Security group
    Open only the ports an application needs, such as HTTPS for a web server.
    Network ACL
    Block a range of IP addresses for a whole subnet.
Security groups and network ACLs side by side.

1 / 3

  • Works at

    Security group
    Instance level. It is attached to each resource, such as an EC2 instance.
    Network ACL
    Subnet level. It covers every resource in the subnet.
  • Rules

    Security group
    Allow rules only
    Network ACL
    Allow rules and deny rules

2 / 3

  • Return traffic

    Security group
    Allowed automatically (stateful)
    Network ACL
    Needs a rule of its own (stateless)
  • How rules are checked

    Security group
    All rules together
    Network ACL
    In number order. The first match decides.

3 / 3

  • At the start

    Security group
    A new group allows no inbound traffic and all outbound traffic.
    Network ACL
    The default network ACL allows all traffic. A new custom one denies all traffic.
  • Typical use

    Security group
    Open only the ports an application needs, such as HTTPS for a web server.
    Network ACL
    Block a range of IP addresses for a whole subnet.
Security groups and network ACLs side by side.
VPCSubnet
インターネット
Subnet’s network ACL
Instance’s security group
EC2Inspector
  1. 1Traffic reaches the subnet. Its network ACL checks the rules in number order and allows or denies it.
  2. 2Allowed traffic reaches the instance’s security group, which passes only traffic that one of its rules allows.
  3. 3The instance receives the request. Its reply goes back through the security group automatically, but the network ACL must also allow it out.
  4. 4Amazon Inspector scans the instance for software vulnerabilities and for network paths that expose it by mistake.
Traffic passes the network ACL at the edge of the subnet, then the security group at the instance.

流れ

  1. 1Traffic reaches the subnet. Its network ACL checks the rules in number order and allows or denies it.
  2. 2Allowed traffic reaches the instance’s security group, which passes only traffic that one of its rules allows.
  3. 3The instance receives the request. Its reply goes back through the security group automatically, but the network ACL must also allow it out.
  4. 4Amazon Inspector scans the instance for software vulnerabilities and for network paths that expose it by mistake.

Traffic passes the network ACL at the edge of the subnet, then the security group at the instance.

概要

A VPC has two built-in firewalls. A security group is attached to a resource, such as an Amazon EC2 instance, and allows only the traffic its rules name. A network access control list (network ACL) is attached to a subnet and checks all traffic that enters or leaves that subnet. Used together, they give two layers of defense.

概要

The main difference is memory. A security group is stateful: when a request is allowed in, the reply is allowed out automatically. A network ACL is stateless: it does not remember earlier traffic, so replies need a rule of their own. Security groups can only allow traffic. Network ACLs can also deny it, which makes them the tool for blocking a specific range of IP addresses.

概要

Firewall rules cannot tell you whether the software on an instance is safe. Amazon Inspector fills that gap. It continually scans EC2 instances, container images in Amazon Elastic Container Registry (Amazon ECR) and AWS Lambda functions for known software vulnerabilities. It also reports EC2 instances with ports that can be reached from outside the VPC, which often means a security group or network ACL is too open.

To see what the rules let through, turn on VPC Flow Logs. They record the IP traffic going to and from the network interfaces in a VPC, and whether it was accepted or rejected.

覚えること

  • Security group: instance level, stateful, allow rules only.
  • Network ACL: subnet level, stateless, allow and deny rules, checked in number order.
  • A new security group allows no inbound traffic until you add a rule.
  • Each subnet is linked to one network ACL. The default network ACL allows all traffic.

覚えること

  • Security groups and network ACLs have no extra charge.
  • Amazon Inspector reports problems. It does not block traffic.

試験では

  • “Block a range of IP addresses from reaching a whole subnet” points to a network ACL, because security groups have no deny rules.
  • “A virtual firewall for an instance that automatically allows return traffic” is a security group.
  • “Continually scan EC2 instances for software vulnerabilities and unintended network exposure” points to Amazon Inspector.