Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CloudFormation for the AWS environment #26

Open
4 of 11 tasks
wenzaca opened this issue Aug 27, 2019 · 1 comment
Open
4 of 11 tasks

CloudFormation for the AWS environment #26

wenzaca opened this issue Aug 27, 2019 · 1 comment
Assignees
Labels
duplicate This issue or pull request already exists feature request New feature or request

Comments

@wenzaca
Copy link
Owner

wenzaca commented Aug 27, 2019

  • AWS IoT Things (Raspberry_Core, Raspbery_Listener, Raspberry_Readings )

  • AWS IoT Rules (smartgarden/status, smartgarden/watering, smartgarden/readings, smartgarden/maxdata)

  • 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

  • Dynamo DB Tables (smartgarden_readings, smartgarden_maxdata, smartgarden_status)

  • Route 53 (Custom domain)

  • EC2

@wenzaca
Copy link
Owner Author

wenzaca commented Aug 27, 2019

{
"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
}
}

}
}

@wenzaca wenzaca added the feature request New feature or request label Aug 27, 2019
@gusampaio gusampaio added the duplicate This issue or pull request already exists label Aug 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants