added amplify and websocket
This commit is contained in:
17
amplify/.config/project-config.json
Normal file
17
amplify/.config/project-config.json
Normal file
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"projectName": "HPIoTWebApp",
|
||||
"version": "2.0",
|
||||
"frontend": "javascript",
|
||||
"javascript": {
|
||||
"framework": "angular",
|
||||
"config": {
|
||||
"SourceDir": "src",
|
||||
"DistributionDir": "dist/HPIoTWebApp",
|
||||
"BuildCommand": "npm.cmd run-script build",
|
||||
"StartCommand": "npm start"
|
||||
}
|
||||
},
|
||||
"providers": [
|
||||
"awscloudformation"
|
||||
]
|
||||
}
|
||||
8
amplify/backend/backend-config.json
Normal file
8
amplify/backend/backend-config.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"hosting": {
|
||||
"S3AndCloudFront": {
|
||||
"service": "S3AndCloudFront",
|
||||
"providerPlugin": "awscloudformation"
|
||||
}
|
||||
}
|
||||
}
|
||||
3
amplify/backend/hosting/S3AndCloudFront/parameters.json
Normal file
3
amplify/backend/hosting/S3AndCloudFront/parameters.json
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"bucketName": "hpiotwebapp"
|
||||
}
|
||||
271
amplify/backend/hosting/S3AndCloudFront/template.json
Normal file
271
amplify/backend/hosting/S3AndCloudFront/template.json
Normal file
@@ -0,0 +1,271 @@
|
||||
{
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
"Description": "Hosting resource stack creation using Amplify CLI",
|
||||
"Parameters": {
|
||||
"env": {
|
||||
"Type": "String"
|
||||
},
|
||||
"bucketName": {
|
||||
"Type": "String"
|
||||
}
|
||||
},
|
||||
"Conditions": {
|
||||
"ShouldNotCreateEnvResources": {
|
||||
"Fn::Equals": [
|
||||
{
|
||||
"Ref": "env"
|
||||
},
|
||||
"NONE"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Resources": {
|
||||
"S3Bucket": {
|
||||
"Type": "AWS::S3::Bucket",
|
||||
"DeletionPolicy": "Retain",
|
||||
"Properties": {
|
||||
"BucketName": {
|
||||
"Fn::If": [
|
||||
"ShouldNotCreateEnvResources",
|
||||
{
|
||||
"Ref": "bucketName"
|
||||
},
|
||||
{
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
{
|
||||
"Ref": "bucketName"
|
||||
},
|
||||
"-",
|
||||
{
|
||||
"Ref": "env"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"WebsiteConfiguration": {
|
||||
"IndexDocument": "index.html",
|
||||
"ErrorDocument": "index.html"
|
||||
},
|
||||
"CorsConfiguration": {
|
||||
"CorsRules": [
|
||||
{
|
||||
"AllowedHeaders": [
|
||||
"Authorization",
|
||||
"Content-Length"
|
||||
],
|
||||
"AllowedMethods": [
|
||||
"GET"
|
||||
],
|
||||
"AllowedOrigins": [
|
||||
"*"
|
||||
],
|
||||
"MaxAge": 3000
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"PrivateBucketPolicy": {
|
||||
"Type": "AWS::S3::BucketPolicy",
|
||||
"DependsOn": "OriginAccessIdentity",
|
||||
"Properties": {
|
||||
"PolicyDocument": {
|
||||
"Id": "MyPolicy",
|
||||
"Version": "2012-10-17",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "APIReadForGetBucketObjects",
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"CanonicalUser": {
|
||||
"Fn::GetAtt": [
|
||||
"OriginAccessIdentity",
|
||||
"S3CanonicalUserId"
|
||||
]
|
||||
}
|
||||
},
|
||||
"Action": "s3:GetObject",
|
||||
"Resource": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"arn:aws:s3:::",
|
||||
{
|
||||
"Ref": "S3Bucket"
|
||||
},
|
||||
"/*"
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"Bucket": {
|
||||
"Ref": "S3Bucket"
|
||||
}
|
||||
}
|
||||
},
|
||||
"OriginAccessIdentity": {
|
||||
"Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
|
||||
"Properties": {
|
||||
"CloudFrontOriginAccessIdentityConfig": {
|
||||
"Comment": "CloudFrontOriginAccessIdentityConfig"
|
||||
}
|
||||
}
|
||||
},
|
||||
"CloudFrontDistribution": {
|
||||
"Type": "AWS::CloudFront::Distribution",
|
||||
"DependsOn": [
|
||||
"S3Bucket",
|
||||
"OriginAccessIdentity"
|
||||
],
|
||||
"Properties": {
|
||||
"DistributionConfig": {
|
||||
"Origins": [
|
||||
{
|
||||
"DomainName": {
|
||||
"Fn::GetAtt": [
|
||||
"S3Bucket",
|
||||
"DomainName"
|
||||
]
|
||||
},
|
||||
"Id": "hostingS3Bucket",
|
||||
"S3OriginConfig": {
|
||||
"OriginAccessIdentity": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"origin-access-identity/cloudfront/",
|
||||
{
|
||||
"Ref": "OriginAccessIdentity"
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"Enabled": "true",
|
||||
"DefaultCacheBehavior": {
|
||||
"AllowedMethods": [
|
||||
"DELETE",
|
||||
"GET",
|
||||
"HEAD",
|
||||
"OPTIONS",
|
||||
"PATCH",
|
||||
"POST",
|
||||
"PUT"
|
||||
],
|
||||
"TargetOriginId": "hostingS3Bucket",
|
||||
"ForwardedValues": {
|
||||
"QueryString": "false"
|
||||
},
|
||||
"ViewerProtocolPolicy": "redirect-to-https",
|
||||
"DefaultTTL": 86400,
|
||||
"MaxTTL": 31536000,
|
||||
"MinTTL": 60,
|
||||
"Compress": true
|
||||
},
|
||||
"DefaultRootObject": "index.html",
|
||||
"CustomErrorResponses": [
|
||||
{
|
||||
"ErrorCachingMinTTL": 300,
|
||||
"ErrorCode": 400,
|
||||
"ResponseCode": 200,
|
||||
"ResponsePagePath": "/"
|
||||
},
|
||||
{
|
||||
"ErrorCachingMinTTL": 300,
|
||||
"ErrorCode": 403,
|
||||
"ResponseCode": 200,
|
||||
"ResponsePagePath": "/"
|
||||
},
|
||||
{
|
||||
"ErrorCachingMinTTL": 300,
|
||||
"ErrorCode": 404,
|
||||
"ResponseCode": 200,
|
||||
"ResponsePagePath": "/"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"Outputs": {
|
||||
"Region": {
|
||||
"Value": {
|
||||
"Ref": "AWS::Region"
|
||||
}
|
||||
},
|
||||
"HostingBucketName": {
|
||||
"Description": "Hosting bucket name",
|
||||
"Value": {
|
||||
"Ref": "S3Bucket"
|
||||
}
|
||||
},
|
||||
"WebsiteURL": {
|
||||
"Value": {
|
||||
"Fn::GetAtt": [
|
||||
"S3Bucket",
|
||||
"WebsiteURL"
|
||||
]
|
||||
},
|
||||
"Description": "URL for website hosted on S3"
|
||||
},
|
||||
"S3BucketSecureURL": {
|
||||
"Value": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"https://",
|
||||
{
|
||||
"Fn::GetAtt": [
|
||||
"S3Bucket",
|
||||
"DomainName"
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Description": "Name of S3 bucket to hold website content"
|
||||
},
|
||||
"CloudFrontDistributionID": {
|
||||
"Value": {
|
||||
"Ref": "CloudFrontDistribution"
|
||||
}
|
||||
},
|
||||
"CloudFrontDomainName": {
|
||||
"Value": {
|
||||
"Fn::GetAtt": [
|
||||
"CloudFrontDistribution",
|
||||
"DomainName"
|
||||
]
|
||||
}
|
||||
},
|
||||
"CloudFrontSecureURL": {
|
||||
"Value": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"https://",
|
||||
{
|
||||
"Fn::GetAtt": [
|
||||
"CloudFrontDistribution",
|
||||
"DomainName"
|
||||
]
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"CloudFrontOriginAccessIdentity": {
|
||||
"Value": {
|
||||
"Ref": "OriginAccessIdentity"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
14
amplify/team-provider-info.json
Normal file
14
amplify/team-provider-info.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"dev": {
|
||||
"awscloudformation": {
|
||||
"AuthRoleName": "hpiotwebapp-dev-20191011145158-authRole",
|
||||
"UnauthRoleArn": "arn:aws:iam::860246592755:role/hpiotwebapp-dev-20191011145158-unauthRole",
|
||||
"AuthRoleArn": "arn:aws:iam::860246592755:role/hpiotwebapp-dev-20191011145158-authRole",
|
||||
"Region": "us-east-1",
|
||||
"DeploymentBucketName": "hpiotwebapp-dev-20191011145158-deployment",
|
||||
"UnauthRoleName": "hpiotwebapp-dev-20191011145158-unauthRole",
|
||||
"StackName": "hpiotwebapp-dev-20191011145158",
|
||||
"StackId": "arn:aws:cloudformation:us-east-1:860246592755:stack/hpiotwebapp-dev-20191011145158/95829790-ec60-11e9-a33f-1207b4ca758c"
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user