• DevOps
    Case Study

    How we built a resilient multi-account, multi-cloud solution for a Health Tech service provider!

    READ CASESTUDY
    icon

    24/7 DevOps as a Service

    Round-the-clock DevOps for uninterrupted efficiency.

    icon

    Infrastructure as a Code

    Crafting infrastructure with ingenious code.

    icon

    CI/CD Pipeline

    Automated CI/CD pipeline for seamless deployments.

    icon

    DevSecOps

    Integrated security in continuous DevOps practices.

    icon

    Hire DevOps Engineers

    Level up your team with DevOps visionaries.

    icon

    Consulting Services

    Navigate success with expert DevOps consulting.

  • TechOps
    Case Study

    How we built a scalable Odoo solution for a Travel Tech service provider!

    READ CASESTUDY

    WEB HOSTING SUPPORT

    icon

    HelpDesk Support

    Highly skilled 24/7 HelpDesk Support

    icon

    Product Support

    Boost your product support with our expertise.

    MANAGED SERVICES

    icon

    Server Management

    Don’t let server issues slow you down. Let us manage them for you.

    icon

    Server Monitoring

    Safeguard your server health with our comprehensive monitoring solutions.

    STAFF AUGMENTATION

    icon

    Hire an Admin

    Transform your business operations with our expert administrative support.

    icon

    Hire a Team

    Augment your workforce with highly skilled professionals from our diverse talent pool.

  • CloudOps
    Case Study

    How we helped a Private Deemed University in India, save US $3500/m on hosting charges!

    READ CASESTUDY
    icon

    AWS Well Architected Review

    Round-the-clock for uninterrupted efficiency

    icon

    Optimize

    Efficient CloudOps mastery for seamless cloud management

    icon

    Manage

    Automated CI/CD pipeline for seamless deployments

    icon

    Migrate

    Upgrade the journey, Migrate & Modernize seamlessly

    icon

    Modernize

    Simplify compliance complexities with our dedicated services

    icon

    FinOps as a Service

    FinOps as a Service

  • SecOps
    Case Study

    How we built a scalable Odoo solution for TravelTech service provider!

    READ CASESTUDY
    icon

    VAPT

    Vulnerability Assessment and Penetration Testing

    icon

    Source Code Review

    Ensuring source code security ans safe practices to reduce risks

    icon

    Security Consultation

    On demand services for improving server security

    icon

    System Hardening

    Reduced vulnerability and proactive protection

    icon

    Managed SoC

    Monitors and maintains system security. Quick response on incidents.

    icon

    Compliance as a Service

    Regulatory compliance, reduced risk

  • Insights
    Case Study

    How we helped a Private Deemed University in India, save US $3,500/m on hosting charges!

    READ CASESTUDY
    icon

    Blog

    Explore our latest articles and insights

    icon

    Case Studies

    Read about our client success stories

    icon

    Flipbook

    Explore our latest Flipbook

    icon

    Events

    Join us at upcoming events and conferences

    icon

    Webinars

    Watch our educational webinar series

  • Our Story
  • Contact Us

Interested to collaborate?

Get in touch with us!

Ready to elevate your business with certified cloud expertise? Contact us today to learn how our team can help you leverage cloud technology to drive growth, streamline operations, and enhance security.

  • AWSAWS
  • Azure CloudAzure Cloud
  • Google CloudGoogle Cloud
  • Akamai CloudAkamai Cloud
  • OVHOVH
  • Digital OceanDigital Ocean
  • HetznerHetzner
  • Kubernetes Consultancy Services
  • K8s & Cloud native Solutions
  • 24/7 Infrastructure Monitoring
  • DevOps as a Service
  • Cloud CI/CD Solutions
  • White Labeled MSP Support
  • Our story
  • Life@SupportSages
  • Insights
  • Careers
  • Events
  • Contact Us

Connect with us!


LinkedInFacebookXInstagramYouTube

aws partneraws advanced partner
SupportSages

Copyright © 2008 – 2026 SupportSages Pvt Ltd. All Rights Reserved.
Privacy PolicyLegal TermsData ProtectionCookie Policy

Modify Subnets of existing ECS Service

Rohit S

  • 4 min read
Modify Subnets of existing ECS Service

Generating audio, please wait...

Prerequisites:

  1. IAM Profile with ECS Full access
  2. AWS CLI installed

Suppose, you have only 2 subnets in your VPC and you have deployed ECS in those 2 subnets. But one day, you were required to add an additional subnet to your VPC and you have added it. Now, you also want to modify your ECS service’s network configuration and want to add this additional subnet. How will you do it?

Well, today we are going to learn how we can achieve this. We are going to use AWS CLI for this as this cannot be done via AWS console.

1. Create an IAM ROLE with ECS full access

To create an IAM role with full access, follow these steps:

  1. Login to your AWS Console.
  2. Go to IAM.
  3. Select USERS.
  4. Click Create User.
  5. Give your User a name.

I am going to give ECS full access to my user as I only have one service, you can give restricted access to only the service that need to be modified if it is desired.

You can check the AWS documentation for reference.

6. Click attach policies directly.

7.Select “AmazonECS_FullAccess”.

8. Click Next.

9. Click Create User.

2. Create an Access Key

To create an access key:

  1. Select the User you have created.
  2. Go to Security Credentials.
  3. Scroll down and on Access Key box, click Create Access Key.
  4. Select Command line interface.
  5. Select “I understand the above recommendation and want to proceed to create an access key.”
  6. Click Next.
  7. Save the Access Key and Secret Key.

3. Configure AWS PROFILE in your machine

To configure the AWS Profile:

  1. Go to your terminal
  2. You can set the profile as default profile or as a specific profile.
  3. If you want to set it as the default profile, Run the command “aws configure” and it will ask the access key, provide your access key and press ENTER and then it will ask your Secret Access Key, provide it and press ENTER and the it will ask the Region, provide the Region-id in which your resource is created and press ENTER and it will ask Format, just press ENTER for that. That’s it.
  4. To set it as a specific profile follow the same steps as above but run the command:
aws configure --profile=<profile-name”” instead of “aws configure

4. Create the Json for configuration

You need to create a Json with the subnet configuration and other configuration. I will provide the example JSON below.

{
"awsvpcConfiguration": {
"subnets": ["subnet-abc", "subnet-def", “subnet-ghi”],
"securityGroups": ["sg-12345"],
"assignPublicIp": "DISABLED" 
}
} 

You need to change the names of subnets and security groups and set the assign public IP as per your configuration, there are two options DISABLED and ENABLED.

Previously I only has “subnet-abc” and “subnet-def”, I am adding the “subnet-ghi”.

note: You may be thinking that we only need to modify subnets and we can skip the “securitygroups” and “assingpublicip”, but if you do so, your ECS service’s security group will be set to default and “assignpublicip” will be set to default too. So, you need to pass this whole JSON that I have provided above.

After copying and editing the JSON, save the file. For example, let’s save it as network.json

5. Reconfiguring using AWS CLI

Now, for the last step. If you have configured the AWS profile as a specific profile, you need to first, export the profile using the below command:

export AWS_PROFILE=<profile-name>

After that, run the below command:

aws ecs update-service --cluster <ECS cluster name> --service <ECS service-name> --network-configuration file://network.json

Change the ECS cluster name, ECS Service name and the file’s name as per your configuration.

Also, if you have set the profile as default profile, no need for export command. You can directly run the above command.

Now, you can go to you ECS service and can see the subnet configuration under “Network Configuration” in “Configuration and Networking” and can see that your modification has been applied.

Facing a growing VPC and need to adapt your ECS service’s subnets? This blog empowers you to leverage the AWS CLI for effortless subnet modifications. Ensure your ECS deployments remain flexible and optimized — learn how to add new subnets and streamline your DevOps workflow today!

  • AWS
  • DevOps

Continue Your Journey With…

DevOps as a Service

DevOps as a Service

Let us do the heavy lifting for you

Promotional banner
Promotional banner
Modify Subnets of existing ECS Service

A quick Guide on Wazuh installation in CentOS

A quick Guide on Wazuh installation in CentOS
  • DevOps
logo

Adding multiple target group to a single AWS ECS Service

Adding multiple target group to a single AWS ECS Service
  • AWS
  • DevOps
logo

AWS Cloudtrail Logs to Wazuh

AWS Cloudtrail Logs to Wazuh
  • AWS
  • DevOps
logo

Cloudwatch logs to Wazuh

Cloudwatch logs to Wazuh
  • AWS
  • DevOps
logo

Posts by Rohit S