惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

V
Visual Studio Blog
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
N
Netflix TechBlog - Medium
博客园 - 叶小钗
大猫的无限游戏
大猫的无限游戏
S
SegmentFault 最新的问题
V
V2EX
IT之家
IT之家
J
Java Code Geeks
Hacker News - Newest:
Hacker News - Newest: "LLM"
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
GbyAI
GbyAI
D
Docker
S
Secure Thoughts
Recent Announcements
Recent Announcements
Webroot Blog
Webroot Blog
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
博客园_首页
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Security Archives - TechRepublic
Security Archives - TechRepublic
酷 壳 – CoolShell
酷 壳 – CoolShell
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
I
InfoQ
Last Week in AI
Last Week in AI
SecWiki News
SecWiki News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
W
WeLiveSecurity
T
Troy Hunt's Blog
Recent Commits to openclaw:main
Recent Commits to openclaw:main
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Attack and Defense Labs
Attack and Defense Labs
美团技术团队
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Martin Fowler
Martin Fowler
B
Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Scott Helme
Scott Helme
T
Tor Project blog
Know Your Adversary
Know Your Adversary
有赞技术团队
有赞技术团队
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
G
Google Developers Blog

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Build your own daily notification bot on AWS Free Tier
Esin Saribud · 2026-05-08 · via DEV Community

A Lambda function checks the forecast, Bedrock tells you what to wear, and ntfy.sh pushes it to your phone before you get ready for the day, and it's all Free Tier eligible.

Last updated: May 7, 2026

Every morning before work, you open your weather app. It takes a few seconds to refresh. Then you scroll past the hourly breakdown, the radar map, the air quality index, the pollen count. All you need to know is: what's the high, what's the low, is it going to rain, and what should you wear?

If you're leaving your home for the office every day like I am, this time spent scrolling and thinking every morning adds up. Especially where I live, where it might be 55°F when I leave the house and 88°F by lunch. You need a jacket at 7 AM and regret wearing it by noon. The weather app gives you all the data but none of the interpretation.

This tutorial walks you through building a service that sends you a push notification every morning with the forecast and a clothing recommendation. You deploy it once, and it runs on a schedule. Instead of opening an app and parsing data yourself, the notification just shows up with what you need. It looks like this on your phone:

Austin, TX — Tuesday, May 6
Today: 88°F, Partly Sunny
Tonight: 73°F, Mostly Cloudy
Wind: 10 mph S | Rain: 20%

Light layers today. Short sleeves with a light
jacket for the morning, ditch it by lunch.
No umbrella needed.

Enter fullscreen mode Exit fullscreen mode

Along the way, you'll wire together EventBridge, Lambda, and Bedrock into an app that streamlines a daily task. By the end, you'll have a working notification on your phone and hands-on experience with the same infrastructure that powers production applications. All the AWS services it uses are eligible for the AWS Free Tier.

If you followed the blog post view counter tutorial, this is a good next project. Same tools, different services, and you end up with something you'll use every day. If you haven't built that one, that's fine too — the prerequisites section covers what you need.

What you're building

Architecture diagram showing EventBridge triggering Lambda, which calls NWS API, Bedrock, and ntfy.sh

Here's the application flow:

  1. EventBridge triggers a Lambda function every morning on a cron schedule
  2. Lambda calls the National Weather Service API with your coordinates to get the local forecast
  3. Lambda sends that weather data to Amazon Bedrock (Nova Lite) and asks for a clothing recommendation
  4. Lambda formats the forecast + recommendation into a short message
  5. Lambda sends the message as a push notification to your phone via ntfy.sh, an open source pub/sub service

Three AWS services, two free external APIs, about 230 lines of TypeScript.

Outside the US? The NWS API only covers US locations. If you're elsewhere, swap in Open-Meteo as a drop-in replacement. It's free for non-commercial use, requires no API key, and covers the entire world.

Prerequisites

  • An AWS account. If you don't have one yet, the Creating an AWS account guide walks you through it. You'll need a credit card on file, but this project stays within Free Tier limits.
  • Node.js 24 or later
  • AWS CLI installed and configured
  • AWS CDK bootstrapped in your account. If you haven't used CDK before, it's an infrastructure-as-code tool. You write TypeScript that describes your AWS resources, and CDK turns it into CloudFormation and deploys it. The bootstrap command creates a staging bucket CDK needs to upload your code, and needs to be run the first time you use it.
npx cdk bootstrap aws://YOUR_ACCOUNT_ID/us-east-1

Enter fullscreen mode Exit fullscreen mode

  • ntfy app installed on your phone. Download ntfy from the App Store or Google Play. Open it and add a topic name you'll remember (this acts as your private channel, so pick something not easily guessable, like weather-forecast-abc123).

ntfy mobile app Add subscription screen with a topic name entered in the text field

What is ntfy.sh and why use it for notifications

ntfy.sh (pronounced "notify") is an open-source push notification service built on a simple pub/sub model. You subscribe to a topic in the app, and any HTTP POST to that topic's URL shows up as a push notification on your phone. No account required, no API key, no app store approval process.

Project setup

Create a new directory and initialize the project:

mkdir daily-notification-bot && cd daily-notification-bot
npm init -y
npm install aws-cdk-lib constructs @aws-sdk/client-bedrock-runtime
npm install -D aws-cdk tsx typescript @types/node

Enter fullscreen mode Exit fullscreen mode

Create a cdk.json file in the project root:

{
  "app": "npx tsx cdk/app.ts"
}

Enter fullscreen mode Exit fullscreen mode

And a tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2022",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "lib": ["ES2022"],
    "outDir": "dist",
    "rootDir": ".",
    "strict": true,
    "types": ["node"],
    "esModuleInterop": true,
    "skipLibCheck": true,
    "declaration": true
  },
  "include": ["lambda/**/*", "cdk/**/*"]
}

Enter fullscreen mode Exit fullscreen mode

Your project structure:

daily-notification-bot/
├── cdk/
│   ├── app.ts          # CDK entry point
│   └── stack.ts        # Infrastructure definition
├── lambda/
│   └── index.ts        # Lambda function code
├── cdk.json
├── package.json
└── tsconfig.json

Enter fullscreen mode Exit fullscreen mode

Step 1: Define the infrastructure with CDK

Create cdk/stack.ts. This defines all the infrastructure:

import * as cdk from 'aws-cdk-lib';
import * as events from 'aws-cdk-lib/aws-events';
import * as targets from 'aws-cdk-lib/aws-events-targets';
import * as iam from 'aws-cdk-lib/aws-iam';
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
import { Runtime } from 'aws-cdk-lib/aws-lambda';
import * as path from 'path';
import { fileURLToPath } from 'url';
import { Construct } from 'constructs';

const __dirname = path.dirname(fileURLToPath(import.meta.url));

export class MorningForecastStack extends cdk.Stack {
  constructor(scope: Construct, id: string) {
    super(scope, id);

    // Configuration — pass these at deploy time:
    //   npx cdk deploy -c latitude=30.27 -c longitude=-97.74 -c ntfyTopic=my-secret-weather-topic
    const latitude = this.node.tryGetContext('latitude');
    const longitude = this.node.tryGetContext('longitude');
    const ntfyTopic = this.node.tryGetContext('ntfyTopic');

    if (!latitude || !longitude || !ntfyTopic) {
      throw new Error(
        'Missing required context. Deploy with: npx cdk deploy ' +
        '-c latitude=30.27 -c longitude=-97.74 -c ntfyTopic=my-secret-weather-topic'
      );
    }

    // Lambda function — fetches weather, calls Bedrock, sends notification via ntfy
    const fn = new NodejsFunction(this, 'ForecastFunction', {
      runtime: Runtime.NODEJS_24_X,
      entry: path.join(__dirname, '../lambda/index.ts'),
      handler: 'handler',
      environment: {
        LATITUDE: latitude,
        LONGITUDE: longitude,
        NTFY_TOPIC: ntfyTopic,
      },
      timeout: cdk.Duration.seconds(30),
      memorySize: 256,
    });

    // Grant Lambda permission to invoke Bedrock
    fn.addToRolePolicy(new iam.PolicyStatement({
      actions: ['bedrock:InvokeModel'],
      resources: ['arn:aws:bedrock:*::foundation-model/amazon.nova-lite-v1:0'],
    }));

    // EventBridge rule — triggers every morning at 6:30 AM CT (11:30 UTC)
    // Adjust the cron to match your timezone and preferred time
    new events.Rule(this, 'MorningSchedule', {
      schedule: events.Schedule.cron({
        minute: '30',
        hour: '11',    // 11:30 UTC = 6:30 AM CT
        weekDay: 'MON-FRI',
      }),
      targets: [new targets.LambdaFunction(fn)],
    });

    // Output the function name for manual testing
    new cdk.CfnOutput(this, 'FunctionName', {
      value: fn.functionName,
      description: 'Lambda function name (for manual invocation)',
    });
  }
}

Enter fullscreen mode Exit fullscreen mode

How to schedule a Lambda function with EventBridge

The EventBridge rule above is what makes this run every morning. A few things to notice:

  • Configuration via context. Your coordinates and ntfy topic are passed at deploy time with -c flags. This keeps configuration out of your source code and makes the project easy to share. To find your coordinates, right-click any location in Google Maps and the lat/long will appear at the top of the context menu.
  • Notifications go through ntfy.sh, which is just an HTTP POST from Lambda. There are no AWS messaging services to configure, no phone number verification steps, and no sandbox restrictions to deal with.
  • Weekdays only. The cron schedule runs Monday through Friday. If you want weekends too, change weekDay: 'MON-FRI' to remove that constraint, or set it to '*'.
  • UTC time. EventBridge cron expressions use UTC. Central Time is UTC-5 (or UTC-6 during standard time), so 6:30 AM CT is 11:30 UTC during CDT. You'll need to adjust this for your timezone.
  • 30-second timeout. The Lambda makes three external calls (NWS points, NWS forecast, and Bedrock), so we give it more time than the default 3 seconds. In practice it finishes in 2-4 seconds.

Now create the entry point at cdk/app.ts:

#!/usr/bin/env node
import * as cdk from 'aws-cdk-lib';
import { MorningForecastStack } from './stack.js';

const app = new cdk.App();
new MorningForecastStack(app, 'MorningForecastNotificationApp');

Enter fullscreen mode Exit fullscreen mode

Step 2: Fetch the forecast and generate a notification

Create lambda/index.ts. This is the code that runs every morning:

import { BedrockRuntimeClient, InvokeModelCommand } from '@aws-sdk/client-bedrock-runtime';

const bedrock = new BedrockRuntimeClient({});

const LATITUDE = process.env.LATITUDE!;
const LONGITUDE = process.env.LONGITUDE!;
const NTFY_TOPIC = process.env.NTFY_TOPIC!;

const NWS_USER_AGENT = 'daily-notification-bot (github.com/your-repo)';

// Type definitions
interface NwsPoint {
  forecastUrl: string;
  city: string;
  state: string;
}

interface ForecastPeriod {
  name: string;
  temperature: number;
  temperatureUnit: string;
  windSpeed: string;
  windDirection: string;
  shortForecast: string;
  probabilityOfPrecipitation: number;
  isDaytime: boolean;
}

interface WeatherData {
  city: string;
  state: string;
  daytime: ForecastPeriod;
  nighttime: ForecastPeriod;
}

// Step 1: Get the NWS grid point for our coordinates
async function getNwsPoint(): Promise<NwsPoint> {
  const url = `https://api.weather.gov/points/${LATITUDE},${LONGITUDE}`;
  const response = await fetch(url, {
    headers: { 'User-Agent': NWS_USER_AGENT },
  });

  if (!response.ok) {
    throw new Error(`NWS points API error: ${response.status}`);
  }

  const data: any = await response.json();
  return {
    forecastUrl: data.properties.forecast,
    city: data.properties.relativeLocation.properties.city,
    state: data.properties.relativeLocation.properties.state,
  };
}

// Step 2: Get the forecast from the NWS grid point
async function getForecast(point: NwsPoint): Promise<WeatherData> {
  const response = await fetch(point.forecastUrl, {
    headers: { 'User-Agent': NWS_USER_AGENT },
  });

  if (!response.ok) {
    throw new Error(`NWS forecast API error: ${response.status}`);
  }

  const data: any = await response.json();
  const periods = data.properties.periods;

  const daytime = periods.find((p: any) => p.isDaytime);
  const nighttime = periods.find((p: any) => !p.isDaytime);

  const toPeriod = (p: any): ForecastPeriod => ({
    name: p.name,
    temperature: p.temperature,
    temperatureUnit: p.temperatureUnit,
    windSpeed: p.windSpeed,
    windDirection: p.windDirection,
    shortForecast: p.shortForecast,
    probabilityOfPrecipitation: p.probabilityOfPrecipitation?.value ?? 0,
    isDaytime: p.isDaytime,
  });

  return {
    city: point.city,
    state: point.state,
    daytime: toPeriod(daytime),
    nighttime: toPeriod(nighttime),
  };
}

// Step 3: Ask Bedrock for a clothing recommendation
async function getClothingAdvice(weather: WeatherData): Promise<string> {
  const prompt = `Today's forecast for ${weather.city}, ${weather.state}:
- Daytime (${weather.daytime.name}): ${weather.daytime.temperature}°${weather.daytime.temperatureUnit}, ${weather.daytime.shortForecast}
- Wind: ${weather.daytime.windSpeed} ${weather.daytime.windDirection}
- Rain chance: ${weather.daytime.probabilityOfPrecipitation}%
- Tonight: ${weather.nighttime.temperature}°${weather.nighttime.temperatureUnit}, ${weather.nighttime.shortForecast}

What should I wear today? Give me a practical recommendation in one to two sentences. Be direct and specific. No preamble.`;

  const body = JSON.stringify({
    messages: [
      {
        role: 'user',
        content: [{ text: prompt }],
      },
    ],
    inferenceConfig: {
      maxTokens: 80,
    },
  });

  const command = new InvokeModelCommand({
    modelId: 'amazon.nova-lite-v1:0',
    contentType: 'application/json',
    accept: 'application/json',
    body: new TextEncoder().encode(body),
  });

  const response = await bedrock.send(command);
  const result = JSON.parse(new TextDecoder().decode(response.body));
  return result.output.message.content[0].text;
}

// Step 4: Format the notification message
function formatMessage(weather: WeatherData, advice: string): string {
  const today = new Date().toLocaleDateString('en-US', {
    weekday: 'long',
    month: 'short',
    day: 'numeric',
    timeZone: 'America/Chicago', // Adjust to your timezone
  });

  return [
    `${weather.city}, ${weather.state}${today}`,
    `${weather.daytime.name}: ${weather.daytime.temperature}°${weather.daytime.temperatureUnit}, ${weather.daytime.shortForecast}`,
    `Tonight: ${weather.nighttime.temperature}°${weather.nighttime.temperatureUnit}, ${weather.nighttime.shortForecast}`,
    `Wind: ${weather.daytime.windSpeed} ${weather.daytime.windDirection} | Rain: ${weather.daytime.probabilityOfPrecipitation}%`,
    '',
    advice,
  ].join('\n');
}

// Step 5: Send push notification via ntfy.sh
async function sendNotification(message: string): Promise<void> {
  const response = await fetch(`https://ntfy.sh/${NTFY_TOPIC}`, {
    method: 'POST',
    headers: {
      'Title': 'Morning Forecast',
    },
    body: message,
  });

  if (!response.ok) {
    throw new Error(`ntfy.sh error: ${response.status}`);
  }
}

// Main handler — EventBridge triggers this every morning
export const handler = async (): Promise<void> => {
  const point = await getNwsPoint();
  const weather = await getForecast(point);
  const advice = await getClothingAdvice(weather);
  const message = formatMessage(weather, advice);

  await sendNotification(message);

  console.log('Forecast sent:', message);
};

Enter fullscreen mode Exit fullscreen mode

The function does four things in sequence:

Calling the NWS weather API from Lambda

The NWS API works in two steps. First you send your coordinates to /points/{lat},{lon}, which returns metadata about your location including the forecast URL and your city/state name. The NWS requires a User-Agent header for identification, but no API key.

The second call hits the forecast URL from step one. It returns forecast periods (today, tonight, tomorrow, etc.) with temperature, wind, precipitation probability, and a plain-English summary like "Partly Cloudy" or "Chance Showers."

Using Bedrock to generate clothing advice

We send the weather data to Amazon Nova Lite with a prompt that asks for practical clothing advice. The maxTokens: 80 keeps the response tight — one to two sentences, no filler. Nova Lite is Amazon's cheapest model and responds in under a second.

Sending push notifications with ntfy.sh

The city name, forecast summary, and clothing advice get combined into a notification message and sent to ntfy.sh with a single HTTP POST. The ntfy app on your phone picks it up instantly.

Step 3: Deploy and test your notification

Deploy with your coordinates and ntfy topic:

npx cdk deploy \
  -c latitude=YOUR_LATITUDE \
  -c longitude=YOUR_LONGITUDE \
  -c ntfyTopic=YOUR_NTFY_TOPIC

Enter fullscreen mode Exit fullscreen mode

Replace the values with your own:

  • Latitude and longitude of your location. Right-click any spot in Google Maps and the coordinates appear at the top of the menu. For example, Austin, TX is 30.27,-97.74.
  • ntfy topic — the same topic name you subscribed to in the ntfy app. This is like a private channel, so pick something not easily guessable.

CDK will show you the resources it's creating and ask for confirmation. Type y.

CDK asks because the stack creates IAM permissions (Lambda's execution role, Bedrock invoke access). This is standard for any stack that includes a Lambda function. Review the permissions if you want, then approve.

After about two minutes, you'll see output like this:

✅  MorningForecastNotificationApp

✨  Deployment time: 107.44s

Outputs:
MorningForecastNotificationApp.FunctionName = MorningForecastNotificationApp-ForecastFunctionBE622553-a1B2c3D4e5Fg

Stack ARN:
arn:aws:cloudformation:us-east-1:123456789012:stack/MorningForecastNotificationApp/67f1ff60-1234-5678-abcd-0affd8af3937

✨  Total time: 110s

Enter fullscreen mode Exit fullscreen mode

Don't wait until tomorrow morning to test it. Invoke the function manually using the function name from the deploy output:

aws lambda invoke \
  --function-name MorningForecastNotificationApp-ForecastFunctionBE622553-a1B2c3D4e5Fg \
  --payload '{}' \
  output.json

Enter fullscreen mode Exit fullscreen mode

Check your phone. You should have a push notification from the ntfy app with today's forecast and a clothing recommendation. 😎

ntfy app showingmorning forecast notifications with weather data and clothing recommendations

Step 4: Customize the schedule, location, and AI prompt

Change your location

Update the coordinates in your deploy command. Right-click any location in Google Maps to get the
lat/long:

npx cdk deploy \
  -c latitude=YOUR_LATITUDE \
  -c longitude=YOUR_LONGITUDE \
  -c ntfyTopic=YOUR_NTFY_TOPIC

Enter fullscreen mode Exit fullscreen mode

How to change the EventBridge cron schedule

The cron expression in stack.ts controls when you get your notification. A few examples:

// Every day at 7:00 AM ET (12:00 UTC during EDT)
schedule: events.Schedule.cron({ minute: '0', hour: '12' })

// Weekdays at 6:00 AM CT (11:00 UTC during CDT)
schedule: events.Schedule.cron({ minute: '0', hour: '11', weekDay: 'MON-FRI' })

// Every day at 6:30 AM PT (13:30 UTC during PDT)
schedule: events.Schedule.cron({ minute: '30', hour: '13' })

Enter fullscreen mode Exit fullscreen mode

Remember: EventBridge uses UTC. Convert your local time accordingly.

Tweak the AI prompt

The Bedrock prompt in getClothingAdvice() is where you make this yours. The default asks for one to two direct sentences. Some ways to customize:

// If you bike to work:
"Assume I'm biking 3 miles to the office."

// If you run hot:
"I tend to run warm, so err on the side of lighter clothing."

// If you want outfit specifics:
"Suggest specific items: jacket type, shirt type, pants vs shorts, shoe type."

// If you want even less:
"Answer in one sentence only."

Enter fullscreen mode Exit fullscreen mode

The prompt is just a string. Change it, redeploy, and your morning notification changes with it.

How the full flow works

Now that you've seen all the code, here's the complete flow, complete with approximate timestamps:

  1. 6:30 AM — EventBridge fires a scheduled event
  2. 6:30:01 — Lambda calls the NWS API with your coordinates, gets the forecast
  3. 6:30:02 — Lambda sends the weather data to Bedrock, gets back clothing advice
  4. 6:30:03 — Lambda formats the message and POSTs it to ntfy.sh
  5. 6:30:04 — Your phone buzzes with a push notification

Total execution time: 2-4 seconds. Total cost: covered by Free Tier.

How much this costs on AWS Free Tier

This project uses services eligible for the AWS Free Tier. Here's what each one costs:

Service Free Tier allowance Your usage
EventBridge 14M scheduled invocations/month ~30/month
Lambda 1M requests/month, 400K GB-seconds ~30 invocations/month
Bedrock (Nova Lite) Free Tier credits ~$0.001/month
ntfy.sh Free (open source) ~30 notifications/month
NWS API Free (US government data) ~60 calls/month

EventBridge — 14 million scheduled invocations per month free. You're using around 30.

Lambda — You'll probably use around 30 invocations per month, each running for 2-4 seconds at 256 MB. That's well under the 1 million requests and 400,000 GB-seconds you get free.

Bedrock — Nova Lite costs fractions of a cent per invocation at this token volume. At 30 calls per month, it comes out of your Free Tier credits.

ntfy.sh — free, and doesn't require an account or API key for personal use.

NWS API — free US government public data, no key required.

I'd still recommend setting up a billing alarm at $5 as a safety net.

What you just learned

If you followed along, you now have hands-on experience with:

  • EventBridge: cron scheduling in UTC, weekday-only rules
  • Lambda: calling external APIs, environment variables, working with the Bedrock SDK
  • Bedrock: invoking a foundation model, prompt design, controlling output length
  • CDK: defining infrastructure in TypeScript, passing configuration via context, deploying with a single command
  • NWS API: the two-step points → forecast pattern for US weather data
  • ntfy.sh: push notifications via a simple HTTP POST

And you have something running that you'll actually use every morning.

A note on security

This project has a small attack surface. The Lambda has no public URL and can only be triggered by EventBridge within your account. There's no user input, no stored data, and the IAM permissions are scoped to a single Bedrock model.

The one thing to be aware of: your ntfy topic name is the only access control on your notifications. Anyone who knows the topic name can subscribe and read your messages. Since the content is just weather data, the risk is low, but pick a topic name that isn't easily guessable. If you want tighter control, ntfy supports token-based auth on their paid plan, or you can self-host.

Cleanup

If you want to tear everything down:

npx cdk destroy \
  -c latitude=YOUR_LATITUDE \
  -c longitude=YOUR_LONGITUDE \
  -c ntfyTopic=YOUR_NTFY_TOPIC

Enter fullscreen mode Exit fullscreen mode

This deletes the Lambda, the EventBridge rule, and the IAM role. Your morning notifications will stop. Unsubscribe from the topic in the ntfy app if you want to clean that up too.

What to try next

  • Add a weekend mode with a later send time and more casual tone
  • Send a mid-day alert if rain probability spikes above 70%
  • Share the topic with your household so everyone gets the notification
  • Add a weekly summary on Sunday evenings for the week ahead
  • Swap the NWS API for Open-Meteo if you're outside the US (free for non-commercial use, covers the entire world)
  • Replace the weather API with something else you care about: stock prices, package tracking, your team's on-call schedule, a daily quote. The architecture will likely be similar regardless of what data you're fetching.

If you built the blog post view counter, you now have two working projects on AWS Free Tier: one that reacts to events (page views) and one that runs on a schedule (morning forecast). Between the two, you've used Lambda, DynamoDB, API Gateway, EventBridge, and Bedrock.

The source code for this project is on GitHub if you want to fork it and make it your own.