กลุ่มความปลอดภัยและ NACL
ใช้งานการรักษาความปลอดภัยระดับเครือข่ายที่รัดกุมด้วยการควบคุมการรับส่งข้อมูลขาเข้าและขาออกสำหรับอินสแตนซ์และซับเน็ต
กลุ่มความปลอดภัยและ NACL เป็นบทเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) ฟรีบน CoddyKit นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส AWS for Backend Developers (EC2, S3, RDS, Lambda) มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Guarding Your AWS Network
Securing your AWS resources is crucial. Think of your cloud environment as a house – you need good locks on the doors and windows.
In AWS, two key services act as virtual firewalls to protect your instances and subnets: Security Groups and Network Access Control Lists (NACLs).
Instance-Level Firewalls
A Security Group acts as a virtual firewall for your EC2 instances (or other resources like RDS instances or Load Balancers).
It controls inbound and outbound traffic at the instance level. When you launch an EC2 instance, you associate one or more security groups with it.
Security Group Rules
Security Groups have rules that specify which traffic is allowed to reach your instances (inbound) and which traffic your instances can send out (outbound).
- Inbound Rules: Define what traffic can enter your instance.
- Outbound Rules: Define what traffic can leave your instance.
By default, outbound traffic is usually allowed, but inbound traffic is denied.
Stateful Protection
A key characteristic of Security Groups is that they are stateful.
This means if you allow an inbound request (e.g., a web request to your server), the Security Group automatically allows the corresponding outbound response to flow back, even if there isn't an explicit outbound rule for it.
It remembers the connection's "state."
What are Network ACLs (NACLs)?
A Network Access Control List (NACL) acts as a virtual firewall for your subnets. It controls traffic entering and exiting the entire subnet.
Unlike Security Groups, NACLs are applied to subnets, meaning all instances within that subnet are subject to its rules.
NACL Rules Explained
NACLs have numbered rules that are evaluated in order, from lowest to highest. When a rule matches traffic, it's applied, and no further rules are evaluated.
NACLs can explicitly allow or deny traffic. Every NACL also has a default deny rule (*) at the end to catch any unmatched traffic.
Stateless Protection
Another key difference: NACLs are stateless.
If you allow inbound traffic, you MUST explicitly create a separate outbound rule to allow the response traffic to return. If you don't, the response will be blocked.
This means you need rules for both directions for any connection.
Key Differences at a Glance
- Scope: SG for instances, NACL for subnets.
- State: SG is stateful, NACL is stateless.
- Rules: SG only allows, NACL allows AND denies.
- Evaluation: SG evaluates all rules, NACL evaluates by rule number (lowest first).
- Default: SG denies inbound, allows outbound. NACL allows all by default, then denies all with * rule.
Layered Security
It's best practice to use both Security Groups and NACLs together for layered security:
- Use NACLs to broadly filter traffic at the subnet boundary, blocking known malicious IPs or port ranges.
- Use Security Groups to provide fine-grained control for specific instances, allowing only necessary traffic to reach them.
This creates a robust defense-in-depth strategy.
Understanding the Layers
You have an EC2 instance in a public subnet. You want to allow SSH (port 22) and HTTP (port 80) traffic to reach it from anywhere, and block all other incoming traffic.
Securing Your Network
Great job! You've learned about two fundamental AWS networking security tools:
- Security Groups: Stateful firewalls for instances, allowing specific inbound/outbound traffic.
- Network ACLs (NACLs): Stateless firewalls for subnets, allowing/denying traffic based on rule order.
Understanding these helps you build a strong, multi-layered defense for your AWS resources. Next, we'll explore IAM Roles and Policies for fine-grained access control.
คำถามที่พบบ่อย
บทเรียน “กลุ่มความปลอดภัยและ NACL” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “กลุ่มความปลอดภัยและ NACL” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส AWS for Backend Developers (EC2, S3, RDS, Lambda) ให้อัปเกรดเป็น CoddyKit PRO คอร์ส AWS for Backend Developers (EC2, S3, RDS, Lambda) มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “กลุ่มความปลอดภัยและ NACL”
ใช้งานการรักษาความปลอดภัยระดับเครือข่ายที่รัดกุมด้วยการควบคุมการรับส่งข้อมูลขาเข้าและขาออกสำหรับอินสแตนซ์และซับเน็ต คุณปฏิบัติ AWS for Backend Developers (EC2, S3, RDS, Lambda) ด้วยโค้ดที่ใช้งานได้จริงที่คุณเรียกใช้โดยตรงในเบราว์เซอร์ และติวเตอร์ AI ตลอด 24/7 ตอบคำถามของคุณขณะที่คุณไปผ่านบทเรียน
คุณต้องมีประสบการณ์ก่อนที่จะเริ่มเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) หรือไม่
ไม่จำเป็นต้องมีประสบการณ์มาก่อน AWS for Backend Developers (EC2, S3, RDS, Lambda) บน CoddyKit ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 2 จากทั้งหมด 4 บทเรียน
บทเรียน “กลุ่มความปลอดภัยและ NACL” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) นี้ได้ไหม
ได้ บทเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- VPC ซับเน็ต และตารางเส้นทาง
- กลุ่มความปลอดภัยและ NACL
- บทบาทและนโยบาย IAM
- จุดปลายทาง VPC และการเชื่อมต่อส่วนตัว