{"id":2657,"date":"2024-02-26T21:09:53","date_gmt":"2024-02-26T21:09:53","guid":{"rendered":"https:\/\/www.maghilda.com\/staging\/9669\/?p=2657"},"modified":"2024-02-26T21:23:25","modified_gmt":"2024-02-26T21:23:25","slug":"howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail","status":"publish","type":"post","link":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/","title":{"rendered":"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail"},"content":{"rendered":"\n<p class=\"\">In this tutorial, we will automate the tagging of new EC2 instances using CloudFormation templates. In the <a href=\"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-eventbridge-to-trigger-a-lambda-function-written-in-python-to-tag-ec2-instances\/\">previous<\/a> tutorial, we learnt how to tag AWS EC2 instances when they are created. We created an event rule in EventBridge to trigger a Lambda function to tag new EC2 instances with the name of the user that created it. That tutorial had step by step instructions on how to accomplish this via the AWS management console. This tutorial covers all the steps using CloudFormation templates for easy build and tear down and re-use in the future.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Steps<\/h3>\n\n\n\n<ol style=\"margin-right:var(--wp--preset--spacing--50);margin-left:var(--wp--preset--spacing--50)\" class=\"wp-block-list\">\n<li class=\"\">Create a python file with the Lambda function to tag EC2 instances when they are created<\/li>\n\n\n\n<li class=\"\">Upload the file to a S3 bucket<\/li>\n\n\n\n<li class=\"\">Create the VPC stack<\/li>\n\n\n\n<li class=\"\">Create the CloudTrail stack<\/li>\n\n\n\n<li class=\"\">Create the Lambda deployment and EventBridge rules stack<\/li>\n\n\n\n<li class=\"\">Create EC2 stack<\/li>\n\n\n\n<li class=\"\">Validate the tags on the EC2 instances&nbsp;<\/li>\n\n\n\n<li class=\"\">Clean up resources. Delete all the stacks above<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1: Create a python file with the Lambda function to tag EC2 instances when they are created<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>import json\nimport boto3\n\nprint('loading tagEC2 lambda function')\n \nec2 = boto3.client('ec2')\n \ndef lambda_handler(event, context):\n    #print(event)\n    \n    #user name; please note that this may differ based on the structure of your IAM user\n    userName = event&#91;'detail']&#91;'userIdentity']&#91;'sessionContext']&#91;'sessionIssuer']&#91;'userName']\n    \n    #instance id\n    instanceId = event&#91;'detail']&#91;'responseElements']&#91;'instancesSet']&#91;'items']&#91;0]&#91;'instanceId']\n    \n    try:\n        ec2.create_tags(\n            Resources=&#91;\n                instanceId,\n            ],\n            Tags=&#91;\n                {\n                    'Key': 'CreatedBy',\n                    'Value': userName\n                },\n            ]\n        )\n        print(\"completed executing tagEC2 lambda function\")\n    except Exception as e:\n        print(e)\n        raise e\n    \n    return<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 2: Upload the file to a S3 bucket<\/h3>\n\n\n\n<p class=\"\">To upload the newly created Lambda function to the S3 bucket, first convert it to a zip file as follows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>zip maghilda_tagResourceCreation.zip maghilda_tagResourceCreation.py<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 3: Create the VPC stack<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>AWSTemplateFormatVersion: 2010-09-09\nDescription: Set up VPC template for test environment with one public subnet in one availabily zone. \n\nParameters:\n  EnvironmentName:\n    Description: An environment name that is prefixed to resource names\n    Type: String\n    Default: test\n\n  VpcCIDR:\n    Description: Please enter the IP range (CIDR notation) for this VPC\n    Type: String\n    Default: 10.0.0.0\/16\n\n  PublicSubnetCIDR:\n    Description: Please enter the IP range (CIDR notation) for the public subnet in the one Availability Zone\n    Type: String\n    Default: 10.0.10.0\/24\n\nResources:\n  VPC:\n    Type: AWS::EC2::VPC\n    Properties:\n      CidrBlock: !Ref VpcCIDR\n      EnableDnsSupport: true\n      EnableDnsHostnames: true\n      Tags:\n        - Key: Name\n          Value: !Ref EnvironmentName\n\n  InternetGateway:\n    Type: AWS::EC2::InternetGateway\n    Properties:\n      Tags:\n        - Key: Name\n          Value: !Ref EnvironmentName\n\n  InternetGatewayAttachment:\n    Type: AWS::EC2::VPCGatewayAttachment\n    Properties:\n      InternetGatewayId: !Ref InternetGateway\n      VpcId: !Ref VPC\n\n  PublicSubnet:\n    Type: AWS::EC2::Subnet\n    Properties:\n      VpcId: !Ref VPC\n      AvailabilityZone: !Select &#91; 0, !GetAZs '' ]\n      CidrBlock: !Ref PublicSubnetCIDR\n      MapPublicIpOnLaunch: true\n      Tags:\n        - Key: Name\n          Value: !Sub ${EnvironmentName} Public Subnet (AZ)\n\n  PublicRouteTable:\n    Type: AWS::EC2::RouteTable\n    Properties:\n      VpcId: !Ref VPC\n      Tags:\n        - Key: Name\n          Value: !Sub ${EnvironmentName} Public Routes\n\n  DefaultPublicRoute:\n    Type: AWS::EC2::Route\n    DependsOn: InternetGatewayAttachment\n    Properties:\n      RouteTableId: !Ref PublicRouteTable\n      DestinationCidrBlock: 0.0.0.0\/0\n      GatewayId: !Ref InternetGateway\n\n  PublicSubnetRouteTableAssociation:\n    Type: AWS::EC2::SubnetRouteTableAssociation\n    Properties:\n      RouteTableId: !Ref PublicRouteTable\n      SubnetId: !Ref PublicSubnet\n\n  NoIngressSecurityGroup:\n    Type: AWS::EC2::SecurityGroup\n    Properties:\n      GroupName: \"no-ingress-sg\"\n      GroupDescription: \"Security group with no ingress rule\"\n      VpcId: !Ref VPC\n\nOutputs:\n  VPC:\n    Description: A reference to the created VPC\n    Value: !Ref VPC\n\n  PublicSubnet:\n    Description: A reference to the public subnet in the Availability Zone\n    Value: !Ref PublicSubnet\n\n  NoIngressSecurityGroup:\n    Description: Security group with no ingress rule\n    Value: !Ref NoIngressSecurityGroup<\/code><\/pre>\n\n\n\n<p class=\"\">Deploy the stack via the AWS CLI<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation create-stack --stack-name testvpc --template-body file:\/\/vpc-template.yml<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 4: Create the CloudTrail stack<\/h3>\n\n\n\n<p class=\"\">EventBridge requires CloudTrail Trail to exist as it uses the CloudTrail API.&nbsp;To set up CloudTrail trail with S3, please review my post&nbsp;<a href=\"https:\/\/www.maghilda.com\/howto-build-cloudtrail-trail-with-cloudformation-template-for-easy-builds-and-tear-down\/\">here<\/a>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 5: Create the Lambda deployment and EventBridge rules stack<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>AWSTemplateFormatVersion: 2010-09-09\nDescription: Set up EventBridge Trigger and Lambda function to tag EC2 resources \n    \nResources:\n  # BEGIN MANAGED POLICY \n  ManagedPolicy:\n    Type: AWS::IAM::ManagedPolicy\n    Properties:\n      PolicyDocument: \n        Version: '2012-10-17'\n        Statement:\n          - Sid: CloudWatchLogs #similar to AWSLambdaBasicExecutionRole\n            Effect: Allow\n            Action:\n              - logs:PutLogEvents\n              - logs:CreateLogGroup\n              - logs:CreateLogStream\n            Resource: \"arn:aws:logs:*:*:*\"\n          - Sid: CreateTags\n            Effect: Allow\n            Action: ec2:CreateTags\n            Resource: \"*\" \n\n  # BEGIN LAMBDA IAM RESOURCES\n  EventBridgeLambdaRole:\n    Type: 'AWS::IAM::Role'\n    Properties:\n      AssumeRolePolicyDocument:\n        Version: '2012-10-17'\n        Statement:\n          - Effect: Allow\n            Principal:\n              Service:\n                - lambda.amazonaws.com\n            Action:\n              - 'sts:AssumeRole'\n      ManagedPolicyArns:\n          - !Ref ManagedPolicy\n  \n  # Deploy Lambda function\n  myLambdaFunction:\n    Type: AWS::Lambda::Function\n    Properties:\n      Runtime: python3.11\n      FunctionName: maghilda_tagResourceCreation\n      Role: !GetAtt EventBridgeLambdaRole.Arn\n      Handler: maghilda_tagResourceCreation.lambda_handler #filename.handler\n      Code:\n        S3Bucket: m-lambdafunctions  #s3 bucket name\n        S3Key: maghilda_tagResourceCreation.zip   #file uploaded to the s3 bucket\n      Description: tagEC2 lambda function\n      TracingConfig:\n        Mode: Active\n\n  #Provide Lambda permissions to execute Events\n  LambdaPerms:\n      Type: AWS::Lambda::Permission\n      Properties:\n        Action: 'lambda:InvokeFunction'\n        FunctionName: !Ref myLambdaFunction\n        Principal: events.amazonaws.com \n        SourceAccount: !Ref AWS::AccountId  \n        SourceArn: !GetAtt EventBridgeTrigger.Arn\n\n  #Set up EventBridge Rule\n  EventBridgeTrigger:\n      Type: AWS::Events::Rule\n      Properties:\n        Description: 'EventTrigger on EC2'\n        State: 'ENABLED_WITH_ALL_CLOUDTRAIL_MANAGEMENT_EVENTS'\n        EventPattern: \n          source:\n            - 'aws.ec2'\n          detail-type:\n            - 'AWS API Call via CloudTrail'\n          detail: #the service generating the event determines the content of this field.\n            eventSource: \n              - 'ec2.amazonaws.com'\n            eventName: \n              - 'RunInstances'\n        Targets:\n          - Arn: !GetAtt myLambdaFunction.Arn\n            Id: 'LambdaFunction'\n\nOutputs :\n  LambdaFunctionName:\n    Value: !Ref myLambdaFunction\n\n  LambdaRoleArn:\n    Value: !GetAtt EventBridgeLambdaRole.Arn\n\n  EventRuleArn:\n    Value: !GetAtt EventBridgeTrigger.Arn<\/code><\/pre>\n\n\n\n<p class=\"\">Deploy the stack via the AWS CLI<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation create-stack --stack-name testlambda&nbsp; --capabilities CAPABILITY_NAMED_IAM --template-body file:\/\/TagEC2Lambda-template.yml<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Step 6: Create EC2 stack<\/h3>\n\n\n\n<pre class=\"wp-block-code\"><code>AWSTemplateFormatVersion: 2010-09-09\nDescription: Create EC2 instance. The security group allows only SSH traffic \n\nParameters:\n  InstanceType:\n    Description: Instance Type to use\n    Type: String\n    Default: t2.micro\n  AMI:\n    Description: AMI to use; Amazon Linux 2023 AMI\n    Type: String\n    Default: 'ami-0e731c8a588258d0d'\n  Key:\n    Description: Name of an existing EC2 KeyPair to enable SSH access to the instance\n    Type: AWS::EC2::KeyPair::KeyName\n    Default: 'app-key-pair' #change to use your key-pair name\n  SSHLocation:\n    Description: The IP address range that can be used to SSH to the EC2 instances\n    Type: String\n    Default: 18.206.107.24\/29 #using EC2 Instance Connect IP address range to connect to an instance\n  VPC:\n    Description: The ID of the VPC for the security group\n    Type: String\n    Default: 'vpc-0ac7ad98b5f0b664b' \n  SubnetID:\n    Description: The ID of the subnet to launch the instance into.\n    Type: String\n    Default: 'subnet-0f7be13cfe8e7f030' \n\n\nResources:\n  MyEC2Instance: \n    Type: AWS::EC2::Instance\n    Properties: \n      ImageId: !Ref AMI\n      KeyName: !Ref Key\n      InstanceType: !Ref InstanceType\n      NetworkInterfaces: \n        - AssociatePublicIpAddress: \"true\"\n          DeviceIndex: \"0\"\n          GroupSet: &#91;!Ref SSHSecurityGroup]\n          SubnetId: !Ref SubnetID\n\n  SSHSecurityGroup:\n    Type: AWS::EC2::SecurityGroup\n    Properties:\n      GroupName: \"ssh-ingress-sg\"\n      GroupDescription: \"Enable SSH access via port 22\"\n      SecurityGroupIngress:\n        - IpProtocol: tcp\n          FromPort: 22\n          ToPort: 22\n          CidrIp: !Ref SSHLocation   \n      VpcId: !Ref VPC\n\nOutputs:\n  InstanceID:\n    Description: InstanceId of the newly created EC2 instance\n    Value: !Ref MyEC2Instance\n  AZ:\n    Description: Availability Zone of the newly created EC2 instance\n    Value: !GetAtt &#91;MyEC2Instance, AvailabilityZone]\n  PublicDNS:\n    Description: Public DNSName of the newly created EC2 instance\n    Value: !GetAtt &#91;MyEC2Instance, PublicDnsName]\n  PublicIP:\n    Description: Public IP address of the newly created EC2 instance\n    Value: !GetAtt &#91;MyEC2Instance, PublicIp]\n  SSHSecurityGroup:\n    Description: Security group with SSH access only\n    Value: !Ref SSHSecurityGroup<\/code><\/pre>\n\n\n\n<p class=\"\">Deploy the stack via the AWS CLI<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation create-stack --stack-name testEC2 --template-body file:\/\/EC2-template.yml<\/code><\/pre>\n\n\n\n<p class=\"\">You should have the four CloudFormation Stacks on CloudFormation as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img fetchpriority=\"high\" decoding=\"async\" width=\"1024\" height=\"585\" src=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM-1024x585.png\" alt=\"\" class=\"wp-image-2668\" srcset=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM-1024x585.png 1024w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM-300x171.png 300w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM-768x439.png 768w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM.png 1133w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step 7: Validate the tags on the EC2 instances&nbsp;<\/h3>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"903\" height=\"311\" src=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.04.32-PM.png\" alt=\"\" class=\"wp-image-2669\" srcset=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.04.32-PM.png 903w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.04.32-PM-300x103.png 300w, https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.04.32-PM-768x265.png 768w\" sizes=\"(max-width: 903px) 100vw, 903px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Step 8: Clean up resources. Delete all the stacks above<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Delete Lambda function deployment and EventBridge Rules<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation delete-stack --stack-name testlambda<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Delete the EC2 instances&nbsp;<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation delete-stack --stack-name testEC2<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Delete the VPC and associated subnet and security groups<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation delete-stack --stack-name testvpc<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Delete the CloudTrail trail<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>aws cloudformation delete-stack --stack-name testcreatetrail<\/code><\/pre>\n\n\n\n<p class=\"\">This is the end of the tutorial. Hope it was helpful to you.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">References<\/h3>\n\n\n\n<ul style=\"margin-right:var(--wp--preset--spacing--50);margin-left:var(--wp--preset--spacing--50)\" class=\"wp-block-list\">\n<li class=\"\"><a href=\"https:\/\/docs.aws.amazon.com\/codebuild\/latest\/userguide\/cloudformation-vpc-template.html\">https:\/\/docs.aws.amazon.com\/codebuild\/latest\/userguide\/cloudformation-vpc-template.html<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/intrinsic-function-reference-getavailabilityzones.html\">https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/intrinsic-function-reference-getavailabilityzones.html<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/quickref-ec2-sg.html\">https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/quickref-ec2-sg.html<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/ec2-instance-connect-prerequisites.html\">https:\/\/docs.aws.amazon.com\/AWSEC2\/latest\/UserGuide\/ec2-instance-connect-prerequisites.html<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/docs.aws.amazon.com\/vpc\/latest\/userguide\/aws-ip-ranges.html\">https:\/\/docs.aws.amazon.com\/vpc\/latest\/userguide\/aws-ip-ranges.html<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/ip-ranges.amazonaws.com\/ip-ranges.json\">https:\/\/ip-ranges.amazonaws.com\/ip-ranges.json<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/github.com\/awslabs\/aws-cloudformation-templates\/blob\/master\/aws\/services\/EC2\/EC2InstanceWithSecurityGroupSample.yaml\">https:\/\/github.com\/awslabs\/aws-cloudformation-templates\/blob\/master\/aws\/services\/EC2\/EC2InstanceWithSecurityGroupSample.yaml<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/docs.aws.amazon.com\/eventbridge\/latest\/userguide\/eb-events.html\">https:\/\/docs.aws.amazon.com\/eventbridge\/latest\/userguide\/eb-events.html<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-resource-events-rule.html\">https:\/\/docs.aws.amazon.com\/AWSCloudFormation\/latest\/UserGuide\/aws-resource-events-rule.html<\/a><\/li>\n\n\n\n<li class=\"\"><a href=\"https:\/\/docs.aws.amazon.com\/eventbridge\/latest\/userguide\/eb-events-structure.html\">https:\/\/docs.aws.amazon.com\/eventbridge\/latest\/userguide\/eb-events-structure.html<\/a><\/li>\n<\/ul>\n\n\n\n<p class=\"\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, we will automate the tagging of new EC2 instances using CloudFormation templates. In the previous tutorial, we learnt how to tag AWS EC2 instances when they are created. We created an event rule in EventBridge to trigger a Lambda function to tag new EC2 instances with the name of the user that [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"nf_dc_page":"","_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[12,41,54,70,24,30,63],"tags":[],"class_list":["post-2657","post","type-post","status-publish","format-standard","hentry","category-aws-tutorial","category-cloudformation","category-cloudtrail","category-eventbridge","category-lambda","category-python","category-vpc"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail - maghilda<\/title>\n<meta name=\"description\" content=\"Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail - maghilda\" \/>\n<meta property=\"og:description\" content=\"Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/\" \/>\n<meta property=\"og:site_name\" content=\"maghilda\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-26T21:09:53+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-26T21:23:25+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM-1024x585.png\" \/>\n<meta name=\"author\" content=\"vibs\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"vibs\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/\"},\"author\":{\"name\":\"vibs\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/person\\\/21009c5e4f1817ea18c81d5004bcec1e\"},\"headline\":\"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail\",\"datePublished\":\"2024-02-26T21:09:53+00:00\",\"dateModified\":\"2024-02-26T21:23:25+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/\"},\"wordCount\":452,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/Screen-Shot-2024-02-26-at-4.02.47-PM-1024x585.png\",\"articleSection\":[\"AWS Tutorial\",\"CloudFormation\",\"CloudTrail\",\"EventBridge\",\"Lambda\",\"Python\",\"VPC\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/\",\"name\":\"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail - maghilda\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/Screen-Shot-2024-02-26-at-4.02.47-PM-1024x585.png\",\"datePublished\":\"2024-02-26T21:09:53+00:00\",\"dateModified\":\"2024-02-26T21:23:25+00:00\",\"description\":\"Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/Screen-Shot-2024-02-26-at-4.02.47-PM.png\",\"contentUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/Screen-Shot-2024-02-26-at-4.02.47-PM.png\",\"width\":1133,\"height\":647},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#website\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\",\"name\":\"maghilda.com\",\"description\":\"Technology blog focused on cloud computing, emerging technologies, software development and security.\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#organization\",\"name\":\"maghilda.com\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-logo_red.png\",\"contentUrl\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/wp-content\\\/uploads\\\/2023\\\/12\\\/cropped-logo_red.png\",\"width\":512,\"height\":512,\"caption\":\"maghilda.com\"},\"image\":{\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/#\\\/schema\\\/person\\\/21009c5e4f1817ea18c81d5004bcec1e\",\"name\":\"vibs\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g\",\"caption\":\"vibs\"},\"sameAs\":[\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\"],\"url\":\"https:\\\/\\\/www.maghilda.com\\\/staging\\\/9669\\\/author\\\/obliczte\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail - maghilda","description":"Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/","og_locale":"en_US","og_type":"article","og_title":"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail - maghilda","og_description":"Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail","og_url":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/","og_site_name":"maghilda","article_published_time":"2024-02-26T21:09:53+00:00","article_modified_time":"2024-02-26T21:23:25+00:00","og_image":[{"url":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM-1024x585.png","type":"","width":"","height":""}],"author":"vibs","twitter_card":"summary_large_image","twitter_misc":{"Written by":"vibs","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/#article","isPartOf":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/"},"author":{"name":"vibs","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/person\/21009c5e4f1817ea18c81d5004bcec1e"},"headline":"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail","datePublished":"2024-02-26T21:09:53+00:00","dateModified":"2024-02-26T21:23:25+00:00","mainEntityOfPage":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/"},"wordCount":452,"commentCount":0,"publisher":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization"},"image":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/#primaryimage"},"thumbnailUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM-1024x585.png","articleSection":["AWS Tutorial","CloudFormation","CloudTrail","EventBridge","Lambda","Python","VPC"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/","url":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/","name":"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail - maghilda","isPartOf":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/#primaryimage"},"image":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/#primaryimage"},"thumbnailUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM-1024x585.png","datePublished":"2024-02-26T21:09:53+00:00","dateModified":"2024-02-26T21:23:25+00:00","description":"Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail","breadcrumb":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/#primaryimage","url":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM.png","contentUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2024\/02\/Screen-Shot-2024-02-26-at-4.02.47-PM.png","width":1133,"height":647},{"@type":"BreadcrumbList","@id":"https:\/\/www.maghilda.com\/staging\/9669\/howto-use-cloudformation-to-tag-new-ec2-instances-with-lambda-function-eventbridge-vpc-and-cloudtrail\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.maghilda.com\/staging\/9669\/"},{"@type":"ListItem","position":2,"name":"HOWTO: Use CloudFormation to tag new EC2 instances with Lambda function, EventBridge, VPC and CloudTrail"}]},{"@type":"WebSite","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#website","url":"https:\/\/www.maghilda.com\/staging\/9669\/","name":"maghilda.com","description":"Technology blog focused on cloud computing, emerging technologies, software development and security.","publisher":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.maghilda.com\/staging\/9669\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#organization","name":"maghilda.com","url":"https:\/\/www.maghilda.com\/staging\/9669\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/logo\/image\/","url":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2023\/12\/cropped-logo_red.png","contentUrl":"https:\/\/www.maghilda.com\/staging\/9669\/wp-content\/uploads\/2023\/12\/cropped-logo_red.png","width":512,"height":512,"caption":"maghilda.com"},"image":{"@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.maghilda.com\/staging\/9669\/#\/schema\/person\/21009c5e4f1817ea18c81d5004bcec1e","name":"vibs","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/28233c799bf0736fecb2854057b69e52d9bd97b467b55be3406890936003faee?s=96&d=mm&r=g","caption":"vibs"},"sameAs":["https:\/\/www.maghilda.com\/staging\/9669"],"url":"https:\/\/www.maghilda.com\/staging\/9669\/author\/obliczte\/"}]}},"_links":{"self":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/comments?post=2657"}],"version-history":[{"count":5,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2657\/revisions"}],"predecessor-version":[{"id":2677,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/posts\/2657\/revisions\/2677"}],"wp:attachment":[{"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/media?parent=2657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/categories?post=2657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.maghilda.com\/staging\/9669\/wp-json\/wp\/v2\/tags?post=2657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}