Skip to content

Instantly share code, notes, and snippets.

View heitorlessa's full-sized avatar

Heitor Lessa heitorlessa

View GitHub Profile
@heitorlessa
heitorlessa / app.py
Last active April 16, 2024 15:10
Discord Powertools for AWS Lambda - Parsing EventBridge ECS Task State Change event
from __future__ import annotations
from typing import List, Optional
from aws_lambda_powertools.utilities.parser.models import EventBridgeModel
from aws_lambda_powertools.utilities.parser.envelopes import (
EventBridgeEnvelope, # only if you want to discard EventBridge metadata
)
from aws_lambda_powertools.utilities.parser.parser import event_parser
from pydantic import BaseModel
@heitorlessa
heitorlessa / readme.md
Last active November 13, 2023 14:07
AWS Community Day 2023 - Construindo estradas e pontes links

Todos os links que estavam na apresentação

@heitorlessa
heitorlessa / readme.md
Created October 30, 2023 21:28
senak peek

image

@heitorlessa
heitorlessa / app.md
Last active July 5, 2023 14:30
Sample LLM prompt for Mermaid sequence

There are three participants: Client, Server, Database.

First scenario

  • Client makes a GET /products request to the Server
  • Server verifies whether Client is authorized to make this request
  • Server confirms Client is authorized and makes a request to the Database to fetch all products
  • Database returns 100 products to the Server, along with a pagination token to retrieve 100 more tiems
  • Create a loop between Server and Database, where Server fetches 100 more products with the pagination token provided by Database until there are no more products to be fetched
  • Server returns response to the Client
@heitorlessa
heitorlessa / app.py
Created April 3, 2023 14:16
BaseProvider sample
class CustomTracerProvider(BaseProvider):
def start_segment(self):
"""This method is proposed as a solution as it exists for other providers
This method is responsible for starting the trace. This might involve initializing some data structures,
connecting to an external service, or performing some other setup work"""
def end_segment(self):
"""This method is proposed as a solution as it exists for other providers.
This method is responsible for ending the trace. This might involve finalizing data structures,
sending data to an external service, or performing some other cleanup work"""
@heitorlessa
heitorlessa / template.yaml
Last active December 19, 2021 10:25
SAM support for new SQS, Kinesis, and DynamoDB Partial Response feature (ReportBatchItemFailures)
AWSTemplateFormatVersion: '2010-09-09'
Transform: AWS::Serverless-2016-10-31
Description: partial batch response sample
Globals:
Function:
Timeout: 5
MemorySize: 256
Runtime: python3.8
Tracing: Active
@heitorlessa
heitorlessa / hello_universe.asl.json
Created October 13, 2021 10:50
Step Functions SDK Integration - Nested Sync Express Workflow
{
"StartAt": "Sit and wait",
"States": {
"Sit and wait": {
"Type": "Wait",
"Seconds": 1,
"Next": "Dummy Output"
},
"Dummy Output": {
"Type": "Pass",
@heitorlessa
heitorlessa / README.md
Last active March 7, 2023 09:36
Open@Amazon Session notes
@heitorlessa
heitorlessa / READE.md
Last active July 3, 2022 23:59
powertools_issue_409

Export custom flag PT_409 when running locally to log in plain text and write output into log.txt file

PT_409="1" python prod.py 

Output should look like this:

2021-05-13 19:05:25,506+0200 — INFO — main:32 — Hello - {'context': {'device_id': '11e9034354f', 'device_location': 'London'}} - -