AWS CDK Signer Construct Library
The `aws-cdk-aws-signer` library provides AWS Cloud Development Kit (CDK) constructs for defining AWS Signer resources. It simplifies the creation and management of signing profiles, allowing you to sign code and artifacts with robust cryptographic integrity. This entry reflects version 1.204.0, part of the CDK v1 series, which typically follows a rapid release cadence with new features and bug fixes.
Common errors
-
ModuleNotFoundError: No module named 'aws_cdk.aws_signer'
cause The `aws-cdk-aws-signer` package is not installed, or you are attempting to use CDK v1 imports in a CDK v2 project (where `aws_signer` is part of `aws_cdk_lib.aws_signer`).fixEnsure the package is installed: `pip install aws-cdk-aws-signer`. If using CDK v2, change the import to `from aws_cdk_lib import aws_signer` and install `aws-cdk-lib` instead. -
jsii.errors.JSIIError: SigningProfile: platform is required
cause The `platform` property was not provided when instantiating a `SigningProfile` construct, which is a mandatory parameter.fixAdd the `platform` argument with a valid `signer.Platform` enum value, e.g., `platform=signer.Platform.AWS_LAMBDA_SHA384_ECDSA`. -
Failed to create change set for the stack SignerStack: The security token included in the request is invalid.
cause The AWS credentials configured for CDK deployment lack sufficient permissions to create AWS Signer resources or associated IAM roles.fixEnsure the IAM user or role used for CDK deployment has permissions for `signer:*` actions, especially `signer:PutSigningProfile`, `signer:GetSigningProfile`, and `iam:*` for role creation. Review CloudFormation event logs for specific permission failures.
Warnings
- breaking This library (`aws-cdk-aws-signer`) is part of AWS CDK v1. It is not compatible with AWS CDK v2 (`aws-cdk-lib`) out-of-the-box. Attempting to use v1 constructs directly in a v2 application will lead to `ModuleNotFoundError` or `jsii` compatibility issues.
- gotcha AWS Signer is not available in all AWS Regions. Attempting to deploy Signer resources in an unsupported region will result in deployment failures (e.g., 'ResourceNotFoundException' or 'InvalidRegionException').
- gotcha The `platform` property is mandatory for `signer.SigningProfile` and determines the type of code/artifact that can be signed. Using an incorrect platform or omitting it will lead to deployment errors or functional issues.
- gotcha The `signature_validity` property defines how long a signature created by the profile remains valid. If this duration is too short, signed artifacts might expire prematurely; if too long, it might pose a security risk. The default validity is often not suitable for all use cases.
Install
-
pip install aws-cdk-aws-signer
Imports
- aws_signer
from aws_cdk import aws_signer
- Platform
from aws_cdk.aws_signer import Platform
- SigningProfile
from aws_cdk.aws_signer import SigningProfile
Quickstart
import aws_cdk as cdk
from aws_cdk import aws_signer as signer
app = cdk.App()
stack = cdk.Stack(app, "MySignerStack")
# Create an AWS Signer Signing Profile
signing_profile = signer.SigningProfile(
stack, "MySigningProfile",
platform=signer.Platform.AWS_LAMBDA_SHA384_ECDSA,
signature_validity=cdk.Duration.days(30)
)
cdk.CfnOutput(stack, "SigningProfileArn", value=signing_profile.signing_profile_arn)
app.synth()