Skip to content

Instantly share code, notes, and snippets.

@brianleroux
Created June 14, 2022 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianleroux/100f1ebf8f426c5cf293dc59c8ea89b4 to your computer and use it in GitHub Desktop.
Save brianleroux/100f1ebf8f426c5cf293dc59c8ea89b4 to your computer and use it in GitHub Desktop.
example of runtime resource discovery built into architect
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