0Pricing
Serverless AWS Lambda Development · Pelajaran

Gateway NAT dan Akses Internet dari VPC

Pelajari alasan Lambda di dalam subnet VPC privat kehilangan akses internet, serta cara gateway NAT dan titik akhir VPC memulihkan konektivitas dengan aman.

Gateway NAT dan Akses Internet dari VPC adalah pelajaran Serverless AWS Lambda Development gratis di CoddyKit. Ini adalah pelajaran 4 dari 4. Kamu bisa membaca pelajaran lengkapnya di bawah secara gratis — lalu praktikkan langsung di browser dengan editor kode bawaan dan tutor AI 24/7. Ini adalah bagian dari jalur belajar Serverless AWS Lambda Development, dan progresmu tersinkronisasi di web dan aplikasi CoddyKit. Kursus Serverless AWS Lambda Development mencakup 4 pelajaran total.

Bagian dari pelajaran ini belum diterjemahkan dan ditampilkan dalam bahasa Inggris.

The Surprise

A Lambda in a VPC can reach private resources, but it loses default internet access. Calls to public APIs suddenly time out.

Why It Happens

VPC Lambdas have no public IP. Without a route to the internet, outbound calls to external endpoints have nowhere to go.

Public vs Private Subnets

A public subnet routes to an Internet Gateway; a private subnet does not. Always place Lambdas in private subnets for security.

Enter the NAT Gateway

A NAT gateway lives in a public subnet and lets private subnets make outbound internet calls while staying unreachable from the internet.

The Route Table

The private subnet route table sends internet-bound traffic to the NAT gateway, which forwards it through the Internet Gateway.

Destination     Target
10.0.0.0/16     local
0.0.0.0/0       nat-0abc123

NAT Costs Money

NAT gateways charge per hour plus per GB processed. For heavy traffic this adds up, so consider whether you truly need public internet access.

VPC Endpoints Instead

To reach AWS services like S3 or DynamoDB, use a VPC endpoint. Traffic stays on the AWS network with no NAT needed and no per-GB internet cost.

Gateway vs Interface Endpoints

S3 and DynamoDB use free gateway endpoints; most other services use interface endpoints (powered by PrivateLink) which are billed hourly.

Calling S3 Through an Endpoint

No code change is needed. With a gateway endpoint and the right route, this S3 call never leaves the AWS backbone.

import boto3
s3 = boto3.client('s3')
s3.put_object(Bucket='my-bucket', Key='log.txt', Body=b'hi')

Choosing the Right Path

Need a public third-party API? Use a NAT gateway. Need only AWS services? Use VPC endpoints. Often you use endpoints to avoid NAT entirely.

Multi-AZ for Resilience

Deploy a NAT gateway per Availability Zone and put the Lambda in multiple subnets, so one AZ outage does not break connectivity.

Quick Check

Test your VPC networking knowledge.

Recap

You learned why VPC Lambdas lose internet access and how NAT gateways restore outbound access, while VPC endpoints reach AWS services privately and cheaply.

Pertanyaan yang Sering Diajukan

Apakah pelajaran “Gateway NAT dan Akses Internet dari VPC” gratis?

Ya — teks lengkap “Gateway NAT dan Akses Internet dari VPC” gratis dibaca di sini di web. Untuk praktiknya secara interaktif (editor kode bawaan dan tutor AI 24/7) dan buka sisa kursus Serverless AWS Lambda Development, upgrade ke CoddyKit PRO. Kursus Serverless AWS Lambda Development mencakup 4 pelajaran total.

Apa yang akan aku pelajari di “Gateway NAT dan Akses Internet dari VPC”?

Pelajari alasan Lambda di dalam subnet VPC privat kehilangan akses internet, serta cara gateway NAT dan titik akhir VPC memulihkan konektivitas dengan aman. Kamu berlatih Serverless AWS Lambda Development dengan kode praktik yang langsung kamu jalankan di browser, dan tutor AI 24/7 menjawab pertanyaanmu saat kamu mengerjakan pelajaran ini.

Apakah aku perlu pengalaman untuk memulai Serverless AWS Lambda Development?

Tidak diperlukan pengalaman sebelumnya. Serverless AWS Lambda Development di CoddyKit dirancang untuk pemula hingga pelajar tingkat lanjut, jadi kamu bisa memulai di sini atau dari awal dan belajar sesuai kecepatan kamu sendiri. Ini adalah pelajaran 4 dari 4.

Berapa lama pelajaran “Gateway NAT dan Akses Internet dari VPC” memakan waktu?

Sebagian besar pelajaran CoddyKit memakan waktu sekitar 5–10 menit. Setiap pelajaran ringkas dan interaktif, jadi kamu membuat kemajuan stabil dan melanjutkan dari tempat kamu tinggalkan di web dan aplikasi.

Bisakah aku menulis dan menjalankan kode dalam pelajaran Serverless AWS Lambda Development ini?

Ya. Setiap pelajaran Serverless AWS Lambda Development menyertakan editor kode bawaan, jadi kamu menulis dan menjalankan kode nyata langsung di browser dan mendapatkan umpan balik AI instan — tidak diperlukan penyiapan lokal.

Semua pelajaran dalam kursus ini

  1. Lambda dalam VPC untuk Sumber Daya Privat
  2. Mengakses Basis Data dalam VPC
  3. Praktik Terbaik Keamanan Jaringan
  4. Gateway NAT dan Akses Internet dari VPC
← Kembali ke Serverless AWS Lambda Development