|
|
@ -53,6 +53,15 @@ s3Resource = boto3.resource('s3', endpoint_url=endpoint_url) |
|
|
|
lClient = boto3.client('lambda', endpoint_url=endpoint_url) |
|
|
|
apiClient = boto3.client("apigatewayv2", endpoint_url=endpoint_url) |
|
|
|
|
|
|
|
print("Deleting old API gateway...") |
|
|
|
print("------------------------------------") |
|
|
|
response = apiClient.get_apis() |
|
|
|
for api in response["Items"]: |
|
|
|
if api["Name"] == functionName + '-api': |
|
|
|
responseDelete = apiClient.delete_api( |
|
|
|
ApiId=api["ApiId"] |
|
|
|
) |
|
|
|
|
|
|
|
print("Deleting old function...") |
|
|
|
print("------------------------------------") |
|
|
|
try: |
|
|
@ -130,17 +139,14 @@ print("Lambda Function and S3 Bucket to store the counter are available. Sadly, |
|
|
|
# |
|
|
|
# https://348yxdily0.execute-api.eu-central-1.amazonaws.com/default/cloudcomp-counter-demo |
|
|
|
|
|
|
|
# print("creating API gateway...") |
|
|
|
# print("------------------------------------") |
|
|
|
# |
|
|
|
# #apiArn = "" |
|
|
|
# response = apiClient.create_api( |
|
|
|
# Name=functionName + '-api', |
|
|
|
# ProtocolType='HTTP', |
|
|
|
# Target=lambdaFunctionARN |
|
|
|
# ) |
|
|
|
# #apiArn=response[''] |
|
|
|
# |
|
|
|
# #response = lClient.create_event_source_mapping( |
|
|
|
# # EventSourceArn=apiArn, |
|
|
|
# #) |
|
|
|
print("creating API gateway...") |
|
|
|
print("------------------------------------") |
|
|
|
|
|
|
|
response = apiClient.create_api( |
|
|
|
Name=functionName + '-api', |
|
|
|
ProtocolType='HTTP', |
|
|
|
Target=lambdaFunctionARN |
|
|
|
) |
|
|
|
apiArn=response |
|
|
|
|
|
|
|
print("API Endpoint can be reached at: http://" + apiArn["ApiEndpoint"]) |