DEV Community

Cover image for Build your own daily notification bot on AWS Free Tier
Esin Saribudak for AWS

Posted on • Originally published at builder.aws.com

Build your own daily notification bot on AWS Free Tier

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.

Top comments (2)

Collapse
 
esin87 profile image
Esin Saribudak

Let me know what other Free Tier projects you'd like to see!

Collapse
 
ifeanyiro profile image
Ifeanyi O. AWS

Very so surprised all you can build while still being on free tier. Love this!!!