🤖 My Engineered Solution

for easy distribution later.

  • The AWS Lambda function’s [execution

role](https://docs.aws.amazon.com/lambda/latest/dg/intro-permission-model.html#lambda-intro-execution-role) should have the following permissions:

  • The _Instance State_ change should be a [CloudWatch Event

trigger](https://docs.aws.amazon.com/AmazonCloudWatch/latest/events/Create-CloudWatch-Events-Rule.html) in the function.

  • The function should be universally adoptable. It should make the following variables available to the Python script as

Environment Variables:

  • EC2_INSTANCE_NAME
  • CLOUDFLARE_EMAIL
  • CLOUDFLARE_API_KEY
  • CLOUDFLARE_A_NAME
  • CLOUDFLARE_DNS_ID
  • CLOUDFLARE_ZONE_ID

retrieve the public IPv4 address assigned.

DNS & Zone given using the E-Mail and API Key provided for authentication to do so. Updating it to the previously retrieved public IPv4 address.