https://github.com/epomatti/aws-cloudfront-latency
CloudFront backbone connectivity testing
https://github.com/epomatti/aws-cloudfront-latency
apprunner aws cloudfront terraform
Last synced: about 2 months ago
JSON representation
CloudFront backbone connectivity testing
- Host: GitHub
- URL: https://github.com/epomatti/aws-cloudfront-latency
- Owner: epomatti
- License: mit
- Created: 2023-07-05T21:15:56.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-01-20T02:25:05.000Z (over 2 years ago)
- Last Synced: 2025-01-17T18:34:48.663Z (over 1 year ago)
- Topics: apprunner, aws, cloudfront, terraform
- Language: HCL
- Homepage:
- Size: 17.6 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AWS CloudFront latency
Comparing latency when using AWS CloudFront at long distances as opposed to calling a web service directly.
> Cache is disabled to to force round trips to the server
```mermaid
flowchart LR
A(Client - sa-east-1) -->|Internet| B(AWS CloudFront
Edge Location)
B -->|AWS backbone| C(AWS App Runner
us-east-2)
A -->|Internet| C
```
## Setup
This project runs my [stressbox][1] image for testing as default.
Create a private ECR:
```sh
aws ecr create-repository --repository-name stressbox
```
Pull the image and tag it with the repository name in the account:
```sh
account=""
region=""
docker pull ghcr.io/epomatti/stressbox
docker tag ghcr.io/epomatti/stressbox "$account.dkr.ecr.$region.amazonaws.com/stressbox"
```
Push the image to the account repository:
```sh
aws ecr get-login-password --region $region | docker login --username AWS --password-stdin $account.dkr.ecr.$region.amazonaws.com
docker push $account.dkr.ecr.$region.amazonaws.com/stressbox
```
Create a `.auto.tfvars` file with the ECR image URL:
```terraform
ecr_image = ".dkr.ecr..amazonaws.com/stressbox:latest"
```
Create the infrastructure:
```sh
terraform init
terraform apply -auto-approve
```
Run latency and access tests.
---
### Clean-up
Delete the resources:
```sh
terraform destroy -auto-approve
aws ecr delete-repository --repository-name stressbox --force
```
TODO:
```
cloudfront custom origin slow response
https://aws.amazon.com/blogs/networking-and-content-delivery/improve-your-website-performance-with-amazon-cloudfront/
```
[1]: https://github.com/epomatti/stressbox