LambdaSharp "Geminus" Release (v0.7.0.17) - 2020-05-07
Geminus of Rhodes, was a Greek astronomer and mathematician, who flourished in the 1st century BC. An astronomy work of his, the Introduction to the Phenomena, still survives; it was intended as an introductory astronomy book for students. He also wrote a work on mathematics, of which only fragments quoted by later authors survive. (Wikipedia)
What's New
This release focuses on making it easy to share modules with others and streamlining the creation and upgrading of LambdaSharp deployment tiers. Prior to this release, LambdaSharp modules had to be made available in an S3 bucket for each region used by a deployment tier. In 0.7.0, the LambdaSharp CLI now automatically imports modules and their artifacts into the S3 bucket of the deployment tier, regardless of the origin region. This new behavior also safeguards against disruption should the original LambdaSharp module become unavailable at a later date since a copy is maintained in the deployment bucket. To further enhance deployment consistency, external modules are only imported during the publishing phase. The deployment phase relies entirely on the modules available in the S3 bucket of the deployment tier.
Upgrade Procedure from v0.6.1 to v0.7.0
- Ensure all modules are deployed with v0.6.1 or later
- Upgrade LambdaSharp CLI to v0.7.0
dotnet tool uninstall -g LambdaSharp.Tooldotnet tool install -g LambdaSharp.Tool
- Upgrade LambdaSharp Deployment Tier (replace
Sandboxwith the name of the deployment tier to upgrade)lash init --tier Sandbox --allow-upgrade
- Delete the LambdaSharp CLI profile CloudFormation stack if the CLI profile is not used by any other deployment tiers
- Locate the LambdaSharp CLI profile stack in the AWS Console (starts with
LambdaSharpTool-) - Empty the associated S3 bucket named DeploymentBucket
- Delete the CloudFormation stack
- Locate the LambdaSharp CLI profile stack in the AWS Console (starts with
BREAKING CHANGES
LambdaSharp Module Syntax
- The
Namespace:declaration has been renamed toGroup:. - Module references in
Using:andNested:declarations now require an origin suffix. For example,LambdaSharp.S3.IO:0.5must now be written asLambdaSharp.S3.IO:0.5@lambdasharp.
LambdaSharp Core Services
The DefaultSecretKey was removed from LambdaSharp Core Services. While it was convenient, it introduced a hard relationship between the KMS key and the lifecycle of the LambdaSharp Core Services. The better approach is to entrust the account owner with managing the KMS lifecycle. In addition, it was also a monthly recurring cost item, which was unnecessary when not required.
A few Lambda related error messages have been rephrased to make it clearer they related to the execution of Lambda functions.
Task timed out after 15.02 secondsis nowLambda timed out after 15.02 secondsProcess exited before completing requestis nowLambda exited before completing requestProcess ran out of memory (Max: 128 MB)is nowLambda ran out of memory (Max: 128 MB)Process nearing execution limits (Memory 80.12 %, Duration: 91.23 %)is nowLambda nearing execution limits (Memory 80.12 %, Duration: 91.23 %)
LambdaSharp CLI
- The
lash configcommand has been removed. Its functionality has been integrated into thelash initcommand to streamline the setup process, resulting in a single deployment tier stack. - The concept of the CLI profile is gone. Therefore the
--cli-profileoption is no longer supported. - With support of resolving LambdaSharp modules from third-party S3 buckets by using the
@originsuffix on module names, there is no need to pre-register S3 buckets anymore, which makes the--module-bucket-namesobsolete. - The deployment tier does not support the SNS topic for CloudFormation updates, which means the
--deployment-notifications-topicoption is no longer supported. - The LambdaSharp CLI will now fail to publish a stable version of a module when the
git-shais prefixed withDIRTY-, which indicate uncommitted local changes. This behavior can be overwritten with--force-publish. - The
.csprojfile generated bylash new functioncan now dynamically support contributor mode (i.e. using a local LambdaSharp git checkout), which makes the--use-project-referenceand--use-nuget-referenceobsolete. - The options for
lash tier coreserviceswere changed from--enableto--enabledand from--disableto--disabledto make them consistent with thelash initcommand.
LambdaSharp SDK
ALambdaFunction.InfoStruct.ModuleOwnerhas been renamed toALambdaFunction.InfoStruct.ModuleNamespaceALambdaFunction.DefaultSecretKeyIdhas been removed- The physical ID returned by
ALambdaFinalizerFunctionis now a constant (Finalizer:Module) instead of being based on the checksum of the original template. The latter proved too risky, because it could accidentally trigger a CloudFormation delete resource event when not expected.
New LambdaSharp CLI Features
Init Command
The lash init command has been redesigned to streamline the setup and configuration of a deployment tier.
Running lash init --quick-start will create a new deployment tier without any prompts. The newly created tier has no LambdaSharp Core Services, which means it sets up quickly and at no monthly cost. In addition, an empty deployment tier name is now supported, which means using the --tier option--or the LAMBDASHARP_TIER environment variable--is now optional.
The deployment tier can be upgraded to use LambdaSharp Core Services by running lash init --core-services enabled. Similarly, a deployment tier can also be downgraded by running lash init --core-services disabled assuming none of the deployed modules rely on them. Otherwise, first run the lash tier coreservices --disabled command.
Build Command
The lash build command has two new options for advanced use cases. First, is the --module-version, which sets the version of the module being compiled. This option makes it possible to tie the module version to an environment variable or otherwise supply it without modifying the module source file. Second, the --module-build-date, which is used to override the default build date of the module. This option is useful to ensure that the generated CloudFormation file is deterministic, which is required for some validation scenarios.
Publish Command
The lash publish command has a new option to override the module origin information using --module-origin. By default, the module origin for a newly published module is the name of the deployment bucket. However, it may be sometimes necessary to publish a new version of a module that originated from somewhere else, such as deploying an urgent fix. With the --module-origin option, it is possible to publish a module into the S3 bucket of the deployment tier, while making it look like it was imported. As a result, all subsequent deployments will resolve their dependencies to this new module. The imported module and its artifacts are annotated with a metadata field (x-amz-meta-lambdasharp-origin) that describes their true origin.
The lash publish command is responsible for uploading the module artifacts to the deployment bucket, as well as importing all dependencies. Modules from a foreign origin can also be imported explicitly by this command.
Using PowerShell/Bash:
lash publish LambdaSharp.S3.Subscriber:0.7.0@lambdasharp
The following text should appear (or similar):
LambdaSharp CLI (v0.7.0) - Publish LambdaSharp module
=> Imported LambdaSharp.S3.Subscriber:0.7.0@lambdasharp
Done (finished: 8/16/2019 10:27:01 AM; duration: 00:00:04.5205374)
To accommodate combining modules from various origins in a single S3 deployment bucket, the structure of the S3 keys had to be revisited. All published/imported modules and their artifacts now have the following prefix {Module::Origin}/{Module::Namespace}/{Module::Name}, which ensures there will never be any conflicts, since S3 bucket names (i.e. the module origin) is guaranteed to be globally unique. The module manifest--which describes the parameters, resource type definitions, dependencies, and artifacts--is located at {Module::Origin}/{Module::Namespace}/{Module::Name}/{Module::Version}. The module artifacts, across all versions, are located at {Origin}/{ModulePrefix}/{ModuleSuffix}/.artifacts/.
Deploy Command
The lash deploy command now takes multiple values for the --xray option. Without any value, the --xray option only enables AWS X-Ray for the root module being deployed. Optionally, AWS X-Ray can also be enabled for the root module and all nested modules using --xray:allmodules.
Additionally, AWS X-Ray is now supported for Lambda functions, AWS SDK calls, public HTTP calls (when using the [ALambdaFunction.HttpClient] property(xref:ALambdaFunction.HttpClient)) and API Gateway endpoints, providing deeper insights into
New Function Command
The lash new function command has been enhanced with types for C# functions. It can now create the scaffolding for functions to handle API Gateway, custom CloudFormation resources, SQS queues, scheduled CloudWatch events, SNS topics, WebSocket, module finalizer, and generic requests by using the --type option. If no type is provided, the LambdaSharp CLI will prompt for one. In addition, the --memory and --timeout options have been added. When omitted, they default to 256 (MB) and 30 (seconds), respectively.
The generated .csproj file was updated to make it easier for contributors to deploy modules with their latest local changes by conditionally referencing the LambdaSharp nuget package or local LambdaSharp project depending on the LAMBDASHARP environment variable. This behavior was achieved by using conditionals in the .csproj file.
<ItemGroup>
<PackageReference Condition="'$(LAMBDASHARP)'==''" Include="LambdaSharp" Version="0.7.0.*"/>
<ProjectReference Condition="'$(LAMBDASHARP)'!=''" Include="$(LAMBDASHARP)\src\LambdaSharp\LambdaSharp.csproj" />
</ItemGroup>
New Bucket Command
The lash new bucket command is used to create a new public S3 bucket configured to require requestors to pay for data transfer. This is the recommended configuration when publicly sharing LambdaSharp modules so the owner of the bucket only pays for the storage and not its access, which could become expensive for a popular module. Once the bucket is created, it can be used with a deployment tier to enable publishing to it.
Using PowerShell/Bash:
lash new bucket my-lambdasharp-bucket
The following text should appear (or similar):
LambdaSharp CLI (v0.7.0) - Create new public S3 bucket for sharing LambdaSharp modules
CREATE_COMPLETE AWS::CloudFormation::Stack PublicLambdaSharpBucket-my-lambdasharp-bucket
CREATE_COMPLETE AWS::S3::Bucket Bucket
CREATE_COMPLETE AWS::S3::BucketPolicy BucketPolicy
=> Stack creation finished
=> Updating S3 Bucket for Requester Pays access
Done (finished: 8/16/2019 10:20:18 AM; duration: 00:00:32.5327433)
Info Command
The lash info command now shows if LambdaSharp Core Services are enabled for the deployment tier. In addition, it will also show how much Lambda storage is used and how much Lambda reserved capacity is used by the AWS account.
Using PowerShell/Bash:
lash info
The following text should appear (or similar):
LambdaSharp CLI (v0.7.0) - Show LambdaSharp information
LambdaSharp Deployment Tier
Name: Sandbox
Version: 0.7.0
Core Services: Enabled
Deployment S3 Bucket: sandbox-lambdasharp-cor-deploymentbucketresource-kvuimlss8yky
API Gateway Role: arn:aws:iam::************:role/LambdaSharp-ApiGatewayRole
Git
Branch: 1.0-DEV
SHA: e8705be44f02f81f5e7c300205cf6de97248e090
AWS
Region: us-west-2
Account Id: ************
Lambda Storage: 0.52GB of 75GB (0.69%)
Lambda Reserved Executions: 35 of 1,000 (3.50%)
Tools
.NET Core CLI Version: 2.2.203
Git CLI Version: 2.18.0.windows.1
Amazon.Lambda.Tools: 3.2.3
Done (finished: 8/20/2019 12:27:29 PM; duration: 00:00:04.9603515)
Encrypt Command
The lash encrypt command now has a support for decrypting an encrypted secret before encrypting it by supplying the --decrypt option. This option makes it possible to decrypt an existing secret and re-encrypt it using a different KMS key without having to decrypt it manually first.
New LambdaSharp Assembly Features
- Added
ALambdaFunction.DeploymentBucketNameproperty to read the S3 bucket name used to deploy the Lambda function. - Added
ALambdaCustomResourceFunction.Abort(string)method to abort the creation or update of a custom resource.Abort()will cause CloudFormation to respond with a failure code and showing the provided message. - Added
LambdaSharp.CustomResource.Request<TProperties>.StackIdproperty to custom resource request to uniquely identify the CloudFormation stack from which the request originated. - The
ALambdaFinalizerFunctionclass now checks confirms the CloudFormation stack is being deleted before triggering the [DeleteDeployment(FinalizerProperties)] method. This change allows aFinalizerto be removed from a module without triggering its delete logic.
Releases
(v0.7.0.17) - 2020-05-07
New Features
- LambdaSharp CLI
- Enhanced validation of existing CloudFormation stack to ensure all artifacts are present before performing an update.
Fixes
- LambdaSharp CLI
- Fixed a bug with
--aws-profileand--aws-regionoptions forlast util list-lambdasandlash util delete-orphan-logs. - Fixed a rate limiting issue with
last util list-lambdas. - Fixed an issue where the
--aws-regionoption didn't always work as expected. - Fixed an issue with the cursor disappearing when
lashexits. - Fixed an issue where
--force-deploydid not allow downgrading a CloudFormation stack with an earlier module version.
- Fixed a bug with
(v0.7.0.16) - 2020-05-01
New Features
- LambdaSharp CLI
- Added
util list-lambdascommand to list all Lambda functions by CloudFormation stack with their last used timestamp. - Enhanced rendering of resource updated that could lead to potential data loss.
- Added
Fixes
- LambdaSharp CLI
- Fixed an issue with updating CloudFormation stacks deployed with LambdaSharp.Tool v0.6.0 and earlier.
(v0.7.0.15) - 2020-04-24
New Features
- LambdaSharp CLI
- Enhanced
--force-buildto delete the build folders for all dependencies to ensure a clean build. - Enhanced rendering of stack output values to distinguish the value from its description (requires ANSI terminal compatibility).
- Added error and warning colorization for the
dotnetbuild results (requires ANSI terminal compatibility).
- Enhanced
Fixes
- LambdaSharp CLI
- Fixed an issue where the creation of the AWS credentials file would fail when the
.awsfolder doesn't exit. - Fixed an issue in WebSocket support where
AWS::ApiGatewayV2::Modelresources are not tracked as a dependencies byAWS::ApiGatewayV2::Routeresources. - Reverted a change that used
Amazon.Lambda.Serialization.SystemTextJsonas thew function serializer for new .NET Core 3.1 projects.
- Fixed an issue where the creation of the AWS credentials file would fail when the
(v0.7.0.14) - 2020-04-14
New Features
- LambdaSharp CLI
- Enhanced
lash infoto show if build environment supports ReadyToRun compilation. - Fixed an issue with
lash nukenot properly deleting a quick-start deployment tier.
- Enhanced
(v0.7.0.13) - 2020-04-09
New Features
- LambdaSharp CLI
- Added
lash nuketo delete an entire deployment tier. - Added
Module::RestApi.EndpointConfigurationandModule::RestApi.Policyas override pragmas.
- Added
Fixes
- LambdaSharp CLI
- Fixed an issue the REST API description was static due to a missing
Fn::Subfunction call. - Fixed an issue where using the same invocation methods for two different REST API routes would cause a CloudFormation failure.
- Fixed an issue where changing a REST API route would sometimes not update the deployment.
- Fixed an issue where the Logical IDs for deleted resources were not properly mapped to their hierarchical module names.
- Fixed an issue the REST API description was static due to a missing
(v0.7.0.12) - 2020-04-08
New Features
- LambdaSharp CLI
- Enabled projects to be compiled with ReadyToRun optimization when targeting .NET Core 3.1 and running on Amazon Linux 2.
- Ensure compiled projects don't use Tiered Compilation/Quick JIT for more consistent performance.
- Added support for creating Lambda functions using .NET Core 3.1.
- Highlight name of module, functions, and packages in console output for easier tracking (requires ANSI terminal compatibility).
- Updated embedded CloudFormation spec to 12.2.0.
Fixes
- LambdaSharp CLI
- Fixed an issue were a project would skip compilation even when the invocation schema generation had failed previously.
- LambdaSharp SDK
- Fixed missing documentation XML comments.
(v0.7.0.11) - 2020-03-31
New Features
- LambdaSharp CLI
- Added support for .NET Core 3.1 runtime.
- Updated embedded CloudFormation spec to 12.0.0.
Fixes
- LambdaSharp CLI
- Fixed an issue where the module manifest was not updated properly when republishing a previously published CloudFormation template.
- Fixed an issue to make sure
ModuleChecksumis always set toDeploymentChecksumandDeploymentChecksumis explicitly set to ensure it has the proper template checksum value. - Fixed an issue where a function project was not being recompiled even when the API invocation schema generation failed.
(v0.7.0.10) - 2020-03-13
Fixes
- LambdaSharp CLI
- Fixed an issue where content references in .csproj files were always parsed as XML files.
(v0.7.0.9) - 2020-02-25
Fixes
- LambdaSharp CLI
- Fixed an issue where the wrong manifest was copied when importing a module into the deployment bucket.
(v0.7.0.8) - 2020-02-25
New Features
- LambdaSharp Core Services
- Added
RollbarProjectPatternparameter to provide more flexibility on how Rollbar project names are generated.
- Added
Fixes
- LambdaSharp CLI
- Fixed an issue where non-instance, non-public fields/properties were used as query parameters when using the
[FromUri]parameter attribute. - Fixed an issue where the CLI required the
~/.aws/credentialsfile to exist even whenAWS_ACCESS_KEY_IDandAWS_SECRET_ACCESS_KEYenvironment variables are set.
- Fixed an issue where non-instance, non-public fields/properties were used as query parameters when using the
- LambdaSharp SDK
- Fixed an issue where headers returned by
APIGatewayProxyRequestwhere not case-insensitive.
- Fixed an issue where headers returned by
- LambdaSharp Core Module
- Fixed an issue with Rollbar projects failing to be created because the generated project name exceeded 32 characters.
(v0.7.0.7) - 2020-01-31
Fixes
- LambdaSharp CLI
lash builddid not properly convert\in.csprojfiles on non-Windows operating systems, which caused a false-negative when trying to detect changes to function projects.- Replaced locally patched
SharpZipLibassembly with nuget version since the local patch was merged and published in v1.2.0 - Fixed an issue where a function project would be recompiled every time even when no changes were made.
- Fixed an issue where cached information was stored in the wrong application folder.
(v0.7.0.6) - 2019-12-12
New Features
- LambdaSharp CLI
lash initnow prompts to create a default AWS profile when none exists.
Fixes
- LambdaSharp CLI
- Fixed an issue where a stack update was skipped when only the parameter values changed.
- Fixed an issue in the WebSocket logging configuration.
(v0.7.0.5) - 2019-10-25
Fixes
- LambdaSharp CLI
- Fixed an issue that caused
lash buildto fail on C# projects which contained declarations with anExcludeattribute.
- Fixed an issue that caused
(v0.7.0.4) - 2019-10-17
New Features
- LambdaSharp CLI
lash initnow detects if a new, compatible version ofLambdaSharp.Coreexists when updating a deployment tier.lash buildnow checks if an existing function package is up to date and therefore compilation can be skipped.- Added
--force-buildoption tobuild,publish, anddeployto rebuild without incremental compilation or caching all projects in a module. lash util download-cloudformation-specnow stores the downloaded CloudFormation specification into the application data folder when not running in contributor mode, which makes it possible to access new CloudFormation resources without updatinglash.- Module output values are now highlighted. Standard module output values (e.g.
ModuleChecksum) are omitted unlesslashis run in verbose mode. - All commands with the
--aws-profileoption now also support--aws-regionto override the region of the AWS profile. - (experimental) Cache information about deployment tier, AWS profile, and found manifests locally to reduce network latencies (requires
LAMBDASHARP_FEATURE_CACHINGenvironment variable to be set totrue)
Fixes
- LambdaSharp CLI
- Fixed parent module dependency on imports belonging to a nested module.
- Fixed issue when using
lash new functionon a module an!Includestatement. - Fixed
lash initre-prompting all parameters when--force-deployis used. - Fixed
lash initdeploying un-deployed LambdaSharp modules when--force-deployis used.
- LambdaSharp SDK
- Fixed an issue where an exception being reported more than once with a different severity level caused a duplicate-key exception.
ALambdaCustomResourceFunctionnow uses exponential back-off when writing the invocation result back to pre-signed S3 URL.
(v0.7.0.3) - 2019-10-03
New Features
- LambdaSharp Module Syntax
- Added support for
AuthorizationType,AuthorizationScopes, andAuthorizerIdto REST API and WebSocket sources. - Update CloudFormation spec to v6.2.0.
- Added support for
- LambdaSharp CLI
- Enhanced
lash new resourceto proceed with unambiguous resource type matches or prompt to disambiguate.
- Enhanced
Fixes
- LambdaSharp CLI
- Use function name for Lambda permissions instead of ARN b/c of 64 character limit.
- Fixed missing CloudWatch log group for
Finalizerfunction. - Fixed issue where nested types caused issues for WebSocket models.
- Fixed
lash new function Finalizerto default to 900 seconds timeout. - Fixed issue where
ApiKeyRequiredwas not properly set for WebSocket sources. - Improved heuristic for identifying if a legacy CloudFormation stack belongs to the deployment tier.
- Generate a single Lambda permission resource per REST API/WebSocket to Lambda function combination to avoid exceeding the resource policy size limit.
LambdaSharp.S3.IOModule- Fixed an issue with empty zip packages.
- LambdaSharp SDK
- Added missing log comment when logging exception in asynchronous API Gateway endpoint invocation.
(v0.7.0.2) - 2019-09-20
Fixes
- Fixed an issue with legacy CloudFormation notification topics.
- Fixed an issue with build failing to abort after finding a type error during
util create-invoke-methods-schemainvocation. - Fixed an issue with
lash initnot resuming properly when the core services installation was stuck in bootstrap mode.
(v0.7.0.1) - 2019-09-12
Fixes
- Fixed an issue with enabling/disabling core services in a deployment tier.
Updated Documentation
- Added metadata to HTML pages.