Open wenzaca opened 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 } }
} }
[x] AWS IoT Things (Raspberry_Core, Raspbery_Listener, Raspberry_Readings )
[x] AWS IoT Rules (smartgarden/status, smartgarden/watering, smartgarden/readings, smartgarden/maxdata)
[x] AWS IoT Policy
[ ] AWS IoT Certificates (Lambda with Custom Resource)
[ ] Attach AWS IoT Policy in the Certificate
[ ] Attach AWS IoT Certificate in the Things
[ ] Cognito User Pool
[ ] Cognito User Pool Client
[x] Dynamo DB Tables (smartgarden_readings, smartgarden_maxdata, smartgarden_status)
[ ] Route 53 (Custom domain)
[ ] EC2