AWS-SDK IoT create things using GitHub workflow dispatcher
In my recent exploration of AWS IoT, I aimed to streamline the process of creating IoT things with attached certificates automatically, eliminating the need for state management tools like Terraform. Amidst various options available, I discovered the efficacy of the AWS SDK in simplifying this task. Here’s a step-by-step solution on how to effortlessly create AWS IoT things using the GitHub workflow dispatcher.
1. Create an IoT Policy:
- Navigate to AWS IoT, then the Security section.
- Generate a new policy that aligns with your security requirements.
2. Set Up a Versioned Bucket:
- Create an S3 bucket with versioning enabled.
- Ensure your GitHub OIDC (OpenID Connect) has full access to the bucket, allowing seamless saving of certificates, public, and private keys.
Now, let’s delve into the code to automate this process. The following example utilizes the AWS-SDK for a smooth integration with GitHub workflow dispatcher.
This code snippet will guide you through the necessary steps, leveraging GitHub Actions for automation. Ensure to customize it based on your specific IoT policy and S3 bucket configurations. Here, replace the storage bucket name and policy name at line #16 and #36.
By implementing this solution, you can effortlessly create AWS IoT things while maintaining security through policies and utilizing versioned buckets for secure key storage. The seamless integration with GitHub workflow dispatcher enhances automation, making the entire process efficient and easily reproducible.
Lets create a workflow file inside .github/workflows/ folder named deployment.yaml
Once, you are done with both. now go to Actions and select action “Create IoT things”. Provide the thing name and Run the workflow.

the script will be executed and it will create things on AWS IoT and save the cert and key files to s3 bucket with things and date.
For more help refer to repo: https://github.com/infinitonubo/aws-iot-things