Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update template.yml and package.py for platform.al2023 runtime #42

Merged
merged 9 commits into from
Mar 14, 2024
13 changes: 8 additions & 5 deletions package.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create_directory(dir_name):
copy_tree("documentation", dir_name + "/documentation")


def run_build(target_bin, connector_version):
def run_build(target_bin):
"""
Compiles a binary for the target OS.

Expand All @@ -58,7 +58,8 @@ def run_build(target_bin, connector_version):
logging.error("Environment variables GOOS or GOARCH are not set.")
return None

file_name = "timestream-prometheus-connector-{}-{}-{}".format(target_bin, arch, connector_version)
# Required for Lambda runtime platform.al2023
file_name = "bootstrap"

build_command = "go build -o {}/{}".format(target_bin, file_name)
if target_bin == "windows":
Expand Down Expand Up @@ -159,14 +160,16 @@ def create_tarball(target_folder, version):
:return: The name of the precompiled binary.
"""
create_directory(target_folder)
bin_name = run_build(target_folder, version)
bin_name = run_build(target_folder)
if bin_name is None:
logging.error("Cannot create binary for packaging.")
return

check_binary(target_folder, bin_name)
tar_dir(bin_name, target_folder)
return bin_name
arch = "amd64"
archive_name = "timestream-prometheus-connector-{}-{}-{}".format(target_folder, arch, version)
tar_dir(archive_name, target_folder)
return archive_name


if __name__ == "__main__":
Expand Down
10 changes: 6 additions & 4 deletions serverless/template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Metadata:
LicenseUrl: "LICENSE"
ReadmeUrl: "DEVELOPER_README.md"
HomePageUrl: "https://aws.amazon.com/timestream/"
SemanticVersion: "1.1.0"
SemanticVersion: "1.0.0"

Parameters:
APIGatewayStageName:
Expand Down Expand Up @@ -78,11 +78,13 @@ Resources:
Type: "AWS::Serverless::Function"
Properties:
Role: !GetAtt "IAMLambdaRole.Arn"
CodeUri: ./timestream-prometheus-connector-linux-amd64-1.1.0.zip
CodeUri:
Bucket: !Sub 'timestreamassets-${AWS::Region}'
Key: "timestream-prometheus-connector-linux-amd64-1.0.0.zip"
Description: "Prometheus remote storage connector for Amazon Timestream"
Handler: "timestream-prometheus-connector-linux-amd64-1.1.0"
Handler: "bootstrap"
MemorySize: !Ref "MemorySize"
Runtime: "go1.x"
Runtime: "provided.al2023"
Environment:
Variables:
default_database: !Ref "DefaultDatabase"
Expand Down
2 changes: 1 addition & 1 deletion timestream/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ import (

// Application build information.
var (
Version = "1.1.0"
Version = "1.0.0"
GoVersion = runtime.Version()
)
Loading