wenzaca / SmartGarden

GitHub repository for Smart Garden controlling for Raspberry PI done in Python with Ajax.
Other
7 stars 4 forks source link

CloudFormation for the AWS environment #26

Open wenzaca opened 5 years ago

wenzaca commented 5 years ago
wenzaca commented 5 years ago

{ "AWSTemplateFormatVersion": "2010-09-09", "Description": "Smart Garden CloudFormation", "Resources": { "IamDynamoIotRole":{ "Type" : "AWS::IAM::Role", "Properties" : { "AssumeRolePolicyDocument" : { "Version":"2012-10-17", "Statement":[{ "Effect": "Allow", "Principal": { "Service": "iot.amazonaws.com" }, "Action": "sts:AssumeRole" }] }, "Policies" : [ { "PolicyName": "IoTRuleDynamoDBSmartGardenPolicy", "PolicyDocument": { "Version" : "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": "dynamodb:PutItem", "Resource": "arn:aws:dynamodb:::table/smartgarden_" }] } }], "RoleName" : "IoTRuleDynamoDBSmartGardenRole" } }, "DynamoMaxDataTable": { "Type": "AWS::DynamoDB::Table", "Properties": { "AttributeDefinitions" : [{ "AttributeName": "id", "AttributeType": "S" }], "KeySchema" : [{ "AttributeName" : "id", "KeyType" : "HASH" }], "TableName" : "smartgarden_maxdata", "Tags" : [ {"Key": "auto-delete","Value": "false"}, {"Key":"project","Value":"smartgarden"}], "ProvisionedThroughput": { "ReadCapacityUnits": 5, "WriteCapacityUnits": 5 } } }, "DynamoStatusTable": { "Type": "AWS::DynamoDB::Table", "Properties": { "AttributeDefinitions" : [ { "AttributeName": "id", "AttributeType": "S" }, { "AttributeName": "datetimeid", "AttributeType": "S" }], "KeySchema" : [ { "AttributeName" : "id", "KeyType" : "HASH" }, { "AttributeName" : "datetimeid", "KeyType" : "RANGE" }], "TableName" : "smartgarden_status", "Tags" : [ {"Key": "auto-delete","Value": "false"}, {"Key":"project","Value":"smartgarden"}], "ProvisionedThroughput": { "ReadCapacityUnits": 5, "WriteCapacityUnits": 5 } } }, "DynamoReadingsTable": { "Type": "AWS::DynamoDB::Table", "Properties": { "AttributeDefinitions" : [ { "AttributeName": "id", "AttributeType": "S" }, { "AttributeName": "datetimeid", "AttributeType": "S" }], "KeySchema" : [ { "AttributeName" : "id", "KeyType" : "HASH" }, { "AttributeName" : "datetimeid", "KeyType" : "RANGE" }], "TableName" : "smartgarden_readings", "Tags" : [ {"Key": "auto-delete","Value": "false"}, {"Key":"project","Value":"smartgarden"}], "ProvisionedThroughput": { "ReadCapacityUnits": 5, "WriteCapacityUnits": 5 } } }, "IoTCoreThing": { "Type": "AWS::IoT::Thing", "Properties": { "ThingName": "Raspberry_Core" } }, "IoTListenerThing": { "Type": "AWS::IoT::Thing", "Properties": { "ThingName": "Raspberry_Listener" } }, "IoTReadingsThing": { "Type": "AWS::IoT::Thing", "Properties": { "ThingName": "Raspberry_Readings" } }, "IoTGeneralPolicy": { "Type" : "AWS::IoT::Policy", "Properties" : { "PolicyDocument" : { "Version": "2012-10-17", "Statement": [ { "Effect": "Allow", "Action": [ "iot:", "greengrass:" ], "Resource": "" } ] }, "PolicyName" : "GeneralPolicy" } }, "IoTReadingsRule": { "Type" : "AWS::IoT::TopicRule", "Properties" : { "RuleName" : "smartgarden_readings", "TopicRulePayload" : { "RuleDisabled": "false", "Sql": "SELECT FROM 'smartgarden/readings'", "Actions": [{ "DynamoDBv2" : { "RoleArn" : {"Fn::GetAtt": ["IamDynamoIotRole", "Arn"]}, "PutItem" : { "TableName" : "smartgarden_readings" } } }] } } }, "IoTStatusRule": { "Type" : "AWS::IoT::TopicRule", "Properties" : { "RuleName" : "smartgarden_status", "TopicRulePayload" : { "RuleDisabled": "false", "Sql": "SELECT FROM 'smartgarden/status'", "Actions": [{ "DynamoDBv2" : { "RoleArn" : {"Fn::GetAtt": ["IamDynamoIotRole", "Arn"]}, "PutItem" : { "TableName" : "smartgarden_status" } } }] } } }, "IoTMaxDataRule": { "Type" : "AWS::IoT::TopicRule", "Properties" : { "RuleName" : "smartgarden_maxdata", "TopicRulePayload" : { "RuleDisabled": "false", "Sql": "SELECT * FROM 'smartgarden/maxdata'", "Actions": [{ "DynamoDBv2" : { "RoleArn" : {"Fn::GetAtt": ["IamDynamoIotRole", "Arn"]}, "PutItem" : { "TableName" : "smartgarden_maxdata" } } }] } } }, "CognitoUserPoolSmartGarden": { "Type" : "AWS::Cognito::UserPool", "Properties" : { "AdminCreateUserConfig" : { "AllowAdminCreateUserOnly" : true }, "AliasAttributes" : [ String, ... ], "AutoVerifiedAttributes" : [ String, ... ], "DeviceConfiguration" : DeviceConfiguration, "EmailConfiguration" : EmailConfiguration, "EmailVerificationMessage" : String, "EmailVerificationSubject" : String, "LambdaConfig" : LambdaConfig, "MfaConfiguration" : String, "Policies" : Policies, "Schema" : [ SchemaAttribute, ... ], "SmsAuthenticationMessage" : String, "SmsConfiguration" : SmsConfiguration, "SmsVerificationMessage" : String, "UsernameAttributes" : [ String, ... ], "UserPoolAddOns" : UserPoolAddOns, "UserPoolName" : String, "UserPoolTags" : Json, "VerificationMessageTemplate" : VerificationMessageTemplate } }

} }