लागत: This lab creates real AWS resources that are billed to your AWS account. Most charges are per request and small, but the optional Lab 05 Knowledge Base creates an OpenSearch Serverless collection that bills every hour it exists. Destroy each lab when you finish it.
Deploy vision, language, speech, chat, and generative AI services on AWS as code, one lab at a time. Each lab uses Terraform components and Atmos stacks to create the resources, then walks you through calling the services from the AWS CLI so you see what each one does.
Atmos is the open-source runtime that builds, authenticates, and ships Terraform, Helm, Kubernetes, Ansible, Packer and containers. You write Terraform once, as reusable components, and describe each environment in YAML stacks that set the variables. This lab uses a small, local setup of Atmos: no remote state, no CI, one AWS account. The section How this lab uses Atmos maps each Atmos feature the lab uses to its documentation.
You downloaded this lab from its page on CertLabPro: certlabpro.com/labs/atmos-aws-ai-infra. Every command in the guides runs from the lab folder:
cd atmos-aws-ai-infra # the lab folderRelated certifications
This lab is hands-on practice for these certifications:
- AWS Certified AI Practitioner (AIF-C01) - you use the managed AI services (Rekognition, Textract, Comprehend, Translate, Transcribe, Polly, Lex, Bedrock) that the exam asks you to match to use cases, plus guardrails and IAM for responsible, secure AI.
- AWS Certified Machine Learning Engineer - Associate (MLA-C01) - you choose between managed AI services and custom models, and deploy an event-driven ML pipeline with infrastructure as code and CloudWatch monitoring.
- AWS Certified Generative AI Developer - Professional (AIP-C01) - you select and invoke foundation models on Bedrock, compare the Converse and InvokeModel APIs, apply guardrails, and build a Knowledge Base for retrieval augmented generation (RAG).
- HashiCorp Certified: Terraform Associate (004) -
you run the core Terraform workflow through Atmos and work with variables,
outputs,
count, preconditions, provisioners, local state, and workspaces.
Labs
| Lab | Guide | AWS services | What you do |
|---|---|---|---|
| 01 | Vision | Rekognition, Textract | Analyze images and extract text from documents |
| 02 | Language | Comprehend, Translate | Detect sentiment, entities, PII; translate text |
| 03 | Speech | Transcribe, Polly | Speech-to-text and text-to-speech |
| 04 | Conversational | Lex V2 | Build and test a chatbot |
| 05 | GenAI | Bedrock | Call foundation models, guardrails, optional RAG |
| 06 | Integrated | Lambda + Labs 01-03 | S3-triggered Lambda that routes files to AI APIs |
The labs are independent: each one has its own stack, bucket, and IAM role, so you can do them in any order. Lab 06 reuses the services from Labs 01-03.
Cost warning
This lab creates real AWS resources that are billed to your AWS account.
- Most charges are per request (per image, page, character, minute, request, or token) and stay small for the test calls in the guides.
- The optional Knowledge Base in Lab 05 creates an OpenSearch Serverless collection. It bills per OCU-hour for a minimum capacity every hour it exists, even when idle. Destroy it as soon as you finish. See OpenSearch Service pricing.
- Bedrock model calls are billed per token and have no free tier.
- AWS Free Tier terms depend on when your account was created (AWS changed the Free Tier for accounts created on or after July 15, 2025). Do not assume a call is free; check AWS Free Tier and each service's pricing page.
Destroy each lab when you finish it (see Cleanup), and consider an AWS Budgets alert on the account.
Prerequisites
An AWS account where you can create resources. A separate sandbox account is best. Your own identity (IAM user, role, or SSO session) needs permission to:
- create and delete IAM roles and inline policies (
iam:CreateRole,iam:PutRolePolicy,iam:PassRole, and related actions), - manage S3 buckets and objects, SNS topics, SQS queues, CloudWatch Logs groups, Lambda functions, and Bedrock guardrails,
- call the AI services directly: Rekognition, Textract, Comprehend, Translate, Transcribe, Polly, Lex V2, and Bedrock,
- for the optional Lab 05 Knowledge Base: OpenSearch Serverless (
aoss:*) and Bedrock Knowledge Bases (bedrock:*KnowledgeBase*,bedrock:*DataSource*,bedrock:*IngestionJob*).
In a sandbox account the simplest choice is the
AdministratorAccessmanaged policy. The IAM roles the lab creates are for AWS services (Lambda, Bedrock, Transcribe, and so on); the CLI commands in the guides always run as your identity.- create and delete IAM roles and inline policies (
AWS CLI v2, configured and signed in (
aws sts get-caller-identityworks). Thepollyandtranslatecomponents call the AWS CLI from a Terraformlocal-execprovisioner, because the AWS provider has no resource for Polly lexicons or Translate terminologies.Terraform 1.3 or later. The components use AWS provider
~> 5.60;terraform initdownloads it.Atmos CLI. The lab was tested with Atmos 1.234. See Install Atmos for every platform; on macOS:
brew install atmos # macOS (Homebrew) atmos versionNew to Atmos? The short Learn Atmos path covers everything this lab uses; start with Core Concepts and Your First Stack.
jq for reading JSON output.
Region: every stack and guide uses
us-east-1, which offers all the services in this lab. To use another region, importmixins/region/us-west-2(or a new mixin) instacks/labs/_defaults.yamland change--regionin the commands. Not every service is in every region.
Project structure
atmos-aws-ai-infra/
|-- atmos.yaml # Atmos configuration
|-- lab.json # Lab metadata for the CertLabPro site
|-- LICENSE # MIT
|-- components/
| +-- terraform/ # Terraform components (one folder each)
| |-- s3-bucket/ # Per-lab bucket with folders and lifecycle rules
| |-- iam-role/ # Least-privilege role for AI services
| |-- lambda/ # Orchestrator Lambda (Lab 06)
| | +-- src/index.py # Handler, zipped automatically at plan time
| |-- rekognition/ # Lab 01: image analysis
| |-- textract/ # Lab 01: document text extraction
| |-- comprehend/ # Lab 02: NLP
| |-- translate/ # Lab 02: translation (CLI for terminology)
| |-- transcribe/ # Lab 03: speech-to-text
| |-- polly/ # Lab 03: text-to-speech (CLI for lexicon)
| |-- lex/ # Lab 04: chatbot
| +-- bedrock/ # Lab 05: guardrail, logging, Knowledge Base
|-- stacks/
| |-- catalog/ # Component defaults
| | |-- shared/ # s3-bucket, iam-role, lambda
| | |-- vision/ # rekognition, textract
| | |-- language/ # comprehend, translate
| | |-- speech/ # transcribe, polly
| | |-- conversational/ # lex
| | +-- genai/ # bedrock
| |-- mixins/ # Region and stage settings
| | |-- region/
| | +-- stage/
| +-- labs/ # One stack per lab
| |-- _defaults.yaml
| |-- 01-vision/
| |-- 02-language/
| |-- 03-speech/
| |-- 04-conversational/
| |-- 05-genai/
| +-- 06-integrated/
+-- docs/ # Lab guidesHow this lab uses Atmos
Each row is one Atmos feature, where you find it in this lab, and the page on atmos.tools that explains it.
| Atmos feature | In this lab | Documentation |
|---|---|---|
| CLI configuration | atmos.yaml: where components and stacks live, which files are stacks, how stacks are named |
CLI Configuration, Terraform settings, Stack settings |
| Terraform components | components/terraform/<name>/: plain Terraform root modules, one per service |
Atmos Components, Terraform/OpenTofu, Root Modules |
| Stacks | stacks/labs/<lab>/test.yaml: one deployable stack per lab |
Stack Configuration, Terraform Components in stacks |
| Stack names | name_template in atmos.yaml turns vars.lab and vars.stage into lab-01-vision-test |
Stack Names |
| Imports | each lab stack imports _defaults, the catalog entries it needs, and (through _defaults) the mixins |
Import Stack Configurations, Import Basics |
| Catalog | stacks/catalog/: default settings for each component, imported by the labs that use it |
Stack Catalogs, Configuration Catalog Patterns |
| Mixins | stacks/mixins/region/ and stacks/mixins/stage/: small files that set region and stage |
Stack Mixins, Mixins pattern |
_defaults.yaml |
stacks/labs/_defaults.yaml: settings every lab shares; excluded_paths keeps it from being a stack of its own |
The _defaults.yaml Design Pattern |
| Variables and inheritance | vars from the mixins, _defaults, the catalog, and the lab stack are deep-merged; the lab stack wins |
Configure Variables, Inheritance, Inheritance Basics |
| List merge strategy | list_merge_strategy: replace: a list in a lab stack (for example folder_names) replaces the catalog list instead of adding to it |
Settings |
!terraform.output |
iam-role and lambda read outputs of s3-bucket and iam-role in the same stack |
!terraform.output, Using !terraform.output, Connecting Components |
| Workspaces and local state | one Terraform workspace per stack; no backend file, so state stays on your disk | Workspaces, State Backends |
The commands the guides use are atmos terraform
(overview,
plan,
apply,
output,
destroy),
atmos validate stacks,
atmos list stacks,
atmos describe component,
and atmos describe stacks.
Quick start
cd atmos-aws-ai-infra # the lab folder
# 1. Check the configuration (no AWS calls)
atmos validate stacks
atmos list stacks
# 2. Deploy Lab 01 (s3-bucket first: iam-role reads its output)
atmos terraform apply s3-bucket -s lab-01-vision-test
atmos terraform apply iam-role -s lab-01-vision-test
atmos terraform apply rekognition -s lab-01-vision-test
atmos terraform apply textract -s lab-01-vision-test
# 3. Follow docs/lab-01-vision.md, then destroy in reverse order
atmos terraform destroy textract -s lab-01-vision-test
atmos terraform destroy rekognition -s lab-01-vision-test
atmos terraform destroy iam-role -s lab-01-vision-test
atmos terraform destroy s3-bucket -s lab-01-vision-testatmos terraform apply shows the plan and asks for confirmation. Run
atmos terraform plan <component> -s <stack> first if you want to review the
plan on its own. Atmos runs terraform init and selects the stack's
workspace for you before each command.
Apply order and !terraform.output
Some stacks pass one component's outputs into another with the Atmos
!terraform.output
YAML function:
- In Labs 01, 02, 03, and 06,
iam-rolereadsbucket_arnfroms3-bucket. - In Lab 06,
lambdareadsrole_arnfromiam-roleandbucket_id/bucket_arnfroms3-bucket.
!terraform.output reads the outputs from the other component's state, so
that component must be applied first. Apply s3-bucket first, then
iam-role, then the rest, with lambda last. Destroy in the reverse order.
To inspect a stack before anything is applied, turn YAML functions off:
atmos describe stacks -s lab-01-vision-test --process-functions=falseReading outputs
The guides read Terraform outputs into shell variables like this (atmos terraform output):
BUCKET=$(atmos terraform output s3-bucket -s lab-01-vision-test --skip-init -- -raw bucket_id)--skip-init keeps the terraform init messages out of the variable; the
component is already initialized because you applied it. Everything after
-- goes to Terraform unchanged. Run
atmos terraform output <component> -s <stack> without -raw to see all
outputs of a component.
Names and state
- Stacks are named
lab-<lab>-<stage>(thename_templateinatmos.yaml, see Stack Names), for examplelab-01-vision-test. - Resources are named
<namespace>-<lab>-<stage>-<name>, for exampleai-01-vision-test-rekognition. S3 bucket names also end with your AWS account ID, because bucket names are global. - State is local. Atmos uses the stack name as the Terraform workspace
(Workspaces), so
each component folder keeps its state in
components/terraform/<component>/terraform.tfstate.d/<stack>/. Do not delete those folders while resources still exist. For team use, configure a remote backend instead (see State Backends).
How the labs fit together
+-------------------------------------------------------------------+
| Lab 06: Integrated |
| S3 upload -> Lambda orchestrator -> Rekognition / Textract / |
| Comprehend / Transcribe -> results in S3 |
+-------------------------------------------------------------------+
| |
| +---------------+ +---------------+ +---------------+ |
| | 01 Vision | | 02 Language | | 03 Speech | |
| | Rekognition | | Comprehend | | Transcribe | |
| | Textract | | Translate | | Polly | |
| +---------------+ +---------------+ +---------------+ |
| |
| +--------------------+ +--------------------+ |
| | 04 Conversational | | 05 GenAI | |
| | Lex V2 | | Bedrock | |
| +--------------------+ +--------------------+ |
| |
+-------------------------------------------------------------------+
| Shared components: s3-bucket | iam-role | lambda |
+-------------------------------------------------------------------+Cleanup
Destroy every component you applied, in the reverse order of the apply. Each guide ends with the exact commands. The general order is:
lambda(Lab 06 only; it also removes the bucket notification)- the service components (
bedrock,lex,polly,transcribe,translate,comprehend,textract,rekognition) iam-roles3-bucket(the bucket usesforce_destroy, so objects are deleted too)
Some things are created by CLI commands, not Terraform, so destroy does not
remove them:
Lex (Lab 04): a bot version and the
prodalias, if you created them. Delete the alias, then the version, before you destroylex:aws lexv2-models delete-bot-alias --bot-id "$BOT_ID" --bot-alias-id "$ALIAS_ID" --region us-east-1 aws lexv2-models delete-bot-version --bot-id "$BOT_ID" --bot-version "$BOT_VERSION" --region us-east-1Transcribe (Labs 03 and 06): transcription jobs. Their transcripts are in the lab bucket (deleted with it), but the job records stay in the account until you delete them:
aws transcribe list-transcription-jobs --region us-east-1 \ --query 'TranscriptionJobSummaries[].TranscriptionJobName' --output text aws transcribe delete-transcription-job --transcription-job-name <name> --region us-east-1Bedrock (Lab 05): the vector index you created by hand is deleted with the OpenSearch Serverless collection. If you turned on model invocation logging,
destroyremoves that configuration.Local files: the audio, JSON responses, and other files the guides write to the current folder, plus the generated
build/folders insidecomponents/terraform/lambda,polly, andtranslate. The lab.gitignorecovers them; delete them when you are done.
To confirm nothing is left, open the AWS console in us-east-1 or use
Tag Editor to
search for the tag Project = ai-hands-on-labs.
Troubleshooting
- Stack not found - list the stack names with
atmos list stacks. Names look likelab-01-vision-test. iam-roleorlambdaplan fails while reading!terraform.output- applys3-bucket(and forlambda,iam-role) in the same stack first.- AccessDenied from a CLI command - the guides run commands as your own identity, not as a lab role. Add the missing permission to your identity.
- Service or model not available - stay in
us-east-1, or check the service's regional availability. - Polly lexicon or Translate terminology errors during apply - these
components run the AWS CLI. Make sure
awsis on yourPATHand signed in to the same account and region as Terraform. - Bedrock invocation logging conflict - model invocation logging is one
setting per account and region. Leave
enable_model_invocation_loggingoff unless you own the whole account (see Lab 05). - A value is not what you expected - run
atmos describe componentto see the final, merged variables for a component in a stack. Atmos shows which file set each value, so you can see whether it came from a mixin,_defaults.yaml, the catalog, or the lab stack.
Useful commands:
atmos describe component rekognition -s lab-01-vision-test # final vars for a component
atmos terraform plan rekognition -s lab-01-vision-test # preview changes
atmos terraform output rekognition -s lab-01-vision-test # all outputsLearn more about Atmos
- Learn Atmos - a short guided path from the first stack to organizing many stacks.
- Organizing Stacks and Stack Organization Patterns - how real projects lay out stacks for many accounts and regions.
- Stacks Best Practices and Component Best Practices.
- Quick Start - a full project with a remote state backend, the next step after this lab's local setup.
License
This lab is released under the MIT License.