LambdaMicroVMs / Client / create_microvm_image

create_microvm_image

LambdaMicroVMs.Client.create_microvm_image(**kwargs)

Creates a MicroVM image from the specified code artifact and base image. The build is asynchronous — the image transitions from CREATING to CREATED on success, or CREATE_FAILED on failure. Use GetMicrovmImage to poll for completion.

See also: AWS API Documentation

Request Syntax

response = client.create_microvm_image(
    baseImageArn='string',
    baseImageVersion='string',
    buildRoleArn='string',
    description='string',
    codeArtifact={
        'uri': 'string'
    },
    logging={
        'disabled': {}
        ,
        'cloudWatch': {
            'logGroup': 'string',
            'logStream': 'string'
        }
    },
    egressNetworkConnectors=[
        'string',
    ],
    cpuConfigurations=[
        {
            'architecture': 'ARM_64'
        },
    ],
    resources=[
        {
            'minimumMemoryInMiB': 123
        },
    ],
    additionalOsCapabilities=[
        'ALL',
    ],
    hooks={
        'port': 123,
        'microvmHooks': {
            'run': 'DISABLED'|'ENABLED',
            'runTimeoutInSeconds': 123,
            'resume': 'DISABLED'|'ENABLED',
            'resumeTimeoutInSeconds': 123,
            'suspend': 'DISABLED'|'ENABLED',
            'suspendTimeoutInSeconds': 123,
            'terminate': 'DISABLED'|'ENABLED',
            'terminateTimeoutInSeconds': 123
        },
        'microvmImageHooks': {
            'ready': 'DISABLED'|'ENABLED',
            'readyTimeoutInSeconds': 123,
            'validate': 'DISABLED'|'ENABLED',
            'validateTimeoutInSeconds': 123
        }
    },
    environmentVariables={
        'string': 'string'
    },
    name='string',
    tags={
        'string': 'string'
    },
    clientToken='string'
)
Parameters:
  • baseImageArn (string) –

    [REQUIRED]

    The ARN of the Lambda-managed base MicroVM image to build upon. Use ListManagedMicrovmImages to discover available base images.

  • baseImageVersion (string) – The specific version of the base MicroVM image to use.

  • buildRoleArn (string) –

    [REQUIRED]

    The ARN of the IAM role assumed during the image build process. This role must have permissions to access the code artifact and any required resources.

  • description (string) – A description of the MicroVM image.

  • codeArtifact (dict) –

    [REQUIRED]

    The code artifact containing the application code and metadata for the MicroVM image.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: uri.

    • uri (string) –

      The URI of the code artifact, such as an Amazon S3 path or Amazon ECR image URI.

  • logging (dict) –

    The logging configuration for build-time and runtime logs. Specify {“cloudWatch”: {“logGroup”: “…”}} to stream logs to a custom CloudWatch log group, or {“disabled”: {}} to turn off logging.

    Note

    This is a Tagged Union structure. Only one of the following top level keys can be set: disabled, cloudWatch.

    • disabled (dict) –

      Specifies that logging is disabled.

    • cloudWatch (dict) –

      Configuration for sending logs to Amazon CloudWatch Logs.

      • logGroup (string) –

        The name of the CloudWatch Logs log group to send logs to.

      • logStream (string) –

        The name of the CloudWatch Logs log stream within the log group.

  • egressNetworkConnectors (list) –

    The list of egress network connectors available to the MicroVM at runtime.

    • (string) –

  • cpuConfigurations (list) –

    The list of supported CPU configurations for the MicroVM.

    • (dict) –

      Configuration for the CPU architecture of a MicroVM.

      • architecture (string) – [REQUIRED]

        The CPU architecture.

  • resources (list) –

    The resource requirements for the MicroVM.

    • (dict) –

      Resource requirements for a MicroVM.

      • minimumMemoryInMiB (integer) – [REQUIRED]

        The minimum amount of memory in MiB to allocate to the MicroVM.

  • additionalOsCapabilities (list) –

    Additional OS capabilities granted to the MicroVM runtime environment.

    • (string) –

      Capability granted to the application when booted

  • hooks (dict) –

    Lifecycle hook configuration for MicroVMs and MicroVM images.

    • port (integer) –

      The port number on which the hooks listener runs.

    • microvmHooks (dict) –

      The lifecycle hooks for MicroVM events.

      • run (string) –

        The path of the hook invoked when the MicroVM starts running.

      • runTimeoutInSeconds (integer) –

        The maximum time in seconds for the run hook to complete.

      • resume (string) –

        The path of the hook invoked when the MicroVM resumes from a suspended state.

      • resumeTimeoutInSeconds (integer) –

        The maximum time in seconds for the resume hook to complete.

      • suspend (string) –

        The path of the hook invoked when the MicroVM is suspended.

      • suspendTimeoutInSeconds (integer) –

        The maximum time in seconds for the suspend hook to complete.

      • terminate (string) –

        The path of the hook invoked when the MicroVM is terminated.

      • terminateTimeoutInSeconds (integer) –

        The maximum time in seconds for the terminate hook to complete.

    • microvmImageHooks (dict) –

      The hooks for MicroVM image build events.

      • ready (string) –

        The path of the hook invoked when the MicroVM image build is ready.

      • readyTimeoutInSeconds (integer) –

        The maximum time in seconds for the ready hook to complete.

      • validate (string) –

        The path of the hook invoked to validate the MicroVM image build.

      • validateTimeoutInSeconds (integer) –

        The maximum time in seconds for the validate hook to complete.

  • environmentVariables (dict) –

    Environment variables set in the MicroVM runtime environment.

    • (string) –

      • (string) –

  • name (string) –

    [REQUIRED]

    The name of the MicroVM image. Must be unique within the AWS account.

  • tags (dict) –

    A set of key-value pairs that you can attach to the resource. Use tags to categorize resources for cost allocation, access control (ABAC), and organization.

    • (string) –

      • (string) –

  • clientToken (string) –

    A unique, case-sensitive identifier you provide to ensure the idempotency of the request. If you retry a request that completed successfully using the same client token, the operation returns the successful response without performing any further actions.

    This field is autopopulated if not provided.

Return type:

dict

Returns:

Response Syntax

{
    'imageArn': 'string',
    'name': 'string',
    'state': 'CREATING'|'CREATED'|'CREATE_FAILED'|'UPDATING'|'UPDATED'|'UPDATE_FAILED'|'DELETING'|'DELETE_FAILED'|'DELETED',
    'latestActiveImageVersion': 'string',
    'latestFailedImageVersion': 'string',
    'createdAt': datetime(2015, 1, 1),
    'baseImageArn': 'string',
    'baseImageVersion': 'string',
    'buildRoleArn': 'string',
    'description': 'string',
    'codeArtifact': {
        'uri': 'string'
    },
    'logging': {
        'disabled': {},
        'cloudWatch': {
            'logGroup': 'string',
            'logStream': 'string'
        }
    },
    'egressNetworkConnectors': [
        'string',
    ],
    'cpuConfigurations': [
        {
            'architecture': 'ARM_64'
        },
    ],
    'resources': [
        {
            'minimumMemoryInMiB': 123
        },
    ],
    'additionalOsCapabilities': [
        'ALL',
    ],
    'hooks': {
        'port': 123,
        'microvmHooks': {
            'run': 'DISABLED'|'ENABLED',
            'runTimeoutInSeconds': 123,
            'resume': 'DISABLED'|'ENABLED',
            'resumeTimeoutInSeconds': 123,
            'suspend': 'DISABLED'|'ENABLED',
            'suspendTimeoutInSeconds': 123,
            'terminate': 'DISABLED'|'ENABLED',
            'terminateTimeoutInSeconds': 123
        },
        'microvmImageHooks': {
            'ready': 'DISABLED'|'ENABLED',
            'readyTimeoutInSeconds': 123,
            'validate': 'DISABLED'|'ENABLED',
            'validateTimeoutInSeconds': 123
        }
    },
    'environmentVariables': {
        'string': 'string'
    },
    'tags': {
        'string': 'string'
    },
    'updatedAt': datetime(2015, 1, 1),
    'imageVersion': 'string'
}

Response Structure

  • (dict) –

    • imageArn (string) –

      The ARN of the created MicroVM image.

    • name (string) –

      The name of the MicroVM image.

    • state (string) –

      The current state of the MicroVM image.

    • latestActiveImageVersion (string) –

      The latest active version of the MicroVM image.

    • latestFailedImageVersion (string) –

      The latest failed version of the MicroVM image, if any.

    • createdAt (datetime) –

      The timestamp when the MicroVM image was created.

    • baseImageArn (string) –

      The ARN of the base MicroVM image.

    • baseImageVersion (string) –

      The specific version of the base MicroVM image.

    • buildRoleArn (string) –

      The ARN of the IAM build role.

    • description (string) –

      The description of the MicroVM image.

    • codeArtifact (dict) –

      The code artifact containing the application code and metadata for the MicroVM image.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: uri. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • uri (string) –

        The URI of the code artifact, such as an Amazon S3 path or Amazon ECR image URI.

    • logging (dict) –

      The logging configuration for build-time and runtime logs. Specify {“cloudWatch”: {“logGroup”: “…”}} to stream logs to a custom CloudWatch log group, or {“disabled”: {}} to turn off logging.

      Note

      This is a Tagged Union structure. Only one of the following top level keys will be set: disabled, cloudWatch. If a client receives an unknown member it will set SDK_UNKNOWN_MEMBER as the top level key, which maps to the name or tag of the unknown member. The structure of SDK_UNKNOWN_MEMBER is as follows:

      'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
      
      • disabled (dict) –

        Specifies that logging is disabled.

      • cloudWatch (dict) –

        Configuration for sending logs to Amazon CloudWatch Logs.

        • logGroup (string) –

          The name of the CloudWatch Logs log group to send logs to.

        • logStream (string) –

          The name of the CloudWatch Logs log stream within the log group.

    • egressNetworkConnectors (list) –

      The list of egress network connectors available to the MicroVM at runtime.

      • (string) –

    • cpuConfigurations (list) –

      The list of supported CPU configurations for the MicroVM.

      • (dict) –

        Configuration for the CPU architecture of a MicroVM.

        • architecture (string) –

          The CPU architecture.

    • resources (list) –

      The resource requirements for the MicroVM.

      • (dict) –

        Resource requirements for a MicroVM.

        • minimumMemoryInMiB (integer) –

          The minimum amount of memory in MiB to allocate to the MicroVM.

    • additionalOsCapabilities (list) –

      Additional OS capabilities granted to the MicroVM runtime environment.

      • (string) –

        Capability granted to the application when booted

    • hooks (dict) –

      Lifecycle hook configuration for MicroVMs and MicroVM images.

      • port (integer) –

        The port number on which the hooks listener runs.

      • microvmHooks (dict) –

        The lifecycle hooks for MicroVM events.

        • run (string) –

          The path of the hook invoked when the MicroVM starts running.

        • runTimeoutInSeconds (integer) –

          The maximum time in seconds for the run hook to complete.

        • resume (string) –

          The path of the hook invoked when the MicroVM resumes from a suspended state.

        • resumeTimeoutInSeconds (integer) –

          The maximum time in seconds for the resume hook to complete.

        • suspend (string) –

          The path of the hook invoked when the MicroVM is suspended.

        • suspendTimeoutInSeconds (integer) –

          The maximum time in seconds for the suspend hook to complete.

        • terminate (string) –

          The path of the hook invoked when the MicroVM is terminated.

        • terminateTimeoutInSeconds (integer) –

          The maximum time in seconds for the terminate hook to complete.

      • microvmImageHooks (dict) –

        The hooks for MicroVM image build events.

        • ready (string) –

          The path of the hook invoked when the MicroVM image build is ready.

        • readyTimeoutInSeconds (integer) –

          The maximum time in seconds for the ready hook to complete.

        • validate (string) –

          The path of the hook invoked to validate the MicroVM image build.

        • validateTimeoutInSeconds (integer) –

          The maximum time in seconds for the validate hook to complete.

    • environmentVariables (dict) –

      Environment variables set in the MicroVM runtime environment.

      • (string) –

        • (string) –

    • tags (dict) –

      A set of key-value pairs that you can attach to the resource. Use tags to categorize resources for cost allocation, access control (ABAC), and organization.

      • (string) –

        • (string) –

    • updatedAt (datetime) –

      The timestamp when the MicroVM image was last updated.

    • imageVersion (string) –

      The version of the MicroVM image.

Exceptions

  • LambdaMicroVMs.Client.exceptions.InternalServerException

  • LambdaMicroVMs.Client.exceptions.AccessDeniedException

  • LambdaMicroVMs.Client.exceptions.ResourceNotFoundException

  • LambdaMicroVMs.Client.exceptions.ThrottlingException

  • LambdaMicroVMs.Client.exceptions.ConflictException

  • LambdaMicroVMs.Client.exceptions.ValidationException

  • LambdaMicroVMs.Client.exceptions.ServiceQuotaExceededException