Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

Use static or elastic IP address for ECS task on Fargate: Amazon EC2

by | Aug 18, 2021

Wondering how to use the static or elastic IP address for the ECS task on Fargate? We can help you with this!

As a part of our AWS Support Services, we often receive similar requests from our AWS customers.

Today, let’s see the steps followed by our Support Techs to help our customers to add a static IP address or Elastic IP address to a Fargate task.

 

Use the static or elastic IP address for the ECS task on Fargate

 
We can’t directly assign a static or elastic IP address to an ECS task on Fargate. So for creating a static IP address, we must use a Network Load Balancer with an Elastic IP address and Fargate service.

Let’s see the steps for creating a static IP address for a Fargate task for inbound traffic:
 

Creating a network load balancer

 

  1. Log in to the AWS Management console and then open the Amazon EC2 console.

2. Select Load Balancers from the section LOAD BALANCING.

3. Then select Create Load Balancer.

4. Select Create for Network Load Balancer from the load balancer type section.

5. Then enter a name for the load balancer for the Name option on the Configure Load Balancer page.

6. Select external or internal-facing for the Scheme option.

7. Add another listener or keep the default (accepts TCP traffic on the port 80)one for Listeners. Here we can modify the port and protocol of the default listener or we can select the option Add listener to add another listener.

8. Select the Amazon VPC as VPC for our Fargate task in the Availability Zones section. To associate an Elastic IP address with the subnet, select the IP address from Elastic IP.

9. Now, Skip the Next: Configure Security Settings page.

10. Then select Next: Configure Routing.
 

Configure Routing for the target group

 

  1. Select New target group for Target group on the Configure Routing page.

2. Enter a name for the target group for Name and select Instance or IP (Select IP to register the targets with an IP address) for the Target type.

3. Then enter the protocol for Protocol and enter the port for the option Port.

4. Keep the default settings for the Health checks section and then select Next: Register Targets. Here we don’t add targets to the target group as Amazon ECS handles target registration. Amazon ECS automatically registers and deregisters containers with the target group.

5. So we can skip the Register Targets page.

6. Select Next: Review, and then select Create.
 

Creating an Amazon ECS service

 
Now we can create an Amazon ECS service. Make sure to specify the target group in the service definition while creating the service.

When each task is started, the container and port defined in the service definition are registered with the target group. And the traffic is then routed from the load balancer to the container.

Note: To create a static IP address for a Fargate task for outbound traffic, create a NAT gateway. In this scenario, a static IP address is required by the downstream consumer. We must place the Fargate task on a private subnet. We can use the NAT gateway IP address for an IP allow list.

[Need help with more AWS queries? We’d be happy to assist]

 

Conclusion

 
To conclude, today we discussed the steps followed by our Support Engineers to help our customers to add the static or elastic IP address for the ECS task on Fargate.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF