This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import matplotlib.pyplot as plt | |
try: | |
data_df = pd.read_csv("raw_data.csv") | |
col_name = data_df.columns[0] | |
data = data_df[col_name] | |
plt.plot(data, label=col_name) | |
plt.legend(loc="upper left") | |
plt.savefig('offline_plot.png') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import urllib.parse | |
import boto3 | |
from io import StringIO, BytesIO | |
import pandas as pd | |
import numpy as np | |
import matplotlib.pyplot as plt | |
print('Loading function') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#%% | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import random | |
import plotly.graph_objects as go | |
from plotly.subplots import make_subplots | |
#%% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
# replace the keys below | |
dynamodb = boto3.client( | |
'dynamodb', | |
aws_access_key_id='*****', | |
aws_secret_access_key='*****', | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######## Create a Sample Lambda Function URL and the necessary dependencies ######## | |
import boto3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Create Hello Lambda .py ### | |
lambda_code = ''' | |
import json | |
def lambda_handler(event, context): | |
# TODO implement | |
return { | |
'statusCode': 200, | |
'body': json.dumps('Hello from Lambda!') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Create Trust Policy for IAM Role | |
import json | |
trust_policy = json.dumps({ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Principal": { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Create Lambda Function | |
client_lambda = boto3.client('lambda') | |
f = open('lambda-handler.zip', 'rb') | |
lambda_handler_zip = f.read() | |
f.close() | |
response_create_function = client_lambda.create_function( | |
FunctionName='test_Lambda_Function_URLs_boto3', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Create Lambda Function URL | |
client_lambda = boto3.client('lambda') | |
response_create_function_url_config = client_lambda.create_function_url_config( | |
FunctionName='test_Lambda_Function_URLs_boto3', | |
AuthType='NONE' | |
) | |
function_URL = response_create_function_url_config['FunctionUrl'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
import os | |
import zipfile | |
import boto3 | |
s3 = boto3.client('s3') | |
aws_lambda = boto3.client('lambda') | |
s3_bucket_name = 'zali-catch-all' | |
library = 'pandas' |
OlderNewer