Skip to content

Instantly share code, notes, and snippets.

@atheiman
Created August 14, 2020 06:21
Show Gist options
  • Save atheiman/b312ed95c00333483e34864eecf0ee7d to your computer and use it in GitHub Desktop.
Save atheiman/b312ed95c00333483e34864eecf0ee7d to your computer and use it in GitHub Desktop.
Delete SQS message after processing in a Lambda function using Python Boto3
def delete_message(message):
q_region, q_acct_id, q_name = message['eventSourceARN'].split(':')[3:6]
sqs = boto3.client('sqs', region_name=q_region)
q_url = f'https://{q_region}.queue.amazonaws.com/{q_acct_id}/{q_name}'
sqs.delete_message(QueueUrl=q_url, ReceiptHandle=message['receiptHandle'])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment