Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

# dependencies
/node_modules
package-lock.json

# profiling files
chrome-profiler-events*.json
Expand Down
82 changes: 82 additions & 0 deletions .serverless/cloudformation-template-create-stack.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "The AWS CloudFormation template for this Serverless application",
"Resources": {
"ServerlessDeploymentBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketEncryption": {
"ServerSideEncryptionConfiguration": [
{
"ServerSideEncryptionByDefault": {
"SSEAlgorithm": "AES256"
}
}
]
}
}
},
"ServerlessDeploymentBucketPolicy": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"PolicyDocument": {
"Statement": [
{
"Action": "s3:*",
"Effect": "Deny",
"Principal": "*",
"Resource": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "ServerlessDeploymentBucket"
},
"/*"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "ServerlessDeploymentBucket"
}
]
]
}
],
"Condition": {
"Bool": {
"aws:SecureTransport": false
}
}
}
]
}
}
}
},
"Outputs": {
"ServerlessDeploymentBucketName": {
"Value": {
"Ref": "ServerlessDeploymentBucket"
}
}
}
}
222 changes: 222 additions & 0 deletions .serverless/cloudformation-template-update-stack.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "The AWS CloudFormation template for this Serverless application",
"Resources": {
"ServerlessDeploymentBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketEncryption": {
"ServerSideEncryptionConfiguration": [
{
"ServerSideEncryptionByDefault": {
"SSEAlgorithm": "AES256"
}
}
]
}
}
},
"ServerlessDeploymentBucketPolicy": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "ServerlessDeploymentBucket"
},
"PolicyDocument": {
"Statement": [
{
"Action": "s3:*",
"Effect": "Deny",
"Principal": "*",
"Resource": [
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "ServerlessDeploymentBucket"
},
"/*"
]
]
},
{
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":s3:::",
{
"Ref": "ServerlessDeploymentBucket"
}
]
]
}
],
"Condition": {
"Bool": {
"aws:SecureTransport": false
}
}
}
]
}
}
},
"WebAppS3Bucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"BucketName": "jamshid-angular-shop-market",
"WebsiteConfiguration": {
"IndexDocument": "index.html",
"ErrorDocument": "index.html"
},
"PublicAccessBlockConfiguration": {
"BlockPublicAcls": false
},
"OwnershipControls": {
"Rules": [
{
"ObjectOwnership": "ObjectWriter"
}
]
}
}
},
"WebAppS3BucketPolicy": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "WebAppS3Bucket"
},
"PolicyDocument": {
"Statement": [
{
"Sid": "AllowCloudFrontAccessIdentity",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::jamshid-angular-shop-market/*",
"Principal": {
"AWS": {
"Fn::Join": [
" ",
[
"arn:aws:iam::cloudfront:user/CloudFront Origin Access Identity",
{
"Ref": "OriginAccessIdentity"
}
]
]
}
}
}
]
}
}
},
"OriginAccessIdentity": {
"Type": "AWS::CloudFront::CloudFrontOriginAccessIdentity",
"Properties": {
"CloudFrontOriginAccessIdentityConfig": {
"Comment": "Access identity between CloudFront and S3 bucket"
}
}
},
"WebAppCloudFrontDistribution": {
"Type": "AWS::CloudFront::Distribution",
"Properties": {
"DistributionConfig": {
"Origins": [
{
"DomainName": {
"Fn::GetAtt": [
"WebAppS3Bucket",
"RegionalDomainName"
]
},
"Id": "myS3Origin",
"S3OriginConfig": {
"OriginAccessIdentity": {
"Fn::Sub": "origin-access-identity/cloudfront/${OriginAccessIdentity}"
}
}
}
],
"Enabled": true,
"IPV6Enabled": true,
"HttpVersion": "http2",
"DefaultRootObject": "index.html",
"CustomErrorResponses": [
{
"ErrorCode": 404,
"ResponseCode": 200,
"ResponsePagePath": "/index.html"
}
],
"DefaultCacheBehavior": {
"AllowedMethods": [
"GET",
"HEAD",
"OPTIONS"
],
"CachedMethods": [
"GET",
"HEAD",
"OPTIONS"
],
"ForwardedValues": {
"Headers": [
"Access-Control-Request-Headers",
"Access-Control-Request-Method",
"Origin",
"Authorization"
],
"QueryString": false,
"Cookies": {
"Forward": "none"
}
},
"TargetOriginId": "myS3Origin",
"ViewerProtocolPolicy": "redirect-to-https",
"Compress": true,
"DefaultTTL": 0
},
"ViewerCertificate": {
"CloudFrontDefaultCertificate": true
}
}
}
}
},
"Outputs": {
"ServerlessDeploymentBucketName": {
"Value": {
"Ref": "ServerlessDeploymentBucket"
},
"Export": {
"Name": "sls-jamshid-angular-shop-market-dev-ServerlessDeploymentBucketName"
}
},
"WebAppS3BucketOutput": {
"Value": {
"Ref": "WebAppS3Bucket"
}
},
"WebAppCloudFrontDistributionOutput": {
"Value": {
"Fn::GetAtt": [
"WebAppCloudFrontDistribution",
"DomainName"
]
}
}
}
}
Loading