|
| 1 | +<p align="center"> |
| 2 | + <a href="https://imgproxy.net"> |
| 3 | + <picture> |
| 4 | + <source media="(prefers-color-scheme: dark)" srcset="assets/logo-dark.svg?sanitize=true"> |
| 5 | + <source media="(prefers-color-scheme: light)" srcset="assets/logo-light.svg?sanitize=true"> |
| 6 | + <img alt="imgproxy logo" src="assets/logo-light.svg?sanitize=true"> |
| 7 | + </picture> |
| 8 | + </a> |
| 9 | +</p> |
| 10 | + |
| 11 | +<h4 align="center"> |
| 12 | + <a href="https://imgproxy.net">Website</a> | |
| 13 | + <a href="https://imgproxy.net/blog/">Blog</a> | |
| 14 | + <a href="https://docs.imgproxy.net">Documentation</a> | |
| 15 | + <a href="https://imgproxy.net/#pro">imgproxy Pro</a> | |
| 16 | + <a href="https://hub.docker.com/r/darthsim/imgproxy/">Docker</a> | |
| 17 | + <a href="https://twitter.com/imgproxy_net">Twitter</a> | |
| 18 | + <a href="https://discord.gg/5GgpXgtC9u">Discord</a> |
| 19 | +</h4> |
| 20 | + |
| 21 | +--- |
| 22 | + |
| 23 | +[imgproxy](https://imgproxy.net) is a fast and secure standalone server for resizing and converting remote images. The main principles of imgproxy are simplicity, speed, and security. |
| 24 | + |
| 25 | +This repository contains a [troposphere](https://github.com/cloudtools/troposphere) script that generates an [AWS CloudFormation](https://aws.amazon.com/cloudformation/) template to deploy imgproxy to [AWS ECS](https://aws.amazon.com/ecs/). The script can generate different templates depending on your needs. |
| 26 | + |
| 27 | +## Using pre-built templates |
| 28 | + |
| 29 | +We prepared a few pre-built templates that you can use right away. Just click on a link, set the required options, and you're ready to process your images. |
| 30 | + |
| 31 | +### Full intallation |
| 32 | + |
| 33 | +These templates create all the required resources, plug-n-play: |
| 34 | + |
| 35 | +- Networks (VPC, subnetworks, internet gateway, routing tables, etc) |
| 36 | +- Security groups |
| 37 | +- Application Load Balancer |
| 38 | +- ECS cluster |
| 39 | +- ECS capacity provider (Fargate or EC2) |
| 40 | +- EC2 autoscaling group (EC2 only) |
| 41 | +- ECS task definition |
| 42 | +- ECS service |
| 43 | +- Autoscaling rules |
| 44 | +- CloudFront distribution (optional) |
| 45 | + |
| 46 | +| Launch type | | |
| 47 | +|-------------|----| |
| 48 | +| Fargate | [](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=imgproxy&templateURL=https://imgproxy-cf.s3.amazonaws.com/latest/ecs-fargate-full.yml) | |
| 49 | +| EC2 | [](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=imgproxy&templateURL=https://imgproxy-cf.s3.amazonaws.com/latest/ecs-ec2-full.yml) | |
| 50 | + |
| 51 | +### Intallation without networking |
| 52 | + |
| 53 | +If you already have an Application Load Balancer and networks configured, you may want your imgproxy installation to use them. These templates create all the required resources except for networking: |
| 54 | + |
| 55 | +- ECS cluster |
| 56 | +- ECS capacity provider (Fargate or EC2) |
| 57 | +- EC2 autoscaling group (EC2 only) |
| 58 | +- ECS task definition |
| 59 | +- ECS service |
| 60 | +- Autoscaling rules |
| 61 | + |
| 62 | +These templates require the following resources to be provided via template parameters: |
| 63 | + |
| 64 | +- VPC |
| 65 | +- Subnetworks |
| 66 | +- Security group |
| 67 | +- Application Load Balancer listener |
| 68 | + |
| 69 | +| Launch type | | |
| 70 | +|-------------|----| |
| 71 | +| Fargate | [](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=imgproxy&templateURL=https://imgproxy-cf.s3.amazonaws.com/latest/ecs-fargate-no-network.yml) | |
| 72 | +| EC2 | [](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=imgproxy&templateURL=https://imgproxy-cf.s3.amazonaws.com/latest/ecs-ec2-no-network.yml) | |
| 73 | + |
| 74 | +### Intallation without cluster and networking |
| 75 | + |
| 76 | +If you already have an ECS cluster, you may want to deploy imgproxy to it. These templates create all the required resources except for the cluster and networking: |
| 77 | + |
| 78 | +- ECS task definition |
| 79 | +- ECS service |
| 80 | +- Autoscaling rules |
| 81 | + |
| 82 | +These templates require the following resources to be provided via template parameters: |
| 83 | + |
| 84 | +- VPC |
| 85 | +- Subnetworks (Fargate only) |
| 86 | +- Security group (Fargate only) |
| 87 | +- Application Load Balancer listener |
| 88 | +- ECS cluster |
| 89 | + |
| 90 | +> [!IMPORTANT] |
| 91 | +> The created service will use the default capacity provider of the cluster. If you want to use a different capacity provider, you need to modify the template. |
| 92 | +
|
| 93 | +| Launch type | | |
| 94 | +|-------------|----| |
| 95 | +| Fargate | [](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=imgproxy&templateURL=https://imgproxy-cf.s3.amazonaws.com/latest/ecs-fargate-no-cluster.yml) | |
| 96 | +| EC2 | [](https://console.aws.amazon.com/cloudformation/home#/stacks/new?stackName=imgproxy&templateURL=https://imgproxy-cf.s3.amazonaws.com/latest/ecs-ec2-no-cluster.yml) | |
| 97 | + |
| 98 | +## Building your own template |
| 99 | + |
| 100 | +If you want to customize the template, you can build it yourself. You need to have [Python](https://www.python.org/) and [pip](https://pip.pypa.io/en/stable/installing/) installed. |
| 101 | + |
| 102 | +1. Clone this repository: |
| 103 | + |
| 104 | + ```bash |
| 105 | + git clone https://github.com/imgproxy/imgproxy-cloudformation.git |
| 106 | + ``` |
| 107 | +2. Install dependencies: |
| 108 | + |
| 109 | + ```bash |
| 110 | + pip install -r requirements.txt |
| 111 | + ``` |
| 112 | +3. Run the script: |
| 113 | + |
| 114 | + ```bash |
| 115 | + ./template.py |
| 116 | + ``` |
| 117 | + |
| 118 | +If you want the script to write the template to a file instead of printing it to stdout, use the `--output` option: |
| 119 | + |
| 120 | +```bash |
| 121 | +./template.py --output template.yml |
| 122 | +``` |
| 123 | + |
| 124 | +By default, the script will generate a template for Fargate. You can change the launch type by passing the `--launch-type` option: |
| 125 | + |
| 126 | +```bash |
| 127 | +./template.py --launch-type ec2 |
| 128 | +``` |
| 129 | + |
| 130 | +If you don't want the template to include networking resources, use the `--no-network` option: |
| 131 | +
|
| 132 | +```bash |
| 133 | +./template.py --no-network |
| 134 | +``` |
| 135 | +
|
| 136 | +If you don't want the template to include the ECS cluster, use the `--no-cluster` option: |
| 137 | + |
| 138 | +```bash |
| 139 | +./template.py --no-cluster |
| 140 | +``` |
| 141 | + |
| 142 | +> [!IMPORTANT] |
| 143 | +> Since the ECS cluster's default capacity provider may be configured to use existing networking resources such as VPC, subnetworks, and security groups, the `--no-cluster` option requires the `--no-network` option to be used as well. |
| 144 | +
|
| 145 | +See the script's help (`./template.py -h`) for more options. |
| 146 | + |
| 147 | +## License |
| 148 | + |
| 149 | +imgproxy-cloudformation is licensed under the MIT license. |
| 150 | + |
| 151 | +See [LICENSE](https://github.com/imgproxy/imgproxy-cloudformation/blob/master/LICENSE) for the full license text. |
| 152 | + |
| 153 | +## Security Contact |
| 154 | + |
| 155 | +To report a security vulnerability, please contact us at security@imgproxy.net. We will coordinate the fix and disclosure. |
0 commit comments