โครงสร้างพื้นฐานในรูปโค้ดด้วย CloudFormation
เรียนรู้การกำหนด จัดเตรียม และกำหนดรุ่นโครงสร้างพื้นฐาน AWS แบบประกาศด้วยแม่แบบและสแตกของ AWS CloudFormation
โครงสร้างพื้นฐานในรูปโค้ดด้วย CloudFormation เป็นบทเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) ฟรีบน CoddyKit นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน คุณสามารถอ่านบทเรียนทั้งหมดด้านล่างฟรี — จากนั้นลองปฏิบัติด้วยตัวคุณเองในเบราว์เซอร์พร้อมตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7 บทเรียนนี้เป็นส่วนหนึ่งของเส้นทางการเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) และความก้าวหน้าของคุณจะซิงค์ข้ามเว็บและแอป CoddyKit คอร์ส AWS for Backend Developers (EC2, S3, RDS, Lambda) มีบทเรียนทั้งหมด 4 บทเรียน
บางส่วนของบทเรียนนี้ยังไม่ได้รับการแปล และแสดงเป็นภาษาอังกฤษ
Why Infrastructure as Code?
Clicking through the console to create resources is slow, error-prone, and impossible to reproduce reliably.
Infrastructure as Code (IaC) defines your infrastructure in files you can version, review, and deploy repeatedly.
What Is CloudFormation?
AWS CloudFormation provisions AWS resources from a declarative template. You describe the desired end state and CloudFormation figures out how to create it.
Templates and Stacks
Key terms:
- A template is a YAML or JSON file describing resources
- A stack is a deployed instance of a template
- Updating the template updates the stack
A Minimal Template
This template creates a single S3 bucket.
AWSTemplateFormatVersion: '2010-09-09'
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: my-iac-bucketParameters
Parameters make templates reusable by accepting input at deploy time, like an environment name or instance size.
Parameters:
EnvName:
Type: String
Default: devOutputs
Outputs export useful values from a stack, such as a bucket name or endpoint URL, so other stacks or operators can reference them.
Outputs:
BucketName:
Value: !Ref MyBucketDeploying a Stack
Create or update a stack from the CLI.
aws cloudformation deploy \
--template-file template.yaml \
--stack-name my-appChange Sets
A change set previews exactly what an update will add, modify, or delete before you apply it — a safety net against accidental data loss.
Automatic Rollback
If a stack update fails partway, CloudFormation rolls back to the last known good state, so you are never left with half-broken infrastructure.
Drift Detection
Drift detection tells you when someone changed a resource manually outside CloudFormation, so you can bring reality back in line with the template.
CloudFormation in CI/CD
In a pipeline, CodePipeline can deploy CloudFormation stacks automatically on every commit, making infrastructure changes follow the same review-and-deploy flow as your application code.
Quick Check
Test your IaC knowledge.
Recap
You learned Infrastructure as Code:
- Templates declare resources; stacks deploy them
- Parameters and outputs make templates reusable
- Change sets preview updates safely
- Drift detection and rollback keep infrastructure consistent
IaC makes your infrastructure repeatable, reviewable, and version-controlled.
คำถามที่พบบ่อย
บทเรียน “โครงสร้างพื้นฐานในรูปโค้ดด้วย CloudFormation” ฟรีหรือไม่
ใช่ — ข้อความเต็มของ “โครงสร้างพื้นฐานในรูปโค้ดด้วย CloudFormation” ฟรีให้อ่านที่นี่บนเว็บ เพื่อปฏิบัติแบบโต้ตอบ (ตัวแก้ไขโค้ดในตัวและติวเตอร์ AI ตลอด 24/7) และปลดล็อคส่วนที่เหลือของคอร์ส AWS for Backend Developers (EC2, S3, RDS, Lambda) ให้อัปเกรดเป็น CoddyKit PRO คอร์ส AWS for Backend Developers (EC2, S3, RDS, Lambda) มีบทเรียนทั้งหมด 4 บทเรียน
คุณจะเรียนรู้อะไรในบทเรียน “โครงสร้างพื้นฐานในรูปโค้ดด้วย CloudFormation”
เรียนรู้การกำหนด จัดเตรียม และกำหนดรุ่นโครงสร้างพื้นฐาน AWS แบบประกาศด้วยแม่แบบและสแตกของ AWS CloudFormation คุณปฏิบัติ 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 ออกแบบมาสำหรับผู้เริ่มต้นไปจนถึงผู้เรียนขั้นสูง คุณสามารถเริ่มต้นที่นี่หรือเริ่มจากตัวแรกและเรียนด้วยความเร็วของคุณเอง นี่คือบทเรียนที่ 4 จากทั้งหมด 4 บทเรียน
บทเรียน “โครงสร้างพื้นฐานในรูปโค้ดด้วย CloudFormation” ใช้เวลานานแค่ไหน
บทเรียน CoddyKit ส่วนใหญ่ใช้เวลาประมาณ 5–10 นาที แต่ละบทเรียนจึงสั้นและเป็นแบบโต้ตอบ คุณสามารถก้าวหน้าอย่างต่อเนื่องและกลับมาเรียนต่อจากตรงที่เพิ่งหยุดบนเว็บและแอปได้เลย
ฉันเขียนและรันโค้ดในบทเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) นี้ได้ไหม
ได้ บทเรียน AWS for Backend Developers (EC2, S3, RDS, Lambda) ทุกบทมีตัวแก้ไขโค้ดในตัว คุณจึงเขียนและรันโค้ดจริงได้เลยในเบราว์เซอร์ และได้รับข้อเสนอแนะจาก AI ในทันที — ไม่ต้องติดตั้งในเครื่องของคุณ
บทเรียนทั้งหมดในหลักสูตรนี้
- พื้นฐาน CodeCommit และ CodeBuild
- CodeDeploy สำหรับ EC2/Lambda
- Serverless Application Model (SAM)
- โครงสร้างพื้นฐานในรูปโค้ดด้วย CloudFormation