Running on AWS Fargate
Important:
- For Single ECS, use IP license.
- For managed ECS, Unlimited License is required. For the license, please contact SearchBlox support.
To use Fargate with ECS to run a series of containerized tasks or steps, follow the below steps:
Important:
- We can get Image URI in two ways:
NOTE: You can follow any one of the above step and Creating a Fargate Cluster is common for both the above steps.
Getting Image URI from AWS Marketplace
- Go to AWS Marketplace and Subcribe to SearchBlox Enterprise Search, by clicking the below link.
- Link to Fargate version
- Click on
Continue to Subscribe
.
![](https://files.readme.io/4c4fb91-image_45.png)
- Click on
Continue to Configuration
.
![](https://files.readme.io/47ffab4-image_46.png)
- Click on
Continue to Launch
![](https://files.readme.io/a02a2ea-image_47.png)
- Scroll down to the
Container images
section and copy the commands that are shown below as shown in the image.
aws ecr get-login-password
--region us-east-1 | docker login
--username AWS
--password-stdin xxxxxxx.dkr.ecr.us-east-1.amazonaws.com
CONTAINER_IMAGES="xxxxxx.dkr.ecr.us-east-1.amazonaws.com/searchblox/searchblox:v10.5"
for i in $(echo $CONTAINER_IMAGES | sed "s/,/ /g"); do docker pull $i; done
![](https://files.readme.io/fa643d1-image_48.png)
- After executing the above command the below response can be seen and copy the last line, which is the
Image URI
used for the next steps.
v10.5: Pulling from searchblox/searchblox
Digest: sha256:a13abcd5f970e253c8be2b7a093c215728046d2f4a0505343710a80bae39801d
Status: Image is up to date for xxxxxx.dkr.ecr.us-east-1.amazonaws.com/searchblox/searchblox:v10.5
xxxxxx.dkr.ecr.us-east-1.amazonaws.com/searchblox/searchblox:v10.5
Importing Custom Docker Image into the Registry
- Sign in to the AWS Management Console and navigate to the Amazon Elastic Container Service console.
- After selecting the ECS Container, select Repositories on the left pane. You will be redirected to Amazon Elastic Container Registry.
- Select Create repository.
![](https://files.readme.io/13be31c-capture_3.png)
- Select Private and specify the Repository name.
Note:
Name should be same as the Docker image.
![](https://files.readme.io/75b6236-Cap_4.png)
- Leave everything as default and Create repository.
- Once Repository is Successfully created, select View push commands.
![](https://files.readme.io/2456181-cap_5.png)
- Read the instructions carefully on the page below.
![](https://files.readme.io/724e07b-Cap_6.png)
Note:
Highlighted text in the above image needs to be changed as per the Docker image Tag name.
-
Execute the following rewritten commands on the Terminal. Simply copy and paste to execute.
NOTE : Before executing the following commands make sure AWS CLI is installed on the terminal.
-
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin XXXXXXXXXXXX.dkr.ecr.us-east-1.amazonaws.com
NOTE : Skip the next command, if Docker image is already built else run the below command to pull the image
docker pull searchblox/searchblox:v10.5
-
docker build -t searchblox10.5
-
docker tag searchblox10.5:v10.5 XXXXXXXXXXXX.dkr.ecr.us-east-1.amazonaws.com/searchblox10.5:v10.5
-
docker push XXXXXXXXXXXX.dkr.ecr.us-east-1.amazonaws.com/searchblox10.5:v10.5
- After the 4th command is executed, the image is pushed into the newly created repository.
- Copy the image URI.
![](https://files.readme.io/5699ed2-Cap_8.png)
Creating Fargate Cluster
- Navigate to Main Menu of Amazon ECS.
- Select Clusters to create a new cluster.
![](https://files.readme.io/d9dfc5c-cap_9.png)
- Select Create cluster.
![](https://files.readme.io/bc82695-cap_10.png)
- Enter the Cluster name.
- Under Infrastructure, Select AWS Fargate (serverless).
![](https://files.readme.io/51de30a-cap_11.png)
- Toggle on Use Container Insights, if you want to monitor the CPU and RAM usage. Click on Create button.
![](https://files.readme.io/a3d5c15-cap_12.png)
- Navigate back to Amazon ECS Main Menu and select Task definitions.
![](https://files.readme.io/17eca8f-cap_13.png)
- Under Task definitions, select Create new task definition.
![](https://files.readme.io/5babe44-cap_14.png)
- Specify the Task definition family and choose AWS Fargate.
![](https://files.readme.io/3ff1ee1-cap_15.png)
- Choose Linux/86_64 and specify the CPU size and Memory (As per the docker image size).
- Create a task role in AWS IAM. Allow full permissions for ECS and Cloud Watch.
![](https://files.readme.io/624bae2-image_40.png)
- To create a role in AWS, navigate to IAM service, click on left-side panel ROLES. Click on Create a Role. Select Trusted entity type as AWS Service and select usecase as lamda, click on Next button.
![](https://files.readme.io/2fe44c8-image_41.png)
- In the Add Permission section search for AmazonECSTaskExecutionRolePolicy.
![](https://files.readme.io/32f8157-image_42.png)
- Select the ecsTaskExecutionRole created in IAM console.
![](https://files.readme.io/b459322-image_39.png)
NOTE: Task size should be 4 CPU and 16GB Memory.
- Under Container-1 setting, specify the Name and paste the Image URI copied from the repositories page. Example :
xxxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/<repository name>/searchblox:v10.5
![](https://files.readme.io/767c44e-cap17.png)
- Under Port mappings, add the port numbers (8443, 8444, 8446, 9200) and set the App protocol as HTTP.
- Allocate Memory hard limit, Memory soft limit and the CPU cores as default, can be increased based on the requirements.
- Storage can be increased as shown in the below image.
![](https://files.readme.io/a501b37-image_43.png)
- Select Create.
![](https://files.readme.io/5966ce1-cap20.png)
Running The Task
- The below page will appear after creating task definition.
- Click on Deploy drop down box and select Run task.
![](https://files.readme.io/0e7ae48-Cap_21.png)
- Choose the Existing cluster name.
- Under Compute options, select Capacity provider strategy.
![](https://files.readme.io/bd4d93e-cap22.png)
- Capacity provider is FARGATE,
- Set the Base to 1.
- Set Platform revision to LATEST.
![](https://files.readme.io/0400878-cap_23.png)
- The number of Desired tasks to be lauched, can be changed. The Task name should be unique.
![](https://files.readme.io/8a720d5-cap24.png)
- Under Networking, choose the default VPC ,Subnets or based on your specific requirements.
![](https://files.readme.io/7917a24-cap25.png)
- Select Create new security group and specify the Security group name and Security group description.
- Under Inbound rules for security groups, select Custom as Type.
- Add Port range (8443,8444,9200)
- Select Source as Anywhere.
![](https://files.readme.io/33c9d9b-cap_26.png)
- Public IP should be Turned on.
- Select Create.
![](https://files.readme.io/32b7788-cap27.png)
- After the task is created, it will navigate to the below page.
- The status of the task can be checked under Last status.
- Wait until the task gets Completed.
![](https://files.readme.io/3b18272-cap28.png)
- If the task is completed, the Public IP can be obtained under the Network binding section.
![](https://files.readme.io/e79daec-cap29.png)
- To access the SearchBlox console, use the Public IP on the browser
https://<Public IP>:8443/console
Important:
- If you are not able to access the SearchBlox Console, check the security group.
Updated 10 months ago