-
Notifications
You must be signed in to change notification settings - Fork 82
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
docs: Added VPC facing docs and pivotRole docs - V1.5.0 release #298
Merged
dlpzx
merged 6 commits into
gh-pages
from
294-better-instructions-for-vpc-facing-frontend
Apr 26, 2023
Merged
Changes from 2 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
19331fb
Added VPC facing docs
dlpzx d54e805
Added review comments from Sanjay and links from networking
dlpzx 3c3f561
Reviewed documentation for VPCs and NACL
dlpzx 7e63897
Update names in cdkjson "enable_pivot_role_auto_create" and add "enab…
dlpzx 61eabb5
Merge branch 'gh-pages' into 294-better-instructions-for-vpc-facing-f…
dlpzx f9e9cb9
Review docs on VPC
dlpzx File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 |
---|---|---|
|
@@ -122,15 +122,43 @@ the server hosting the documentation. | |
|
||
### VPC facing architecture | ||
In this architecture, data.all static sites are deployed on an AWS internal application load | ||
balancer (ALB) deployed on the VPC's private subnet. | ||
This ALB is reachable only from Amazon VPCs and not from the internet. | ||
Also, APIs are private and accessible only through VPC endpoints. | ||
balancer (ALB) deployed on the VPC's private subnet. Data.all static sites are hosted on Amazon ECS using docker containers through nginx server. | ||
|
||
|
||
Finally, data.all static sites are hosted on Amazon ECS using docker containers through nginx server. | ||
The ALB is reachable only from Amazon VPCs and not from the internet. Also, APIs are private and accessible only through VPC endpoints. | ||
For this kind of architecture, the following resources need to be provisioned as pre-requisite for the deployment: | ||
- Route 53 private hosted zone | ||
- ACM certificate | ||
- For the above you will also need a VPC which needs to be provided as input for the deployment. Check the backend VPC section to review the VPC requirements. | ||
|
||
With the following commands you can create the ACM certificate and Route 53 private hosted zone: | ||
1. `cd` to empty directory | ||
2. This command will create your pem and a paraphrase password file: `openssl req -x509 -newkey rsa:4096 -days 1825 -keyout dataallkey.pem -out dataall.pem` | ||
3. This command will create a no password file to load in ACM: `openssl rsa -in dataallkey.pem -out dataallkeynopwd.pem ` | ||
4. `aws route53 create-hosted-zone --name <domain-name> --vpc VPCRegion=<vpc_region>,VPCId=<vpc-id> --caller-reference 07:12:22 --query HostedZone.Id --output text ` | ||
5. `aws acm import-certificate --region us-east-1 --certificate fileb://<filepath to cert> --private-key fileb://<filepath to no password key> --query CertificateArn --output text` | ||
|
||
|
||
#### VPC facing + corporate network | ||
As stated above, the application in this case is accessible only from within the VPC. However, some customers require the ability to | ||
connect from outside the VPC but within the corporate network. | ||
|
||
As part of the deployment, data.all creates an API gateway and accesses it with the URL `https://<gateway-id>.execute-api.<region>.amazonaws.com` | ||
This works when we access the application from the VPC; but when we are outside of the VPC, the execute-api VPC endpoint needs to be added to the URL. | ||
Hence the URL should be: `https://<gateway-id>.<execute-api-vpc-endpoint-id>.execute-api.<region>.amazonaws.com`. | ||
For this requirement we need to modify the code in `deploy/stacks/lambda_api.py` and adjust the api URL accordingly. | ||
In addition, a new inbound rule needs to be added to the security group for the VPC endpoint to allow all inbound HHTPS on 443 for 10.0.0.0/8. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Typo: *HTTPS |
||
|
||
|
||
After it is deployed, How do I connect (or simulate the connection) between my VPN and data.all VPC? The following | ||
resources might be helpful for testing and connecting the deployment: | ||
- [Support post](https://aws.amazon.com/premiumsupport/knowledge-center/route53-resolve-with-inbound-endpoint/) | ||
- [Workshop](https://catalog.workshops.aws/networking/en-US/intermediate/3-hybrid-dns/10-hybrid-dns-overview) | ||
- [Reference architecture](https://d1.awsstatic.com/architecture-diagrams/ArchitectureDiagrams/hybrid-dns_route53-resolver-endpoint-ra.pdf) | ||
|
||
|
||
![](img/architecture_frontend_vpc.drawio.png#zoom#shadow) | ||
|
||
- Third party libraries: data.all static sites libraries are stored on AWS CodeArtifact which | ||
ensures third party libraries availability, encryption using AWS KMS and | ||
auditability through AWS CloudTrail. | ||
|
@@ -140,25 +168,35 @@ image, and does not rely on Dockerhub. Docker images are built with AWS | |
CodePipeline and stored on Amazon ECR which ensures image availability, | ||
and vulnerabilities scanning. | ||
|
||
|
||
![](img/architecture_frontend_vpc.drawio.png#zoom#shadow) | ||
|
||
|
||
## Backend Components <a name="backend"></a> | ||
|
||
![Screenshot](img/architecture_backend.drawio.png#zoom#shadow) | ||
|
||
### VPC | ||
### Backend VPC | ||
|
||
#### Created by data.all | ||
If we do not provide a VPC ID for the different infrastructure accounts in the deployment configuration (aka cdk.json), | ||
data.all creates its own VPC in the account where it is set up, with usual configuration. | ||
All compute is hosted in the **private subnets**, and communicates with AWS Services through a **NAT Gateway**. | ||
All backend compute is hosted in the **private subnets**, and communicates with AWS Services through a **NAT Gateway**. | ||
|
||
All data.all Lambda functions and ECS tasks are running inside this VPC and in private | ||
subnets. | ||
|
||
![Screenshot](img/architecture_vpc.drawio.png#zoom#shadow) | ||
|
||
#### Created outside of data.all | ||
There are 2 scenarios where we might want to provide our own VPCs: | ||
1) Organization guidelines. In your organization there are certain policies and mechanisms to create VPCs. | ||
2) Frontend needs to be hosted in data.all VPC facing architecture | ||
|
||
When providing the VPC, make sure that your VPC resembles the above image. In addition: | ||
1. Make sure it is deployed in at least 2 Availability Zones (AZ) | ||
2. Make sure at least 1 public subnet. Data.all needs to download packages, hence needs public access | ||
3. Make sure that the VPC created does not have an S3 VPC endpoint | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we add: "Make sure that there is at least one NAT gateway" ? |
||
|
||
Here is a screenshot of the creation of the VPC: | ||
![Screenshot](img/vpc_setup.png#zoom#shadow) | ||
|
||
![Screenshot](img/architecture_vpc.drawio.png#zoom#shadow) | ||
|
||
### Backend AWS API Gateway | ||
data.all backend main entry point is an AWS API Gateway that exposes a | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should consider making it configurable (maybe create an issue for it)?