You can use this guide if, for some reason, you don’t want to use the CloudReactor & AWS Setup Wizard (but really, you should, it’s faster and easier).
Still want to go ahead with manual setup?
Broadly speaking, we’ll need to:
- Set up a cluster in AWS ECS (this is where your tasks will be deployed to)
- Set up AWS role permissions to allow CloudReactor to stop, start and schedule ECS tasks
- Configure CloudReactor with AWS ECS and AWS role settings
Configuration will require some keys and other parameters to be entered. We’ll note anything you need to record in red – open up a text file to hold those variables as we go along.
AWS provides a wizard that creates an ECS cluster in just a few steps. This is appropriate if you want to get started quickly. The wizard can optionally create a new VPC and new public subnets on that VPN – but cannot create private subnets.
We will continue with the AWS wizard. Note that when running the wizard, your user needs to have at least the permissions listed under “Amazon ECS First Run Wizard Permissions” here.
The steps to run the wizard are:
- Go to https://aws.amazon.com/ecs/getting-started/
- Click the
ECS console walkthroughbutton (log into AWS if necessary)
- Change the region to your default AWS region
- Click the
- Choose the
nginxcontainer image and click the
- On the next page, the defaults are sufficient, so hit
- On the next page, name your cluster the desired name of your deployment environment – for example
staging. If you have an existing VPC and subnets you want to use to run your tasks, you can select them here. Otherwise, the console will create a new VPC and subnets for you. After entering your desired cluster name, hit
- On the next and final page, review your settings and hit the
Createbutton. You’ll see the status of the created resources on the next page. If you didn’t choose existing subnets, record the subnet IDs
AWS will create:
- A cluster named as you chose on step 7 above.
- A VPC named
ECS [cluster name] - VPC
- 2 subnets in the VPC named
ECS [cluster name] - Public Subnet 1and
ECS [cluster name] - Public Subnet 2. You can see these in VPC .. Subnets. Note that if you used the wizard to create a new VPC and subnets for you, these subnets will be public; if you want to use private subnets, you’ll have to create your own. If you haven’t already, record the Subnet IDs
- A security group named
ECS staging - ECS Security Groupin the VPC. You can find it in
VPC .. Security Groups. Record the Security Group ID
- Once you’ve recorded the Subnet IDs and Security Group IDs, under “ECS resource creation”, you’ll see
Cluster [the name of the cluster you created]. Clicking this link will take you to the cluster’s details page; record the
Cluster ARNyou see here.
- ECS cluster created!
To have CloudReactor manage your tasks in your AWS environment, you’ll need to give CloudReactor permissions in AWS to run tasks, schedule tasks, create services, and trigger Workflows by deploying the CloudReactor AWS CloudFormation template, named
Follow the instructions in the README.md, in the section “Allowing CloudReactor to manage your tasks”.
Be sure to record the
- AWS role permissions created for CloudReactor!
Sign up for a CloudReactor account at https://dash.cloudreactor.io/signup, and login.
We’ll create a Run Environment in CloudReactor. A Run Environment contains settings that tell CloudReactor how to run tasks in AWS.
- Click on “Run Environments”, then “Add Environment”
- Name your environment (e.g. “staging”, “production”). You may want to keep the name in all lowercase letters without spaces or symbols besides “-“ and “_”, so that filenames and command-lines you’ll use later will be sane. Note the exact name of your Run Environment, as you’ll need this later.
- Fill in your AWS account ID and default region. Your AWS account ID is a 12-digit number that you can find by clicking “Support” then “Support Center”. For default region, select the region that you want CloudReactor to run tasks / workflows in (e.g.
Assumable Role ARNfill in the value of
CloudreactorRoleARNfrom the output of the CloudFormation stack.
External ID, use the same External ID you entered when you created the CloudFormation stack.
Workflow Starter Lambda ARN, fill in the value of
WorkflowStarterARNfrom the output of the CloudFormation stack.
Workflow Starter Access Key, fill in the value of
WorkflowStarterAccessKeyfrom the output of the CloudFormation stack.
- Add the subnets and security group created by the ECS getting started wizard above
- Under AWS ECS Settings, choose a
Default Launch Typeof
Fargateand check FARGATE under Supported Launch Types.
Default Cluster ARN, fill in the
Cluster ARNof the ECS cluster you created above
Default Execution Roleand
Default Task Role, fill in the value of
TaskExecutionRoleARNfrom the output of the CloudFormation stack.
- Click on the
- CloudReactor configured to run tasks in ECS!
At this point, AWS has the required infrastructure to run tasks on ECS, and CloudReactor and AWS can talk to each other.
Now, we can deploy tasks and have them managed by CloudReactor.