Author: Henry

How do I find IoT certs status?

I want to know how many certificates I have in my AWS IoT and how many certificates are attached onto any things or not. import boto3, timefrom concurrent.futures import ThreadPoolExecutor client =boto3.client(“iot”) results = []attached = []non_attached = [] paginator = client.get_paginator(‘list_certificates’)page_iterator = paginator.paginate()for page in page_iterator:results.extend(page[‘certificates’])print(“Total certificates scanned are: “, len(results)) start_time = time.time()def check_certificates(certificate):principal = client.list_principal_things(principal=certificate[“certificateArn”])# print(“%s –…

Read More »

SNS: Error code: InvalidParameter – Error message: Invalid parameter: SubscriptionArn Reason: An ARN must have at least 6 elements, not 1

I accidentally unsubscribed an SNS topic. When I am trying to delete this subscription, I got below error: Couldn’t delete subscription.Error code: InvalidParameter – Error message: Invalid parameter: SubscriptionArn Reason: An ARN must have at least 6 elements, not 1 To recover this subscription, I executed below CLI command: aws sns subscribe –topic-arn <SNS_TOPIC_ARN> –protocol email –notification-endpoint <EMAIL_ID> –region <AWS_REGION>…

Read More »

How do I test CORS for HTTP API?

AWS says “If you configure CORS for a HTTP API, API Gateway automatically sends a response to preflight OPTIONS requests, even if there isn’t an OPTIONS route configured for your API. For a CORS request, API Gateway adds the configured CORS headers to the response from an integration.” However, After I did some tests in my account, I noticed HTTP…

Read More »