Bases: Code
Represents a Docker image in ECR that can be bound as Lambda Code.
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_ecr as ecr import aws_cdk.aws_lambda as lambda_ # repository: ecr.Repository ecr_image_code = lambda_.EcrImageCode(repository, cmd=["cmd"], entrypoint=["entrypoint"], tag="tag", tag_or_digest="tagOrDigest", working_directory="workingDirectory" )
repository (IRepository
)
cmd (Optional
[Sequence
[str
]]) â Specify or override the CMD on the specified Docker image or Dockerfile. This needs to be in the âexec formâ, viz., [ 'executable', 'param1', 'param2' ]
. Default: - use the CMD specified in the docker image or Dockerfile.
entrypoint (Optional
[Sequence
[str
]]) â Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile. An ENTRYPOINT allows you to configure a container that will run as an executable. This needs to be in the âexec formâ, viz., [ 'executable', 'param1', 'param2' ]
. Default: - use the ENTRYPOINT in the docker image or Dockerfile.
tag (Optional
[str
]) â (deprecated) The image tag to use when pulling the image from ECR. Default: âlatestâ
tag_or_digest (Optional
[str
]) â The image tag or digest to use when pulling the image from ECR (digests must start with sha256:
). Default: âlatestâ
working_directory (Optional
[str
]) â Specify or override the WORKDIR on the specified Docker image or Dockerfile. A WORKDIR allows you to configure the working directory the container will use. Default: - use the WORKDIR in the docker image or Dockerfile.
Methods
Called when the lambda or layer is initialized to allow this object to bind to the stack, add resources and have fun.
_
Called after the CFN function resource has been created to allow the code class to bind to it.
Specifically itâs required to allow assets to add metadata for tooling like SAM CLI to be able to find their origins.
_resource (CfnResource
)
resource_property (Optional
[str
]) â The name of the CloudFormation property to annotate with asset metadata. Default: Code
None
Attributes
Determines whether this Code is inline code or not.
Static Methods
(deprecated) DEPRECATED.
path (str
)
use fromAsset
deprecated
(deprecated) DEPRECATED.
(deprecated) DEPRECATED.
bucket_name_param (Optional
[CfnParameter
]) â The CloudFormation parameter that represents the name of the S3 Bucket where the Lambda code will be located in. Must be of type âStringâ. Default: a new parameter will be created
object_key_param (Optional
[CfnParameter
]) â The CloudFormation parameter that represents the path inside the S3 Bucket where the Lambda code will be located at. Must be of type âStringâ. Default: a new parameter will be created
use fromCfnParameters
deprecated
Loads the function code from a local disk path.
path (str
) â Either a directory with the Lambda code bundle or a .zip file.
readers (Optional
[Sequence
[IGrantable
]]) â A list of principals that should be able to read this asset from S3. You can use asset.grantRead(principal)
to grant read permissions later. Default: - No principals that can read file asset.
source_hash (Optional
[str
]) â (deprecated) Custom hash to use when identifying the specific version of the asset. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the source hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the source hash, you will need to make sure it is updated every time the source changes, or otherwise it is possible that some deployments will not be invalidated. Default: - automatically calculate source hash based on the contents of the source file or directory.
exclude (Optional
[Sequence
[str
]]) â (deprecated) Glob patterns to exclude from the copy. Default: nothing is excluded
follow (Optional
[FollowMode
]) â (deprecated) A strategy for how to handle symlinks. Default: Never
ignore_mode (Optional
[IgnoreMode
]) â (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the â
follow_symlinks (Optional
[SymlinkFollowMode
]) â A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER
asset_hash (Optional
[str
]) â Specify a custom hash for this asset. If assetHashType
is set it must be set to AssetHashType.CUSTOM
. For consistency, this custom hash will be SHA256 hashed and encoded as hex. The resulting hash will be the asset hash. NOTE: the hash is used in order to identify a specific revision of the asset, and used for optimizing and caching deployment activities related to this asset such as packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will need to make sure it is updated every time the asset changes, or otherwise it is possible that some deployments will not be invalidated. Default: - based on assetHashType
asset_hash_type (Optional
[AssetHashType
]) â Specifies the type of hash to calculate for this asset. If assetHash
is configured, this option must be undefined
or AssetHashType.CUSTOM
. Default: - the default is AssetHashType.SOURCE
, but if assetHash
is explicitly specified this value defaults to AssetHashType.CUSTOM
.
bundling (Union
[BundlingOptions
, Dict
[str
, Any
], None
]) â Bundle the asset by executing a command in a Docker container or a custom bundling provider. The asset path will be mounted at /asset-input
. The Docker container is responsible for putting content at /asset-output
. The content at /asset-output
will be zipped and used as the final asset. Default: - uploaded as-is to S3 if the asset is a regular file or a .zip file, archived into a .zip file and uploaded to S3 otherwise
Create an ECR image from the specified asset and bind it as the Lambda code.
directory (str
) â the directory from which the asset must be created.
cmd (Optional
[Sequence
[str
]]) â Specify or override the CMD on the specified Docker image or Dockerfile. This needs to be in the âexec formâ, viz., [ 'executable', 'param1', 'param2' ]
. Default: - use the CMD specified in the docker image or Dockerfile.
entrypoint (Optional
[Sequence
[str
]]) â Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile. An ENTRYPOINT allows you to configure a container that will run as an executable. This needs to be in the âexec formâ, viz., [ 'executable', 'param1', 'param2' ]
. Default: - use the ENTRYPOINT in the docker image or Dockerfile.
working_directory (Optional
[str
]) â Specify or override the WORKDIR on the specified Docker image or Dockerfile. A WORKDIR allows you to configure the working directory the container will use. Default: - use the WORKDIR in the docker image or Dockerfile.
build_args (Optional
[Mapping
[str
, str
]]) â Build args to pass to the docker build
command. Since Docker build arguments are resolved before deployment, keys and values cannot refer to unresolved tokens (such as lambda.functionArn
or queue.queueUrl
). Default: - no build args are passed
file (Optional
[str
]) â Path to the Dockerfile (relative to the directory). Default: âDockerfileâ
invalidation (Union
[DockerImageAssetInvalidationOptions
, Dict
[str
, Any
], None
]) â Options to control which parameters are used to invalidate the asset hash. Default: - hash all parameters
network_mode (Optional
[NetworkMode
]) â Networking mode for the RUN commands during build. Support docker API 1.25+. Default: - no networking mode specified (the default networking mode NetworkMode.DEFAULT
will be used)
platform (Optional
[Platform
]) â Platform to build for. Requires Docker Buildx. Default: - no platform specified (the current machine architecture will be used)
repository_name (Optional
[str
]) â (deprecated) ECR repository name. Specify this property if you need to statically address the image, e.g. from a Kubernetes Pod. Note, this is only the repository name, without the registry and the tag parts. Default: - the default ECR repository for CDK assets
target (Optional
[str
]) â Docker target to build to. Default: - no target
extra_hash (Optional
[str
]) â (deprecated) Extra information to encode into the fingerprint (e.g. build instructions and other inputs). Default: - hash is only based on source content
exclude (Optional
[Sequence
[str
]]) â (deprecated) Glob patterns to exclude from the copy. Default: nothing is excluded
follow (Optional
[FollowMode
]) â (deprecated) A strategy for how to handle symlinks. Default: Never
ignore_mode (Optional
[IgnoreMode
]) â (deprecated) The ignore behavior to use for exclude patterns. Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the â
follow_symlinks (Optional
[SymlinkFollowMode
]) â A strategy for how to handle symlinks. Default: SymlinkFollowMode.NEVER
Lambda handler code as an S3 object.
Creates a new Lambda source defined using CloudFormation parameters.
bucket_name_param (Optional
[CfnParameter
]) â The CloudFormation parameter that represents the name of the S3 Bucket where the Lambda code will be located in. Must be of type âStringâ. Default: a new parameter will be created
object_key_param (Optional
[CfnParameter
]) â The CloudFormation parameter that represents the path inside the S3 Bucket where the Lambda code will be located at. Must be of type âStringâ. Default: a new parameter will be created
a new instance of CfnParametersCode
Loads the function code from an asset created by a Docker build.
By default, the asset is expected to be located at /asset
in the image.
path (str
) â The path to the directory containing the Docker file.
image_path (Optional
[str
]) â The path in the Docker image where the asset is located after the build operation. Default: /asset
output_path (Optional
[str
]) â The path on the local filesystem where the asset will be copied using docker cp
. Default: - a unique temporary directory in the system temp directory
build_args (Optional
[Mapping
[str
, str
]]) â Build args. Default: - no build args
file (Optional
[str
]) â Name of the Dockerfile, must relative to the docker build path. Default: Dockerfile
platform (Optional
[str
]) â Set platform if server is multi-platform capable. Requires Docker Engine API v1.38+. Example value: linux/amd64
Default: - no platform specified
Use an existing ECR image as the Lambda code.
repository (IRepository
) â the ECR repository that the image is in.
cmd (Optional
[Sequence
[str
]]) â Specify or override the CMD on the specified Docker image or Dockerfile. This needs to be in the âexec formâ, viz., [ 'executable', 'param1', 'param2' ]
. Default: - use the CMD specified in the docker image or Dockerfile.
entrypoint (Optional
[Sequence
[str
]]) â Specify or override the ENTRYPOINT on the specified Docker image or Dockerfile. An ENTRYPOINT allows you to configure a container that will run as an executable. This needs to be in the âexec formâ, viz., [ 'executable', 'param1', 'param2' ]
. Default: - use the ENTRYPOINT in the docker image or Dockerfile.
tag (Optional
[str
]) â (deprecated) The image tag to use when pulling the image from ECR. Default: âlatestâ
tag_or_digest (Optional
[str
]) â The image tag or digest to use when pulling the image from ECR (digests must start with sha256:
). Default: âlatestâ
working_directory (Optional
[str
]) â Specify or override the WORKDIR on the specified Docker image or Dockerfile. A WORKDIR allows you to configure the working directory the container will use. Default: - use the WORKDIR in the docker image or Dockerfile.
Inline code for Lambda handler.
code (str
) â The actual handler code (limited to 4KiB).
LambdaInlineCode
with inline code.
(deprecated) DEPRECATED.
code (str
)
use fromInline
deprecated
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4