Setting up AWS and CloudReactor manually
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.
Set up a cluster in AWS ECS
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.
Note that you may use other methods like CloudFormation templates or Terraform templates.
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
Get startedbutton - Choose the
nginxcontainer image and click theNextbutton - On the next page, the defaults are sufficient, so hit
Nextagain - 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, hitNextagain. - 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 1andECS [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 inVPC .. 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 theCluster ARNyou see here.
- ECS cluster created!
Set AWS role permissions to allow CloudReactor to stop, start and schedule ECS tasks
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 cloudreactor-aws-role-template.json.
Follow the instructions in the README.md, in the section “Allowing CloudReactor to manage your tasks”.
Be sure to record the ExternalID, CloudreactorRoleARN, TaskExecutionRoleARN, WorkflowStarterARN, and WorkflowStarterAccessKey values.
- AWS role permissions created for CloudReactor!
Configure CloudReactor with AWS ECS and AWS role settings
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.
us-west-2). - For
Assumable Role ARNfill in the value ofCloudreactorRoleARNfrom the output of the CloudFormation stack. - For
External ID, use the same External ID you entered when you created the CloudFormation stack. - For
Workflow Starter Lambda ARN, fill in the value ofWorkflowStarterARNfrom the output of the CloudFormation stack. - For
Workflow Starter Access Key, fill in the value ofWorkflowStarterAccessKeyfrom 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 TypeofFargateand check FARGATE under Supported Launch Types. - For
Default Cluster ARN, fill in theCluster ARNof the ECS cluster you created above - For
Default Execution RoleandDefault Task Role, fill in the value ofTaskExecutionRoleARNfrom the output of the CloudFormation stack. - Click on the
Savebutton
- CloudReactor configured to run tasks in ECS!
Next steps
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.