Skip to content

Instantly share code, notes, and snippets.

lambda function
----
exports.handler = async (event) => {
console.log(event)
const customerId = event.pathParameters.customerId;
const customer = {'customerId': customerId, 'customerName': "Customer " + customerId };
const response = {
statusCode: 200,
// Uncomment below to enable CORS requests
headers: {
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadGetObject",
"Effect": "Allow",
"Principal": "*",
"Action": [
"s3:GetObject"
],
import boto3
import json
bedrock = boto3.client(
service_name='bedrock-runtime',
region_name='us-east-1'
)
input = {
DemoHandler
---
def lambda_handler(event, context):
print(event)
return "hello, world!!"
DemoAuthorizer
---
import json
import boto3
firehose_client = boto3.client('firehose')
def lambda_handler(event, context):
resultString = ""
for record in event['Records']:
Connect & Disconnect
---
import json
def lambda_handler(event, context):
print(event)
print("****")
print(context)
Steps (First Time Setup)
Start Docker
Configure Docker to allow file sharing
Run Get-NetIPAddress in Powershell and find your IP
Run the following command in Powershell with your ip/path selected:
docker run --name ubuntu-devevelopment -e HOST_IP=192.168.0.110 --expose 3000 -p 3000:3000 -v //c/Users/Dan/Desktop:/src -t -i tecnickcom/alldev /bin/bash
Steps (Every time after)
Start your container
IAM Policies
---
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": "secretsmanager:GetSecretValue",
"Resource": "*"
{
"Comment": "A description of my state machine",
"StartAt": "Add Order Entry",
"States": {
"Add Order Entry": {
"Type": "Task",
"Resource": "arn:aws:states:::dynamodb:putItem",
"Parameters": {
"TableName": "CustomerOrdersTable",
"Item": {
# aws s3api get-object --bucket arn:aws:s3-object-lambda:us-east-1:xxxxx:accesspoint/just-purchases --key orders.json transformed_data.json
import boto3
import urllib3
import json
http = urllib3.PoolManager()
def lambda_handler(event, context):
print(event)