This guide explains how to add new AWS service configurations to the extension.
Each AWS service configuration is defined in the config.js file with the following structure:
serviceKey: {
name: "Service Display Name",
location: {
pattern: "URL pattern to match",
hash: "URL hash to match (optional)"
},
pricing: {
// Pricing information - can be any key-value pairs
standardPrice: "$10/month",
premiumPrice: "$50/month",
source: "https://aws.amazon.com/service/pricing/"
},
action: {
type: "click", // Currently only "click" is supported
selectors: [
// Array of CSS selectors to find the target element
'button[data-testid="create-button"]',
'input[type="checkbox"]'
],
fallbackText: "create" // Optional: text to search for if selectors fail
},
message: {
title: "💰 Cost of this service:",
items: [
{ label: "Standard:", value: "standardPrice" },
{ label: "Premium:", value: "premiumPrice" }
]
}
}- Navigate to the AWS console page where you want to show pricing
- Note the URL pattern and any hash fragments
- Identify the element that triggers the action (button, checkbox, etc.)
Add a new entry to the AWS_PRICING_CONFIG object in config.js:
// Example: Adding RDS database creation
rds: {
name: "RDS Database",
location: {
pattern: "console.aws.amazon.com/rds/home",
hash: "#database:create"
},
pricing: {
dbInstance: "$0.017 per hour",
storage: "$0.10 per GB-month",
source: "https://aws.amazon.com/rds/pricing/"
},
action: {
type: "click",
selectors: [
'button[data-testid="create-database"]',
'button:contains("Create database")'
],
fallbackText: "create database"
},
message: {
title: "💰 Database costs:",
items: [
{ label: "DB Instance:", value: "dbInstance" },
{ label: "Storage:", value: "storage" }
]
}
}Add the new URL pattern to the matches array in manifest.json:
"matches": [
"https://*.console.aws.amazon.com/acm/home*",
"https://*.console.aws.amazon.com/ec2/home*",
"https://*.console.aws.amazon.com/rds/home*"
]pattern: Required. String that must be present in the URLhash: Optional. URL hash fragment that must be present
- Can contain any key-value pairs
- Values are displayed in the message using the
itemsarray - Must include a
sourcefield with the pricing URL
selectors: Array of CSS selectors to find the target elementfallbackText: Optional text to search for in nearby elements if selectors fail- The extension will try each selector in order until it finds a match
title: The main heading for the pricing messageitems: Array of objects withlabelandvaluepropertiesvaluemust match a key in thepricingobject
simpleService: {
name: "Simple Service",
location: {
pattern: "console.aws.amazon.com/simple/home"
},
pricing: {
cost: "$5/month",
source: "https://aws.amazon.com/simple/pricing/"
},
action: {
type: "click",
selectors: ['button[data-testid="create"]']
},
message: {
title: "💰 Service cost:",
items: [
{ label: "Monthly cost:", value: "cost" }
]
}
}tieredService: {
name: "Tiered Service",
location: {
pattern: "console.aws.amazon.com/tiered/home"
},
pricing: {
basic: "$10/month",
pro: "$25/month",
enterprise: "$100/month",
source: "https://aws.amazon.com/tiered/pricing/"
},
action: {
type: "click",
selectors: ['button:contains("Start")']
},
message: {
title: "💰 Pricing tiers:",
items: [
{ label: "Basic:", value: "basic" },
{ label: "Pro:", value: "pro" },
{ label: "Enterprise:", value: "enterprise" }
]
}
}- Add your configuration to
config.js - Update
manifest.jsonwith the new URL pattern - Reload the extension in Chrome
- Navigate to the target AWS page
- Click the configured element to test the pricing message
- Check the browser console for debug messages
- Verify that the URL pattern matches exactly
- Ensure the CSS selectors are correct
- Test the selectors in the browser's developer tools
- Use the
fallbackTextoption if selectors are unreliable