Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
mkdir lambda_com_pacotes && cd lambda_com_pacotes
#criando o arquivo
echo -e "
import requests
def handle(event, context):
r = requests.get('')
return {
'texto': r.text,
" >>
#criando o requirements.txt
echo -e "requests" >> requirements.txt
#instalando as dependencias para o lambda
pip install -r requirements.txt -t .
# zipando
zip -qr .
# criar a nossa função via awscli.
aws lambda create-function \
--region us-east-1 \
--handler main.handle \
--runtime python3.7 \
--function-name 'hellorequests' \
--zip-file fileb://./ \
--role 'PEGUE_SUA_ARN'
aws lambda invoke \
--region us-east-1 \
--function-name 'hellorequests' \
--payload '{}' \
cat hellorequests.output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.