khone/koʊ.neɪ/
Experimental

Bootstrap macro

The bootstrap stack installs the per-account/per-region resources that application stacks consume:

  • S3 bucket for config/spec artifacts.
  • Custom::KhoneConfigPublisher Lambda (writes the manifest).
  • KhoneGateway CloudFormation macro (expands Khone::Gateway::Service).
  • Shared Mode A runtime API proxy layers (arm64 and amd64).
  • Versioned gateway Lambda artifact settings used by the macro.

Khone::Gateway::Service

Khone::Gateway::Service is the deployable gateway resource. The macro replaces the original logical ID with a native AWS::Lambda::Function, then generates the config publisher, execution role, Function URL, and optional log group around it.

GatewayService:
  Type: Khone::Gateway::Service
  Properties:
    CapacityProviderArn: !Ref GatewayCapacityProviderArn
    FunctionName: !Sub "${AWS::StackName}-gateway"
    MemorySize: 2048
    Timeout: 30
    ExecutionEnvironmentMemoryGiBPerVCpu: 2.0
    PerExecutionEnvironmentMaxConcurrency: 64
    MinExecutionEnvironments: 1
    MaxExecutionEnvironments: 4
    ConfigPrefix: !Sub "khone/${AWS::StackName}/gateway/"
    GatewayConfig:
      DefaultTimeoutMs: 2000
    Spec:
      openapi: 3.0.0
      paths: {}

Supported properties:

PropertyRequiredDescription
CapacityProviderArnYesExisting Lambda Managed Instances capacity provider ARN.
GatewayConfigYesRuntime settings excluding Spec. Must be an object.
SpecYesOpenAPI-ish route document embedded into the manifest. Must be an object.
ConfigPrefixNoS3 key prefix. Defaults to khone/${AWS::StackName}/<LogicalId>/.
FunctionNameNoGateway Lambda function name.
DescriptionNoGateway Lambda description.
MemorySizeNoGateway Lambda memory in MB. Defaults to 2048.
TimeoutNoGateway Lambda timeout in seconds. Defaults to 30.
ExecutionEnvironmentMemoryGiBPerVCpuNoLMI execution environment memory per vCPU. Defaults to 2.0.
PerExecutionEnvironmentMaxConcurrencyNoLMI max concurrency per execution environment. Defaults to 64.
MinExecutionEnvironmentsNoLMI minimum execution environments. Defaults to 1.
MaxExecutionEnvironmentsNoLMI maximum execution environments. Defaults to 4.
FunctionUrlAuthTypeNoFunction URL auth type, NONE or AWS_IAM. Defaults to NONE.
EnvironmentNoGateway environment variables as a map of strings or intrinsics. KHONE_CONFIG_URI is reserved.
TracingConfigNoNative Lambda tracing config.
LoggingConfigNoNative Lambda logging config.
LogRetentionInDaysNoCreates a generated CloudWatch log group with the requested retention.

The macro additionally preserves Condition, DeletionPolicy, DependsOn, Metadata, and UpdateReplacePolicy from the original resource fragment.

The original logical ID becomes the gateway Lambda. !Ref GatewayService returns the function name, and !GetAtt GatewayService.Arn returns the gateway Lambda ARN.

Generated logical IDs:

Logical IDResource
<Gateway>KhoneConfigPublisherCustom::KhoneConfigPublisher
<Gateway>KhoneExecutionRoleAWS::IAM::Role
<Gateway>KhoneFunctionUrlAWS::Lambda::Url
<Gateway>KhoneFunctionUrlPermissionAWS::Lambda::Permission when FunctionUrlAuthType: NONE
<Gateway>KhoneLogGroupAWS::Logs::LogGroup when LogRetentionInDays is set

Config publisher attributes are available from <Gateway>KhoneConfigPublisher:

AttributeDescription
BucketNameConfig artifact bucket.
PrefixNormalized S3 key prefix.
ConfigKeyS3 object key.
ConfigS3Uris3://<bucket>/<key> URI consumed by KHONE_CONFIG_URI.
ConfigSha256SHA-256 of the canonical manifest JSON ({...GatewayConfig, "Spec": Spec}).

Deployment ownership

Khone::Gateway::Service owns gateway compute, IAM, environment variables, observability, Function URL, and scaling. Capacity providers remain external: pass the existing capacity provider ARN into CapacityProviderArn.

Bootstrap outputs

Logical outputExported asDescription
ConfigBucketNameKhoneConfigBucketNameS3 bucket name for config manifests.
ConfigPublisherServiceTokenKhoneConfigPublisherServiceTokenService token (Lambda ARN) for Custom::KhoneConfigPublisher.
GatewayMacroName(not exported)Macro name, always the literal KhoneGateway.
LayerArm64ArnKhoneLayerArm64ArnARN of the arm64 runtime API proxy layer.
LayerAmd64ArnKhoneLayerAmd64ArnARN of the amd64 runtime API proxy layer.

Application stacks should reference the macro via Transform: [KhoneGateway] (the literal name) and import the other values via Fn::ImportValue.