Skip to content

Instantly share code, notes, and snippets.

View misterjunio's full-sized avatar

Rui Júnio Silva misterjunio

  • Sydney, Australia
View GitHub Profile
@misterjunio
misterjunio / how-great-is-amplify-rn
Last active September 25, 2021 07:55
How great is Amplify + RN?
% npx create-react-native-app --use-npm
✔ What is your app named? … how-great-is-amplify-rn
✔ How would you like to start › Default new app
✔ Downloaded and extracted project files.
Using npm to install packages.
✔ Installed JavaScript dependencies.
✔ Installed pods and initialized Xcode workspace.
@misterjunio
misterjunio / cfn-iot-rule-lambda-permission.yml
Last active March 18, 2020 21:25
AWS CFN - IoT rule lambda permission example
IoTProcessSignalPermission:
Type: AWS::Lambda::Permission
Properties:
Action: lambda:InvokeFunction
FunctionName:
Fn::ImportValue: "dev-process-signal-function-arn"
Principal: iot.amazonaws.com
SourceAccount: !Ref "AWS::AccountId"
SourceArn: !GetAtt ProcessSignalRule.Arn
@misterjunio
misterjunio / cfn-iot-rule.yml
Last active March 18, 2020 20:35
AWS CFN - IoT rule example
ProcessSignalRule:
Type: AWS::IoT::TopicRule
Properties:
RuleName: devProcessSignalRule
TopicRulePayload:
Sql: "SELECT * FROM '/dev/+/process/signal'"
RuleDisabled: false
AwsIotSqlVersion: "2016-03-23"
Actions:
- Lambda:
@misterjunio
misterjunio / cfn-gg-group-id-script.sh
Last active January 21, 2020 01:28
AWS CFN - get GG group ID output
if GG_GROUP_ID=$(aws cloudformation describe-stacks \
--stack-name iot-$BUILD_ENV-core$GROUP_ID \
--query "Stacks[0].Outputs[?OutputKey=='GroupId'].OutputValue" \
--output text --region $AWS_REGION) &&
[ $GG_GROUP_ID != 'None' ]
then
echo "Forcing reset deployments for existing GG group with ID $GG_GROUP_ID..."
aws greengrass reset-deployments --group-id $GG_GROUP_ID --force --region $AWS_REGION
fi
@misterjunio
misterjunio / cfn-gg-group-id-output.yml
Last active January 21, 2020 00:45
AWS CFN - GG group ID output example
...
#Group aggregation
Group:
Type: AWS::Greengrass::Group
Properties:
Name: !Sub "${pEnvName}-core${pCoreId}-group"
RoleArn:
Fn::ImportValue: !Sub "${pEnvName}-greengrass-group-role"
GroupVersion:
@misterjunio
misterjunio / cfn-gg-parameters.yml
Last active January 20, 2020 06:42
AWS CFN - GG parameters example
Parameters:
pCoreId:
Type: String
pEnvName:
Type: String
@misterjunio
misterjunio / cfn-gg-core-definition.yml
Last active January 20, 2020 06:42
AWS CFN - GG core definition example
CoreThing:
Type: AWS::IoT::Thing
Properties:
ThingName: !Sub "${pEnvName}-core${pCoreId}"
CoreDefinition:
Type: AWS::Greengrass::CoreDefinition
Properties:
Name: !Sub "${pEnvName}-core${pCoreId}"
CoreDefinitionVersion:
Type: "AWS::Greengrass::CoreDefinitionVersion"
@misterjunio
misterjunio / cfn-gg-function-definition.yml
Last active January 20, 2020 06:42
AWS CFN - GG function definition example
FunctionDefinition:
Type: "AWS::Greengrass::FunctionDefinition"
Properties:
Name: !Sub "${pEnvName}-core${pCoreId}-FunctionDefinition"
FunctionDefinitionVersion:
Type: "AWS::Greengrass::FunctionDefinitionVersion"
Properties:
FunctionDefinitionId: !GetAtt FunctionDefinition.Id
Functions:
# Function to set group as automatically detect core connectivity