Skip to content

imgproxy/imgproxy-cloudformation

Repository files navigation

imgproxy logo

GH Build GH Lint


imgproxy is a fast and secure standalone server for resizing and converting remote images. The main principles of imgproxy are simplicity, speed, and security.

This repository contains a troposphere script that generates an AWS CloudFormation template to deploy imgproxy to AWS ECS. The script can generate different templates depending on your needs.

Using pre-built templates

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.

Note

The links in the README point to the templates built from the master branch. If you want to use a specific version, you can find the links in the releases section.

Full intallation

These templates create all the required resources, plug-n-play:

  • Networks (VPC, subnetworks, internet gateway, routing tables, etc)
  • Security groups
  • Application Load Balancer
  • ECS cluster
  • ECS capacity provider (Fargate or EC2)
  • EC2 autoscaling group (EC2 only)
  • ECS task definition
  • ECS service
  • Autoscaling rules
  • CloudFront distribution (optional)
Launch type
Fargate
EC2

Intallation without networking

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:

  • ECS cluster
  • ECS capacity provider (Fargate or EC2)
  • EC2 autoscaling group (EC2 only)
  • ECS task definition
  • ECS service
  • Autoscaling rules

These templates require the following resources to be provided via template parameters:

  • VPC
  • Subnetworks
  • Security group
  • Application Load Balancer listener
Launch type
Fargate
EC2

Intallation without cluster and networking

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:

  • ECS task definition
  • ECS service
  • Autoscaling rules

These templates require the following resources to be provided via template parameters:

  • VPC
  • Subnetworks (Fargate only)
  • Security group (Fargate only)
  • Application Load Balancer listener
  • ECS cluster

Important

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.

Launch type
Fargate
EC2

Building your own template

If you want to customize the template, you can build it yourself. You need to have Python and pip installed.

  1. Clone this repository:

    git clone https://github.com/imgproxy/imgproxy-cloudformation.git
  2. Install dependencies:

    pip install -r requirements.txt
  3. Run the script:

    ./template.py

If you want the script to write the template to a file instead of printing it to stdout, use the --output option:

./template.py --output template.yml

By default, the script will generate a template for Fargate. You can change the launch type by passing the --launch-type option:

./template.py --launch-type ec2

If you don't want the template to include networking resources, use the --no-network option:

./template.py --no-network

If you don't want the template to include the ECS cluster, use the --no-cluster option:

./template.py --no-cluster

Important

Since the Fargate and EC2 launch types require ECS services to be configured differently, make sure to use the --launch-type option corresponding to your ECS cluster's default capacity provider launch type.

Important

When the --no-cluster and --launch-type=ec2 options are used together, the --no-network option is required.

See the script's help (./template.py -h) for more options.

License

imgproxy-cloudformation is licensed under the MIT license.

See LICENSE for the full license text.

Security Contact

To report a security vulnerability, please contact us at security@imgproxy.net. We will coordinate the fix and disclosure.

About

AWS CloudFormation templates for deploying imgproxy to AWS ECS

Resources

License

Stars

Watchers

Forks

Languages