-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
74f125c
commit 15defd8
Showing
1,636 changed files
with
201 additions
and
623,211 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,201 @@ | ||
{ | ||
"AWSTemplateFormatVersion" : "2010-09-09", | ||
|
||
"Resources" : { | ||
"DynamoDBTable" : { | ||
"Type" : "AWS::DynamoDB::Table", | ||
"Properties" : { | ||
"AttributeDefinitions" : [ | ||
{ | ||
"AttributeName" : "Artist", | ||
"AttributeType" : "S" | ||
}, | ||
{ | ||
"AttributeName" : "SongTitle", | ||
"AttributeType" : "S" | ||
} | ||
], | ||
"KeySchema" : [ | ||
{ | ||
"AttributeName" : "Artist", | ||
"KeyType" : "HASH" | ||
}, | ||
{ | ||
"AttributeName" : "SongTitle", | ||
"KeyType" : "RANGE" | ||
} | ||
], | ||
"ProvisionedThroughput" : { | ||
"ReadCapacityUnits" : "5", | ||
"WriteCapacityUnits" : "5" | ||
}, | ||
"TableName" : "PrometheonMusic" | ||
} | ||
}, | ||
"LambdaExecutionRole": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Version": "2012-10-17", | ||
"Statement": [{ | ||
"Effect": "Allow", | ||
"Principal": {"Service": ["lambda.amazonaws.com"]}, | ||
"Action": ["sts:AssumeRole"] | ||
}] | ||
}, | ||
"Path": "/", | ||
"Policies": [{ | ||
"PolicyName": "root", | ||
"PolicyDocument": { | ||
"Version": "2012-10-17", | ||
"Statement": [{ | ||
"Effect": "Allow", | ||
"Action": ["logs:CreateLogGroup","logs:CreateLogStream","logs:PutLogEvents"], | ||
"Resource": "arn:aws:logs:*:*:*" | ||
}, | ||
{ | ||
"Effect": "Allow", | ||
"Action": ["dynamodb:*"], | ||
"Resource": "arn:aws:dynamodb:*:*:*" | ||
}] | ||
} | ||
}], | ||
"RoleName": "DynamoDBFullLambdaAccess" | ||
} | ||
}, | ||
"ListLambdaFunction": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties" : { | ||
"Code" : { | ||
"S3Bucket": "cloudassessments-lab-files", | ||
"S3Key": "aws/s3/s3_static_site/list.zip" | ||
}, | ||
"Description" : "The function to list data from DynamoDB", | ||
"FunctionName" : "list", | ||
"Handler" : "list.list", | ||
"Role" : { "Fn::GetAtt" : ["LambdaExecutionRole", "Arn"] }, | ||
"Runtime" : "nodejs6.10" | ||
}, | ||
"DependsOn" : ["LambdaExecutionRole"] | ||
}, | ||
"GetLambdaFunction": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties" : { | ||
"Code" : { | ||
"S3Bucket": "cloudassessments-lab-files", | ||
"S3Key": "aws/s3/s3_static_site/get.zip" | ||
}, | ||
"Description" : "The function to get data from DynamoDB", | ||
"FunctionName" : "get", | ||
"Handler" : "get.get", | ||
"Role" : { "Fn::GetAtt" : ["LambdaExecutionRole", "Arn"] }, | ||
"Runtime" : "nodejs6.10" | ||
}, | ||
"DependsOn" : ["LambdaExecutionRole"] | ||
}, | ||
"PrometheonApi": { | ||
"Type": "AWS::ApiGateway::RestApi", | ||
"Properties": { | ||
"Name": "prometheon", | ||
"Description": "API used for prometheon requests", | ||
"FailOnWarnings" : true | ||
} | ||
}, | ||
"LambdaFunctionPermissionGet": { | ||
"Type": "AWS::Lambda::Permission", | ||
"Properties": { | ||
"Action": "lambda:invokeFunction", | ||
"FunctionName": {"Fn::GetAtt": ["GetLambdaFunction", "Arn"]}, | ||
"Principal": "apigateway.amazonaws.com", | ||
"SourceArn": {"Fn::Join": ["", | ||
["arn:aws:execute-api:", {"Ref": "AWS::Region"}, ":", {"Ref": "AWS::AccountId"}, ":", {"Ref": "PrometheonApi"}, "/*"] | ||
]} | ||
} | ||
}, | ||
"LambdaFunctionPermissionList": { | ||
"Type": "AWS::Lambda::Permission", | ||
"Properties": { | ||
"Action": "lambda:invokeFunction", | ||
"FunctionName": {"Fn::GetAtt": ["ListLambdaFunction", "Arn"]}, | ||
"Principal": "apigateway.amazonaws.com", | ||
"SourceArn": {"Fn::Join": ["", | ||
["arn:aws:execute-api:", {"Ref": "AWS::Region"}, ":", {"Ref": "AWS::AccountId"}, ":", {"Ref": "PrometheonApi"}, "/*"] | ||
]} | ||
} | ||
}, | ||
"ApiDeployment": { | ||
"Type": "AWS::ApiGateway::Deployment", | ||
"DependsOn": [ | ||
"ApiMethodList", | ||
"ApiMethodGet" | ||
], | ||
"Properties": { | ||
"RestApiId": {"Ref": "PrometheonApi"}, | ||
"StageName": "dev" | ||
} | ||
}, | ||
"PrometheonApiResourceRoot": { | ||
"Type": "AWS::ApiGateway::Resource", | ||
"Properties": { | ||
"RestApiId": {"Ref": "PrometheonApi"}, | ||
"ParentId": {"Fn::GetAtt": ["PrometheonApi", "RootResourceId"]}, | ||
"PathPart": "prometheon" | ||
} | ||
}, | ||
"PrometheonApiResourceId": { | ||
"DependsOn": "PrometheonApiResourceRoot", | ||
"Type": "AWS::ApiGateway::Resource", | ||
"Properties": { | ||
"RestApiId": {"Ref": "PrometheonApi"}, | ||
"ParentId": { "Ref": "PrometheonApiResourceRoot"}, | ||
"PathPart": "id" | ||
} | ||
}, | ||
"ApiMethodList": { | ||
"DependsOn": "LambdaFunctionPermissionList", | ||
"Type": "AWS::ApiGateway::Method", | ||
"Properties": { | ||
"ResourceId": {"Ref": "PrometheonApiResourceRoot"}, | ||
"RestApiId": {"Ref": "PrometheonApi"}, | ||
"HttpMethod": "GET", | ||
"AuthorizationType": "NONE", | ||
"Integration": { | ||
"Type": "AWS_PROXY", | ||
"IntegrationHttpMethod": "POST", | ||
"Uri": {"Fn::Join" : ["", | ||
[ | ||
"arn:aws:apigateway:", | ||
{"Ref": "AWS::Region"}, | ||
":lambda:path/2015-03-31/functions/", | ||
{"Fn::GetAtt": ["ListLambdaFunction", "Arn"]}, | ||
"/invocations" | ||
] | ||
]} | ||
} | ||
} | ||
}, | ||
"ApiMethodGet": { | ||
"DependsOn": "LambdaFunctionPermissionGet", | ||
"Type": "AWS::ApiGateway::Method", | ||
"Properties": { | ||
"ResourceId": {"Ref": "PrometheonApiResourceId"}, | ||
"RestApiId": {"Ref": "PrometheonApi"}, | ||
"HttpMethod": "GET", | ||
"AuthorizationType": "NONE", | ||
"Integration": { | ||
"Type": "AWS_PROXY", | ||
"IntegrationHttpMethod": "POST", | ||
"Uri": {"Fn::Join" : ["", | ||
[ | ||
"arn:aws:apigateway:", | ||
{"Ref": "AWS::Region"}, | ||
":lambda:path/2015-03-31/functions/", | ||
{"Fn::GetAtt": ["GetLambdaFunction", "Arn"]}, | ||
"/invocations" | ||
] | ||
]} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.