Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Examples/CDK/infra/lib/lambda-api-project-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class LambdaApiStack extends cdk.Stack {

// Create the Lambda function
const lambdaFunction = new lambda.Function(this, 'SwiftLambdaFunction', {
runtime: lambda.Runtime.PROVIDED_AL2,
runtime: lambda.Runtime.PROVIDED_AL2023,
architecture: lambda.Architecture.ARM_64,
handler: 'bootstrap',
code: lambda.Code.fromAsset('../.build/plugins/AWSLambdaBuilder/outputs/AWSLambdaBuilder/APIGatewayLambda/APIGatewayLambda.zip'),
Expand Down
44 changes: 0 additions & 44 deletions Plugins/AWSLambdaBuilder/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ struct AWSLambdaBuilder: CommandPlugin {
buildConfiguration = .release
}

// TODO: When running on Amazon Linux 2, we have to build directly from the plugin
// launch the build, then call the helper just for the ZIP part

let tool = try context.tool(named: "AWSLambdaPluginHelper")
let args =
[
Expand Down Expand Up @@ -109,47 +106,6 @@ struct AWSLambdaBuilder: CommandPlugin {
Diagnostics.error("AWSLambdaPluginHelper invocation failed: \(problem)")
}
}

// TODO: When running on Amazon Linux 2, we have to build directly from the plugin
// private func build(
// packageIdentity: Package.ID,
// products: [Product],
// buildConfiguration: PackageManager.BuildConfiguration,
// verboseLogging: Bool
// ) throws -> [LambdaProduct: URL] {
// print("-------------------------------------------------------------------------")
// print("building \"\(packageIdentity)\"")
// print("-------------------------------------------------------------------------")
//
// var results = [LambdaProduct: URL]()
// for product in products {
// print("building \"\(product.name)\"")
// var parameters = PackageManager.BuildParameters()
// parameters.configuration = buildConfiguration
// parameters.otherSwiftcFlags = ["-static-stdlib"]
// parameters.logging = verboseLogging ? .verbose : .concise
//
// let result = try packageManager.build(
// .product(product.name),
// parameters: parameters
// )
// guard let artifact = result.executableArtifact(for: product) else {
// throw Errors.productExecutableNotFound(product.name)
// }
// results[.init(product)] = artifact.url
// }
// return results
// }

// private func isAmazonLinux2() -> Bool {
// if let data = FileManager.default.contents(atPath: "/etc/system-release"),
// let release = String(data: data, encoding: .utf8)
// {
// return release.hasPrefix("Amazon Linux release 2")
// } else {
// return false
// }
// }
}

private enum BuilderErrors: Error, CustomStringConvertible {
Expand Down
7 changes: 4 additions & 3 deletions Plugins/AWSLambdaPackager/Plugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,8 @@ struct AWSLambdaPackager: CommandPlugin {
(default is latest)
This parameter cannot be used when --base-docker-image is specified.
--base-docker-image <name> The name of the base docker image to use for the build.
(default: swift:<version>-amazonlinux2)
Note: Amazon Linux 2023 will become the default after June 30, 2026.
(default: swift:<version>-amazonlinux2023)
Amazon Linux 2 is deprecated since June 30, 2026.
Visit Docker Hub for all available swift tags:
https://hub.docker.com/_/swift/tags?name=amazonlinux
This parameter cannot be used when --swift-version is specified.
Expand Down Expand Up @@ -537,8 +537,9 @@ private struct Configuration: CustomStringConvertible {

let swiftVersion = swiftVersionArgument.first ?? .none // undefined version will yield the latest docker image

// default to Amazon Linux 2023 after 30 June 2026 (Amazon Linux 2 is deprecated)
self.baseDockerImage =
baseDockerImageArgument.first ?? "swift:\(swiftVersion.map { $0 + "-" } ?? "")amazonlinux2"
baseDockerImageArgument.first ?? "swift:\(swiftVersion.map { $0 + "-" } ?? "")amazonlinux2023"

self.disableDockerImageUpdate = disableDockerImageUpdateArgument
self.containerCLI = try ContainerCLI.parse(
Expand Down
1 change: 1 addition & 0 deletions Sources/AWSLambdaPluginHelper/lambda-build/Builder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ struct Builder {
This parameter cannot be used when --base-docker-image is specified.
--base-docker-image <name> The name of the base docker image to use for the build.
(default: swift:<version>-amazonlinux2023)
Amazon Linux 2 is deprecated since June 30, 2026.
Visit Docker Hub for all available swift tags:
https://hub.docker.com/_/swift/tags?name=amazonlinux
This parameter cannot be used when --swift-version is specified.
Expand Down
4 changes: 2 additions & 2 deletions Sources/AWSLambdaRuntime/Docs.docc/Deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ Resources:
CodeUri: .build/plugins/AWSLambdaBuilder/outputs/AWSLambdaBuilder/APIGatewayLambda/APIGatewayLambda.zip
Timeout: 60
Handler: swift.bootstrap # ignored by the Swift runtime
Runtime: provided.al2
Runtime: provided.al2023
MemorySize: 128
Architectures:
- arm64
Expand Down Expand Up @@ -466,7 +466,7 @@ export class LambdaApiStack extends cdk.Stack {

// Create the Lambda function
const lambdaFunction = new lambda.Function(this, 'SwiftLambdaFunction', {
runtime: lambda.Runtime.PROVIDED_AL2,
runtime: lambda.Runtime.PROVIDED_AL2023,
architecture: lambda.Architecture.ARM_64,
handler: 'bootstrap',
code: lambda.Code.fromAsset('../.build/plugins/AWSLambdaBuilder/outputs/AWSLambdaBuilder/APIGatewayLambda/APIGatewayLambda.zip'),
Expand Down
Loading