Infrastruktura jako kod z CloudFormation
Dowiedz się, jak deklaratywnie definiować, udostępniać i wersjonować infrastrukturę AWS za pomocą szablonów i stosów AWS CloudFormation.
Infrastruktura jako kod z CloudFormation to bezpłatna lekcja AWS for Backend Developers (EC2, S3, RDS, Lambda) na CoddyKit. To lekcja 4 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej AWS for Backend Developers (EC2, S3, RDS, Lambda), a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs AWS for Backend Developers (EC2, S3, RDS, Lambda) zawiera 4 lekcji w sumie.
Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.
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.
Ucz się AWS for Backend Developers (EC2, S3, RDS, Lambda) dzięki korepetycjom AI — za darmo
Pisz i uruchamiaj kod w przeglądarce, otrzymuj natychmiastową pomoc od korepetytora AI dostępnego 24/7 i kontynuuj naukę w sieci lub w aplikacji.
- Kursy
- 12
- Lekcje
- 48
Często zadawane pytania
Czy lekcja „Infrastruktura jako kod z CloudFormation” jest bezpłatna?
Tak — pełny tekst „Infrastruktura jako kod z CloudFormation” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu AWS for Backend Developers (EC2, S3, RDS, Lambda), przejdź na CoddyKit PRO. Kurs AWS for Backend Developers (EC2, S3, RDS, Lambda) zawiera 4 lekcji w sumie.
Co nauczysz się w „Infrastruktura jako kod z CloudFormation”?
Dowiedz się, jak deklaratywnie definiować, udostępniać i wersjonować infrastrukturę AWS za pomocą szablonów i stosów AWS CloudFormation. Ćwiczysz AWS for Backend Developers (EC2, S3, RDS, Lambda) z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.
Czy potrzebuję doświadczenia, aby zacząć AWS for Backend Developers (EC2, S3, RDS, Lambda)?
Nie wymagamy żadnego doświadczenia. AWS for Backend Developers (EC2, S3, RDS, Lambda) w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 4 z 4.
Ile czasu zajmuje lekcja „Infrastruktura jako kod z CloudFormation”?
Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.
Czy mogę pisać i uruchamiać kod w tej lekcji AWS for Backend Developers (EC2, S3, RDS, Lambda)?
Tak. Każda lekcja AWS for Backend Developers (EC2, S3, RDS, Lambda) zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.
Wszystkie lekcje w tym kursie
- Podstawy CodeCommit i CodeBuild
- CodeDeploy dla EC2 i Lambda
- Serverless Application Model (SAM)
- Infrastruktura jako kod z CloudFormation