Skip to content

Commit

Permalink
Update template.yml and package.py for platform.al2023 runtime (#42)
Browse files Browse the repository at this point in the history
* Add User-Agent documentation to README

* Add User-Agent header value

* Revise documentation

README and serverless/DEVELOPER_README have been edited and now stress one-click deployment as the best way to deploy the connector.

Additionally, various grammatical, spelling, whitespace, and markdown formatting issues have been fixed. British English has been favoured. An outdated image was also changed.

GETTING_STARTED has been removed and its verification section has been moved to README.

* Fix broken & outdated links & revamp RELEASE.md

- Broken or outdated links have been fixed.
- `RELEASE.md` has been updated with instructions for using the seven public S3 buckets and `template.yml`.
- All references to version `1.1.0` have been changed to `1.0.0`.

* Update template Go version & connector version in template

- `go1.x` runtime is no longer supported for Lambda functions, causing deployments to fail, this has been updated to `provided.al2023`.
- The connector version in `template.yml` has been changed from `1.1.0` to `1.0.0`.
- Handler has been changed to `bootstrap` to match the instructions to migrate from `go1.x` to `provided.al2023`.
- The template will get the Lambda function code from the public bucket matching `AWS::Region`.
- `package.py` now names the binary `bootstrap`, but still packages the binary and documentation in an archive named `timestream-prometheus-connect-<os>-<arch>-<version>`.
  • Loading branch information
trevorbonas authored Mar 14, 2024
1 parent fecde1d commit f52efb6
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
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()
)

0 comments on commit f52efb6

Please sign in to comment.