Encrypt and Decrypt AWS Lambda Function Environment Variables using AWS KMS

Publicado el: 06 octubre 2021
en el canal de: Knowledge Amplifier
6,189
67

Secrets are meant to be... well, secret.
We can not to expose important secure keys (like database passwords) to the outside world.
As such, hardcoding passwords inside of your source code is a terrible idea.
Luckily, with AWS Lambda we can avoid that - we're going to learn how we can use environment variables in order to pass in a password to a lambda function without potentially exposing it to the world.
Moreover using KMS , we can encrypt the environment variables & make the system more secured.

In this video , I have explained the basic concept of KMS , and how to use this to encrypt and decrypt secured credentials.


Prerequisite:
Extract data from an API Python , Talend
   • Extract data from an API Python , Talend  


Base Code:

import boto3
import requests
import json

def lambda_handler(event, context):
city_name=
api_key=
url="http://api.openweathermap.org/data/2...."+city_name+"&appid="+api_key+"&units=metric"
print("URL for API: ",url)
result=requests.get(url)
data_extracted=result.json()
temp_city=data_extracted['main']['temp']
message="The temperature of {} city : ".format(city_name)
print(message,temp_city)

Check this playlist for more AWS Projects in Big Data domain:
   • Demystifying Data Engineering with Cloud C...  


En esta página del sitio puede ver el video en línea Encrypt and Decrypt AWS Lambda Function Environment Variables using AWS KMS de Duración hora minuto segunda en buena calidad , que subió el usuario Knowledge Amplifier 06 octubre 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 6,189 veces y le gustó 67 a los espectadores. Disfruta viendo!