AWS: ECS Propagating Tags


-- What is ECS AWS?

Amazon Elastic Container Service is a cloud-based container orchestration service provided by AWS. It enables developers to easily deploy, manage, and scale containerized applications using Docker containers. With ECS, users can define and organize their applications into logical units called "task definitions," which specify the required resources and container images. These tasks run on EC2 instances or AWS Fargate, a serverless compute engine for containers.




-- ECS Services

The service offers a simplified and highly scalable solution for running containers, handling resource provisioning, load balancing, and automatic scaling based on demand. ECS also integrates seamlessly with other AWS services, such as Amazon VPC for networking, IAM for access control, and CloudWatch for monitoring.

By leveraging A ECS, developers can focus on their application's functionality without worrying about infrastructure management. Its flexibility, reliability, and tight integration with the AWS ecosystem make it a popular choice for deploying containerized workloads in production environments.


-- To update ECS propagating tags to 'Service'

Python code that uses the Boto3 library to update the `propagatingTags` attribute for an Amazon ECS service:


import boto3


def update_ecs(cluster_name, service_name, propagate_tags):

    ecs_client = boto3.client('ecs')


    try:

        response = ecs_client.update_service(

            cluster=cluster_name,

            service=service_name,

            propagateTags=propagate_tags

        )

        print(f"Service '{service_name}' tags propagation updated successfully.")

    except Exception as e:

        print(e)


cluster_name = '<<Cluster name or ARN>>'

service_name = '<<Service name>>'

update_ecs(cluster_name, service_name, propagate_tag)


Please ensure that you have the necessary permissions to update ECS services in your AWS environment before running this code.


Cloudfront access log short note and how to change Access log location in my next week's blog.


Thank you 🙂

Comments

Popular posts from this blog

Data analysis with R

Machine learning in Python

AWS: Config Rule & Compliance Check