Skip to content

Instantly share code, notes, and snippets.

View rfpedrosa's full-sized avatar
🏠
Working from home

Rui Pedrosa rfpedrosa

🏠
Working from home
View GitHub Profile
@rfpedrosa
rfpedrosa / backend-config.json
Last active November 26, 2019 21:21
backend-config.json (just monitoring category)
{
"monitoring":{
"Topics":{
"service":"SNS",
"providerPlugin":"awscloudformation"
}
},
"hosting":{
.....
}
@rfpedrosa
rfpedrosa / backend-structure.text
Created November 26, 2019 20:49
Amplify backend structure for monitoring custom category
amplify
\backend
\monitoring
\topics
parameters.json
template.json
\hosting
parameters.json
template.json
@rfpedrosa
rfpedrosa / template.json
Last active November 26, 2019 21:01
Amplify monitory category - CF template
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"SNS resource stack creation using Amplify CLI",
"Parameters":{
"env":{
"Type":"String"
},
"alarmsTopicName":{
"Type":"String"
},
@rfpedrosa
rfpedrosa / parameters.json
Last active November 26, 2019 21:03
Amplify monitory category - CF template parameters
{
"alarmsTopicName":"alarms",
"alarmsSubscriptionEmailProd":"alarms-prod@mydomain.com",
"alarmsSubscriptionEmailTest":"alarms-test@mydomain.com"
}
@rfpedrosa
rfpedrosa / backend-config.json
Created November 26, 2019 21:21
backend-config.json (with MyFunction)
{
"monitoring":{
"Topics":{
"service":"SNS",
"providerPlugin":"awscloudformation"
}
},
"function":{
"MyFunction":{
"service":"Lambda",
@rfpedrosa
rfpedrosa / MyFunction-cloudformation-template.json
Last active November 27, 2019 13:58
MyFunction-cloudformation-template.json (just InvocationErrorAlarm)
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"Lambda resource stack creation using Amplify CLI",
"Parameters":{
"env":{
"Type":"String"
},
"monitoringTopicsAlarmsTopicArn":{
"Type":"String"
}
@rfpedrosa
rfpedrosa / MyFunction-cloudformation-template.json
Last active November 27, 2019 14:14
MyFunction-cloudformation-template.json (just DurationAlarm)
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"Lambda resource stack creation using Amplify CLI",
"Parameters":{
"env":{
"Type":"String"
},
"monitoringTopicsAlarmsTopicArn":{
"Type":"String"
},
@rfpedrosa
rfpedrosa / MyFunction-cloudformation-template.json
Last active November 27, 2019 15:55
MyFunction-cloudformation-template.json (AWS::Metric::Filter only)
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"Lambda resource stack creation using Amplify CLI",
"Parameters":{
...
"RetentionInDaysProd":{
"Type":"Number"
},
"RetentionInDaysOther":{
"Type":"Number"
@rfpedrosa
rfpedrosa / MyFunction-cloudformation-template.json
Last active November 27, 2019 15:56
MyFunction-cloudformation-template.json (FunctionErrorAlarm)
{
"AWSTemplateFormatVersion":"2010-09-09",
"Description":"Lambda resource stack creation using Amplify CLI",
"Parameters":{
...
},
"Conditions":{
...
},
"Resources":{
@rfpedrosa
rfpedrosa / gist:5b79d2716aa4927a26a0d600a50a355d
Created November 29, 2019 15:52
log js errors using Amplify Hub and Analytics
import { Hub } from 'aws-amplify';
// Some HTTP request as an example that can be anywhere in your code
fetch(SOME_URL)
.then(function (response) {
if (!response.ok) {
console.log(`HTTP request succeed with unsuccessful response code of ${response.statusText}`);
Hub.dispatch(
'error',
{