Skip to content

feat: task 2 links for static page #552

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ This is frontend starter project for nodejs-aws mentoring program. It uses the f
- [Prettier](https://prettier.io/) as a code formatting tool
- [TypeScript](https://www.typescriptlang.org/) as a type checking tool

# Task 2 links:
S3: http://epam-shopify-static.s3-website.us-east-2.amazonaws.com
CloudFront: https://d3keyolghfokto.cloudfront.net

## Available Scripts

### `start`
Expand Down
8 changes: 8 additions & 0 deletions infra/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
*.js
!jest.config.js
*.d.ts
node_modules

# CDK asset staging directory
.cdk.staging
cdk.out
6 changes: 6 additions & 0 deletions infra/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.ts
!*.d.ts

# CDK asset staging directory
.cdk.staging
cdk.out
354 changes: 354 additions & 0 deletions infra/MyStack.template.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,354 @@
Resources:
deploymentFrontendBucket67CEB713:
Type: AWS::S3::Bucket
Properties:
PublicAccessBlockConfiguration:
BlockPublicAcls: true
BlockPublicPolicy: true
IgnorePublicAcls: true
RestrictPublicBuckets: true
Tags:
- Key: aws-cdk:cr-owned:1ce7d1df
Value: "true"
UpdateReplacePolicy: Retain
DeletionPolicy: Retain
Metadata:
aws:cdk:path: DeployWebAppStack/deployment/FrontendBucket/Resource
deploymentFrontendBucketPolicyF959E265:
Type: AWS::S3::BucketPolicy
Properties:
Bucket:
Ref: deploymentFrontendBucket67CEB713
PolicyDocument:
Statement:
- Action: s3:GetObject
Condition:
StringEquals:
AWS:SourceArn:
Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":cloudfront::"
- Ref: AWS::AccountId
- :distribution/
- Ref: deploymentCloudfrontDistributionDDB77E0D
Effect: Allow
Principal:
Service: cloudfront.amazonaws.com
Resource:
Fn::Join:
- ""
- - Fn::GetAtt:
- deploymentFrontendBucket67CEB713
- Arn
- /*
Version: "2012-10-17"
Metadata:
aws:cdk:path: DeployWebAppStack/deployment/FrontendBucket/Policy/Resource
deploymentCloudfrontDistributionOrigin1S3OriginAccessControl5D9F588E:
Type: AWS::CloudFront::OriginAccessControl
Properties:
OriginAccessControlConfig:
Name: DeployWebAppStackdeploymentCOrigin1S3OriginAccessControl7B502D35
OriginAccessControlOriginType: s3
SigningBehavior: always
SigningProtocol: sigv4
Metadata:
aws:cdk:path: DeployWebAppStack/deployment/CloudfrontDistribution/Origin1/S3OriginAccessControl/Resource
deploymentCloudfrontDistributionDDB77E0D:
Type: AWS::CloudFront::Distribution
Properties:
DistributionConfig:
CustomErrorResponses:
- ErrorCode: 404
ResponseCode: 200
ResponsePagePath: /index.html
DefaultCacheBehavior:
CachePolicyId: 658327ea-f89d-4fab-a63d-7e88639e58f6
Compress: true
TargetOriginId: DeployWebAppStackdeploymentCloudfrontDistributionOrigin1D877D363
ViewerProtocolPolicy: redirect-to-https
DefaultRootObject: index.html
Enabled: true
HttpVersion: http2
IPV6Enabled: true
Origins:
- DomainName:
Fn::GetAtt:
- deploymentFrontendBucket67CEB713
- RegionalDomainName
Id: DeployWebAppStackdeploymentCloudfrontDistributionOrigin1D877D363
OriginAccessControlId:
Fn::GetAtt:
- deploymentCloudfrontDistributionOrigin1S3OriginAccessControl5D9F588E
- Id
S3OriginConfig:
OriginAccessIdentity: ""
Metadata:
aws:cdk:path: DeployWebAppStack/deployment/CloudfrontDistribution/Resource
deploymentBucketDeploymentAwsCliLayerA85B3C9A:
Type: AWS::Lambda::LayerVersion
Properties:
Content:
S3Bucket:
Fn::Sub: cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}
S3Key: a912487bb1b34f5e5f6f07325f76f44d9faf30d9054d221303f1f3220d1d610e.zip
Description: /opt/awscli/aws
Metadata:
aws:cdk:path: DeployWebAppStack/deployment/BucketDeployment/AwsCliLayer/Resource
aws:asset:path: asset.a912487bb1b34f5e5f6f07325f76f44d9faf30d9054d221303f1f3220d1d610e.zip
aws:asset:is-bundled: false
aws:asset:property: Content
deploymentBucketDeploymentCustomResourceF86F2BCD:
Type: Custom::CDKBucketDeployment
Properties:
ServiceToken:
Fn::GetAtt:
- CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536
- Arn
SourceBucketNames:
- Fn::Sub: cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}
SourceObjectKeys:
- d7cdc111c8d49ae29f03b9a0067a4d076f43060f28b3094c3d6c8331aa8ad531.zip
DestinationBucketName:
Ref: deploymentFrontendBucket67CEB713
Prune: true
DistributionId:
Ref: deploymentCloudfrontDistributionDDB77E0D
DistributionPaths:
- /*
OutputObjectKeys: true
UpdateReplacePolicy: Delete
DeletionPolicy: Delete
Metadata:
aws:cdk:path: DeployWebAppStack/deployment/BucketDeployment/CustomResource/Default
CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Statement:
- Action: sts:AssumeRole
Effect: Allow
Principal:
Service: lambda.amazonaws.com
Version: "2012-10-17"
ManagedPolicyArns:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- :iam::aws:policy/service-role/AWSLambdaBasicExecutionRole
Metadata:
aws:cdk:path: DeployWebAppStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/Resource
CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF:
Type: AWS::IAM::Policy
Properties:
PolicyDocument:
Statement:
- Action:
- s3:GetBucket*
- s3:GetObject*
- s3:List*
Effect: Allow
Resource:
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":s3:::"
- Fn::Sub: cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}
- /*
- Fn::Join:
- ""
- - "arn:"
- Ref: AWS::Partition
- ":s3:::"
- Fn::Sub: cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}
- Action:
- s3:Abort*
- s3:DeleteObject*
- s3:GetBucket*
- s3:GetObject*
- s3:List*
- s3:PutObject
- s3:PutObjectLegalHold
- s3:PutObjectRetention
- s3:PutObjectTagging
- s3:PutObjectVersionTagging
Effect: Allow
Resource:
- Fn::GetAtt:
- deploymentFrontendBucket67CEB713
- Arn
- Fn::Join:
- ""
- - Fn::GetAtt:
- deploymentFrontendBucket67CEB713
- Arn
- /*
- Action:
- cloudfront:CreateInvalidation
- cloudfront:GetInvalidation
Effect: Allow
Resource: "*"
Version: "2012-10-17"
PolicyName: CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF
Roles:
- Ref: CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265
Metadata:
aws:cdk:path: DeployWebAppStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/ServiceRole/DefaultPolicy/Resource
CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C81C01536:
Type: AWS::Lambda::Function
Properties:
Code:
S3Bucket:
Fn::Sub: cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}
S3Key: 9a1fcb4a7ecba81ad70e9d3fb241f6794497da945dae5f25924e4dd002b65f2d.zip
Environment:
Variables:
AWS_CA_BUNDLE: /etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem
Handler: index.handler
Layers:
- Ref: deploymentBucketDeploymentAwsCliLayerA85B3C9A
Role:
Fn::GetAtt:
- CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265
- Arn
Runtime: python3.11
Timeout: 900
DependsOn:
- CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRoleDefaultPolicy88902FDF
- CustomCDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756CServiceRole89A01265
Metadata:
aws:cdk:path: DeployWebAppStack/Custom::CDKBucketDeployment8693BB64968944B69AAFB0CC9EB8756C/Resource
aws:asset:path: asset.9a1fcb4a7ecba81ad70e9d3fb241f6794497da945dae5f25924e4dd002b65f2d
aws:asset:is-bundled: false
aws:asset:property: Code
CDKMetadata:
Type: AWS::CDK::Metadata
Properties:
Analytics: v2:deflate64:H4sIAAAAAAAA/9VUyW7bMBD9luhY0GoWoEBzs51uQIoYdtCLERgUObYZUxyBiwNV0L93KFGOs7bXHgxa84aP8x45c56ffT7NT0/4gxsJuRtpVeTNwnOxYxRaNe4ibyZB7MAvm6zQKHazUGglxkKAc9ll9iFr79h0bfok1i8zpJQ67ug+X6T1eEqecAfLu5YJjUGuLRqfN1fKeauK4BUaopGw5kH7CWz5XqHNLpsMrdoo0zGzbK/gAezMokeBumcnyIJUFoQfeRxtva9c1rKBa47ob4p7QhMHWIt2Dq5C44CU0bFxD3nhg0s5NsHf3wJmfEM/v02KSfPi4qartDdsSuos6iWhnR2vYDF8LL9l7mLVSKg01iWQOb1rV4cA486Bd/k4Li3TvCwkzxuiueY12F9gHdGwhTIbDR7N12BE8jUEJZMCHXOj7K60DMxe0VVE/kNC5J0FW6GDFPOqBAxDBhU/ACWUaOuF+j0EoNpCCZbrhUdLJh1B+0o8/luEwpCYFFgrDa52HsqhCNx8sxiq9ClQDixbbqQGO5QSTKytvwbWZFzKn+C55J73Epm3Ae5eh6IDdHNHPv3VnP/JiC/H1T8K7sHrY6V9yw4+tEzxMm/mJI4soUcXSpCTOjZjZZURquKaXjKGgyt9Ttww7hhSFVnJDSmXXZ+q1GvHsXpszdBBfVm3OBuOGLp72STU07Ta/jBaGThgB0Xvgu/zvo12tkRZLA26qHY47Bbn3fU/q+FlWMo4QiDeg3ty7L+GuzL6Ctqh71fdU13R7BZa5eMHN9Wqu9O4g3Ujgnho5mzYNDiPJU08DFbAYSQNgW48BV8Fz57ktMzQY8vv3cf92af8/DQ/P7l3So3SS8vn/foHjzilWFkGAAA=
Metadata:
aws:cdk:path: DeployWebAppStack/CDKMetadata/Default
Condition: CDKMetadataAvailable
Outputs:
deploymentCloudFrontURL05BF422F:
Description: The distribution URL
Value:
Fn::GetAtt:
- deploymentCloudfrontDistributionDDB77E0D
- DomainName
Export:
Name: CloudfrontURL
deploymentBucketNameA59FA865:
Description: The name of the S3 bucket
Value:
Ref: deploymentFrontendBucket67CEB713
Export:
Name: BucketName
Conditions:
CDKMetadataAvailable:
Fn::Or:
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- af-south-1
- Fn::Equals:
- Ref: AWS::Region
- ap-east-1
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-1
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-2
- Fn::Equals:
- Ref: AWS::Region
- ap-northeast-3
- Fn::Equals:
- Ref: AWS::Region
- ap-south-1
- Fn::Equals:
- Ref: AWS::Region
- ap-south-2
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-1
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-2
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-3
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- ap-southeast-4
- Fn::Equals:
- Ref: AWS::Region
- ca-central-1
- Fn::Equals:
- Ref: AWS::Region
- ca-west-1
- Fn::Equals:
- Ref: AWS::Region
- cn-north-1
- Fn::Equals:
- Ref: AWS::Region
- cn-northwest-1
- Fn::Equals:
- Ref: AWS::Region
- eu-central-1
- Fn::Equals:
- Ref: AWS::Region
- eu-central-2
- Fn::Equals:
- Ref: AWS::Region
- eu-north-1
- Fn::Equals:
- Ref: AWS::Region
- eu-south-1
- Fn::Equals:
- Ref: AWS::Region
- eu-south-2
- Fn::Or:
- Fn::Equals:
- Ref: AWS::Region
- eu-west-1
- Fn::Equals:
- Ref: AWS::Region
- eu-west-2
- Fn::Equals:
- Ref: AWS::Region
- eu-west-3
- Fn::Equals:
- Ref: AWS::Region
- il-central-1
- Fn::Equals:
- Ref: AWS::Region
- me-central-1
- Fn::Equals:
- Ref: AWS::Region
- me-south-1
- Fn::Equals:
- Ref: AWS::Region
- sa-east-1
- Fn::Equals:
- Ref: AWS::Region
- us-east-1
- Fn::Equals:
- Ref: AWS::Region
- us-east-2
- Fn::Equals:
- Ref: AWS::Region
- us-west-1
- Fn::Equals:
- Ref: AWS::Region
- us-west-2
Parameters:
BootstrapVersion:
Type: AWS::SSM::Parameter::Value<String>
Default: /cdk-bootstrap/hnb659fds/version
Description: Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]

14 changes: 14 additions & 0 deletions infra/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Welcome to your CDK TypeScript project

This is a blank project for CDK development with TypeScript.

The `cdk.json` file tells the CDK Toolkit how to execute your app.

## Useful commands

* `npm run build` compile typescript to js
* `npm run watch` watch for changes and compile
* `npm run test` perform the jest unit tests
* `npx cdk deploy` deploy this stack to your default AWS account/region
* `npx cdk diff` compare deployed stack with current state
* `npx cdk synth` emits the synthesized CloudFormation template
Loading