BrainyBeeBrainyBee
ExploreBlogStart Studying
HomeAWS Certified Solutions Architect - Professional (SAP-C02)Lab: Implementing AWS Cost Visibility and Governance
Hands-On Lab865 words

Lab: Implementing AWS Cost Visibility and Governance

Determine cost optimization and visibility strategies

Lab: Implementing AWS Cost Visibility and Governance

This lab provides hands-on experience in configuring cost optimization and visibility strategies as required for the AWS Certified Solutions Architect - Professional (SAP-C02) exam. You will implement resource tagging, set up budget alerts, and explore cost analysis tools.

[!WARNING] Remember to run the teardown commands at the end of this lab to avoid ongoing charges. Estimated cost for this lab is under $0.05 (mostly Free Tier eligible).

Prerequisites

  • An AWS Account with Administrator access.
  • AWS CLI installed and configured with credentials for your account.
  • Basic knowledge of JSON for CLI parameters.
  • IAM Permissions: Ensure your user has budgets:ModifyBudget, ce:*, s3:*, and sns:* permissions.

Learning Objectives

  • Implement a Tagging Strategy for cost allocation.
  • Configure AWS Budgets with SNS notifications for proactive cost management.
  • Use the AWS CLI to query cost and usage data from AWS Cost Explorer.
  • Identify Rightsizing Opportunities using AWS Compute Optimizer concepts.

Architecture Overview

Loading Diagram...

Step-by-Step Instructions

Step 1: Create a Tagged Resource

Before we can track costs by business unit, we need resources with standardized tags. We will create an S3 bucket with an Environment tag.

bash
# Generate a unique bucket name BUCKET_NAME="brainybee-cost-lab-$(date +%s)" aws s3api create-bucket --bucket $BUCKET_NAME --region us-east-1 aws s3api put-bucket-tagging --bucket $BUCKET_NAME --tagging 'TagSet=[{Key=Environment,Value=Dev},{Key=Project,Value=CostOptimization}]'
▶Console alternative
  1. Navigate to the S3 Console.
  2. Click Create bucket.
  3. Enter a unique name and choose a region.
  4. Under Tags, click Add tag and enter Key: Environment, Value: Dev.
  5. Click Create bucket.

Step 2: Create an SNS Topic for Cost Alerts

AWS Budgets requires a notification channel to alert you when thresholds are met.

bash
aws sns create-topic --name CostAlertTopic # Note the TopicArn from the output. Replace <TOPIC_ARN> in the next step. # Subscribe your email (Replace <YOUR_EMAIL>) aws sns subscribe --topic-arn <TOPIC_ARN> --protocol email --notification-endpoint <YOUR_EMAIL>

Step 3: Create a Monthly Budget

We will create a monthly budget of $10.00 that triggers an alert at 80% of the forecasted amount.

bash
# Create a budget.json file cat <<EOT > budget.json { "BudgetName": "Monthly_Dev_Budget", "BudgetLimit": { "Amount": "10", "Unit": "USD" }, "TimeUnit": "MONTHLY", "BudgetType": "COST" } EOT aws budgets create-budget --account-id <YOUR_ACCOUNT_ID> --budget budget.json

[!TIP] In a real-world scenario, you would attach a notification to this budget via the create-notification command, linking it to the SNS Topic created in Step 2.

Step 4: Query Cost Explorer via CLI

To gain visibility, we can query our usage for the current month. Note that data may take 24 hours to appear in a new account.

bash
aws ce get-cost-and-usage \ --time-period Start=$(date +%Y-%m-01),End=$(date +%Y-%m-%d) \ --granularity MONTHLY \ --metrics "UnblendedCost" \ --group-by Type=DIMENSION,Key=SERVICE

Checkpoints

TaskVerification Command/ActionExpected Result
S3 Taggingaws s3api get-bucket-tagging --bucket <NAME>JSON showing Environment=Dev
SNS Topicaws sns list-topicsTopic ARN for CostAlertTopic exists
Budgetaws budgets describe-budgets --account-id <ID>Monthly_Dev_Budget listed in output

Troubleshooting

ProblemCauseFix
AccessDeniedIAM User lacks Billing permissionsEnsure the user has the AdministratorAccess or specific Billing policies.
Empty CE resultsData LatencyCost Explorer data usually has a 24-hour delay for new resources.
SNS No EmailSubscription Not ConfirmedCheck your email inbox (and spam) for the AWS Notification - Subscription Confirmation email.

Clean-Up / Teardown

[!IMPORTANT] Failure to delete these resources may result in minor charges if thresholds are exceeded.

bash
# 1. Delete the S3 Bucket (Empty it first if you added files) aws s3 rb s3://<YOUR_BUCKET_NAME> --force # 2. Delete the Budget aws budgets delete-budget --account-id <YOUR_ACCOUNT_ID> --budget-name "Monthly_Dev_Budget" # 3. Delete the SNS Topic aws sns delete-topic --topic-arn <YOUR_TOPIC_ARN>

Stretch Challenge

Automated Rightsizing: Using the AWS CLI, try to find the command to list recommendations from AWS Compute Optimizer. How would you filter these recommendations to only show instances that are "Underprovisioned"?

▶Show Hint

Look into the aws compute-optimizer get-ec2-instance-recommendations command and use --filters.

Cost Estimate

  • S3: $0.023 per GB (First 5GB free). For this lab: $0.00.
  • AWS Budgets: First 2 budgets are free. For this lab: $0.00.
  • SNS: First 1 million Amazon SNS requests per month are free. For this lab: $0.00.
  • Total: $0.00 for most users.

Concept Review

Key Tools Comparison

ToolPrimary Use CaseKey Benefit
Cost ExplorerVisualizing historical and forecasted costs.Trend analysis and filtering by tags.
AWS BudgetsSetting custom cost/usage limits.Proactive alerts (SNS/Email).
Compute OptimizerRightsizing compute resources.Uses ML to recommend instance types.
Trusted AdvisorGeneral best practice checks.Identifies idle or underutilized resources.

Optimization Strategy Visual

Compiling TikZ diagram…
⏳
Running TeX engine…
This may take a few seconds
All AWS Certified Solutions Architect - Professional (SAP-C02) Study Resources

Related Notes

  • Mastering AWS Cost Optimization and Visibility (SAP-C02)925 words
  • Optimizing Operations: Adopting Managed Services & Reducing Infrastructure Overhead945 words
  • Study Guide: Alerting and Automatic Remediation Strategies850 words
  • AWS Usage Analysis & Resource Optimization Study Guide925 words
  • AWS Application Integration: Architecting for Decoupling and Resiliency1,145 words
  • Mastering AWS Application Migration Tools: SAP-C02 Study Guide1,050 words
  • Performance Optimization: Caching, Buffering, and Replicas950 words
  • AWS Migration Security: Best Practices & Implementation Guide925 words
  • Architecting for Resilience: Automated Backups and Business Continuity1,050 words
  • Lab: Building a Scalable Hub-and-Spoke Network with AWS Transit Gateway820 words
  • Mastering AWS Network Connectivity Strategies (SAP-C02)980 words
  • AWS Rightsizing Strategy & Performance Optimization Guide945 words

Ready to study AWS Certified Solutions Architect - Professional (SAP-C02)?

Practice tests, flashcards, and all study notes — free, no sign-up.

Start Studying

Ready to study AWS Certified Solutions Architect - Professional (SAP-C02)?

Practice tests, flashcards, and all study notes — free, no sign-up needed.

Start Studying — Free
AWS Certified Solutions Architect - Professional (SAP-C02) ResourcesExplore All HivesBlogHome

© 2026 BrainyBee. Free AI-powered exam prep.