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 .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v14.20.1
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"
}
}
}
}
210 changes: 210 additions & 0 deletions .serverless/cloudformation-template-update-stack.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
{
"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": "fahamed-shop-angular-frontend",
"PublicAccessBlockConfiguration": {
"BlockPublicAcls": true
},
"WebsiteConfiguration": {
"IndexDocument": "index.html",
"ErrorDocument": "index.html"
}
}
},
"WebAppS3BucketPolicy": {
"Type": "AWS::S3::BucketPolicy",
"Properties": {
"Bucket": {
"Ref": "WebAppS3Bucket"
},
"PolicyDocument": {
"Statement": [
{
"Sid": "AllowCloudFrontAccessIdentity",
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::fahamed-shop-angular-frontend/*",
"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": "fahamed-shop-angular-frontend.s3.amazonaws.com",
"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-shop-angular-frontend-dev-ServerlessDeploymentBucketName"
}
},
"WebAppS3BucketOutput": {
"Value": {
"Ref": "WebAppS3Bucket"
}
},
"WebAppCloudFrontDistributionOutput": {
"Value": {
"Fn::GetAtt": [
"WebAppCloudFrontDistribution",
"DomainName"
]
}
}
}
}
Loading