Created
June 14, 2022 16:22
-
-
Save brianleroux/100f1ebf8f426c5cf293dc59c8ea89b4 to your computer and use it in GitHub Desktop.
example of runtime resource discovery built into architect
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arc from '@architect/functions' | |
// send an event to the SNS topic named 'ping' | |
// … under the hood the ARN is arn:aws:sns:us-west-2:818138539153:appname-ping-Q1C4HOR7RT2H:6bd207a6-4aaf-4015-bad4-a30adf7944f | |
await arc.events.publish({ | |
name: 'ping', | |
payload: { pingID: Date.now() } | |
}) | |
// read from the db table named 'pings' | |
// … under the hood the ARN is arn:aws:dynamodb:us-west-2:818138539153:appname-pings-Q1C4HOR7RT2H:6bd207a6-4aaf-4015-bad4-a30adf7944f | |
let data = await arc.tables() | |
let { hits } = await data.pings.get({ pingID }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment