AWS cost saving on EC2 by schedule stop and start and update Cloudflare DNS by lambda

curl -X GET "https://api.cloudflare.com/client/v4/user/tokens/verify" \
-H "Authorization: Bearer <your_api_token>" \
-H "Content-Type:application/json"
{"result":{"id":"xxxxx","status":"active"},"success":true,"errors":[],"messages":[{"code":10000,"message":"This API Token is valid and active","type":null}]}%
curl --location --request GET 'https://api.cloudflare.com/client/v4/zones' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer <your_api_token>'
curl --location --request GET 'https://api.cloudflare.com/client/v4/zones/<your_zone_id>/dns_records' \
--header 'Content-Type: application/json' \
--header 'X-Auth-Email: <xxx@your_email.com>' \
--header 'Authorization: Bearer <your_api_token>' \
PUT zones/:zone_identifier/dns_records/:identifier
curl — location — request PUT ‘https://api.cloudflare.com/client/v4/zones/<zone_identifier>/dns_records/<dns_records>' \
— header ‘Content-Type: application/json’ \
— header ‘X-Auth-Email: <xxx@your_email.com>’ \
— header ‘Authorization: Bearer <your_api_token>’ \
— data-raw ‘{
“type”: “A”,
“name”: “<your DNS Name>”,
“content”: “<IP Address you want to change>”,
“ttl”: 1,
“proxiable”: true,
“proxied”: false
}

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Top 3 Coding Tutorials of the Week

Sigstore Project Update — May 2021

Hey ‘Canners, we’ve made it to 25 #ToucanTuesday articles 🎆 This week the article will be a…

Animating Sprites in Unity

Complete Java: Learn Java 8 core development

UENC Announcement

Create High Availability Architecture with AWS CLI.

Linux Basic Commands

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Kingyinma

Kingyinma

More from Medium

Where are Africa’s Clean Energy Projects?

How to Live in the Present while Learning From the Past & Planning for the Future

Chibi’s Guide to Minecraft: Potions Chapter 2. Bottle Morphing

Otto Nägeli — An Appreciation