Domain 3 of 5 · Chapter 2 of 4

Prompt Engineering

Unlock the complete study guide + 1,040 practice questions across 16 full exams.

Bundled into the existing AWS Certified AI Practitioner AIF-C01 premium course — no separate purchase.

Included in this chapter:

  • Prompt anatomy, techniques, and best practices
  • Prompt-level risks and how to defend against them
  • Exam-pattern recognition: technique, attack, and distractor traps

Zero-shot vs. few-shot vs. chain-of-thought prompting

AspectZero-shotFew-shot (in-context learning)Chain-of-thought
Examples in promptNone: instruction onlyA few paired input-output examples ("shots")Often zero or few, plus a "reason step by step" cue
Best forSimple, well-understood tasks the model already handlesEnforcing a specific format, label set, or styleMulti-step reasoning, arithmetic, and logic problems
Token costLowest: shortest promptHigher: examples add input tokensHigher: model generates extra reasoning tokens
ReliabilityVariable on nuanced or formatted tasksMore consistent output matching the examplesMore accurate on problems needing intermediate steps

Decision tree

Reused with different data each time? Yes, parameterized No Multi-step reasoning, math, or logic? Yes No Needs a specific format or label set? Yes, show examples No, model handles it Zero-shot instruction only, fewest tokens Chain-of-thought reason step by step Few-shot paired input-output examples Prompt templates reusable recipe, placeholders

Cheat sheet

  • A prompt combines up to four components
  • An output indicator cues the response format
  • Context grounds the model and curbs hallucination
  • Zero-shot prompting gives an instruction with no examples
  • Few-shot prompting supplies paired example shots
  • Few-shot prompting is in-context learning
  • Chain-of-thought prompts step-by-step reasoning
  • Prompt templates are reusable recipes with placeholders
  • Negative prompting names what to exclude
  • Latent space is the model's internal representation of concepts
  • Best practice: be specific and constrain the output
  • Prompt engineering is iterative experimentation
  • Prompt engineering is the cheapest customization lever
  • Prompt injection embeds hijacking instructions in input
  • Jailbreaking bypasses the model's safety guidelines
  • Prompt hijacking redirects the model to the attacker's task
  • Prompt leaking exposes the hidden system prompt
  • Prompt poisoning corrupts the data a prompt relies on
  • Isolate trusted instructions with salted delimiter tags
  • Bedrock Guardrails filter both input and output
  • No single defense stops injection; layer controls

Unlock with Premium — includes all practice exams and the complete study guide.

Also tested in

References

  1. Prompt engineering guidelines for foundation models - Amazon Bedrock
  2. What is prompt engineering? - Amazon Bedrock
  3. Prompt management - Amazon Bedrock
  4. Best practices - LLM prompt engineering best practices (AWS Prescriptive Guidance)
  5. Common prompt injection attacks - LLM prompt engineering best practices (AWS Prescriptive Guidance)
  6. Stop harmful content using Amazon Bedrock Guardrails