S3Code Class
S3 bucket path to the code zip file.
Example
ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_synthetics as synthetics } from 'aws-cdk-lib';
import { aws_s3 as interfaces_s3 } from 'aws-cdk-lib/interfaces';
declare const bucketRef: interfaces_s3.IBucketRef;
const s3Code = new synthetics.S3Code(bucketRef, 'key', /* all optional props */ 'objectVersion');
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_synthetics as synthetics
from aws_cdk.interfaces import aws_s3 as interfaces_s3
# bucket_ref: interfaces_s3.IBucketRef
s3_code = synthetics.S3Code(bucket_ref, "key", "objectVersion")
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.synthetics.*;
import software.amazon.awscdk.interfaces.s3.*;
IBucketRef bucketRef;
S3Code s3Code = new S3Code(bucketRef, "key", "objectVersion");
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.Synthetics;
using Amazon.CDK.Interfaces.S3;
IBucketRef bucketRef;
var s3Code = new S3Code(bucketRef, "key", "objectVersion");
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"
var bucketRef IBucketRef
s3Code := awscdk.Aws_synthetics.NewS3Code(bucketRef, jsii.String("key"), jsii.String("objectVersion"))
Initializer
ts
new S3Code(bucket: IBucketRef, key: string, objectVersion?: string)
python
S3Code(bucket: IBucketRef, key: str, object_version: typing.Optional[str] = None)
java
new S3Code(IBucketRef bucket, String key, String objectVersion)
csharp
new S3Code(IBucketRef bucket, string key, string? objectVersion = null)
go
NewS3Code(Bucket IBucketRef, Key *string, ObjectVersion *string)
Methods
bind(_scope: Construct, _handler: string, _family: RuntimeFamily, _runtimeName?: string): CodeConfigdef bind(self, _scope: Construct, _handler: str, _family: RuntimeFamily, _runtime_name: typing.Optional[str] = None) -> CodeConfigpublic CodeConfig bind(Construct _scope, String _handler, RuntimeFamily _family, String _runtimeName)public CodeConfig Bind(Construct _scope, string _handler, RuntimeFamily _family, string? _runtimeName = null)func Bind(_scope Construct, _handler *string, _family RuntimeFamily, _runtimeName *string) CodeConfig#Called when the canary is initialized to allow this object to bind to the stack, add resources and have fun.
fromAsset(assetPath: string, options?: AssetOptions): AssetCode@staticmethod def from_asset(asset_path: str, options: typing.Optional[AssetOptions] = None) -> AssetCodepublic static AssetCode fromAsset(String assetPath, AssetOptions options)public static AssetCode FromAsset(string assetPath, AssetOptions? options = null)func FromAsset(AssetPath *string, Options AssetOptions) AssetCodestatic#Specify code from a local path.
Path must include the folder structure nodejs/node_modules/myCanaryFilename.js.
1 parameter · returns
Parameters
assetPathasset_pathassetPathassetPathAssetPath— Either a directory or a .zip file.
Returns: AssetCode associated with the specified path.
fromBucket(bucket: IBucketRef, key: string, objectVersion?: string): S3Code // chainable@staticmethod def from_bucket(bucket: IBucketRef, key: str, object_version: typing.Optional[str] = None) -> S3Codepublic static S3Code fromBucket(IBucketRef bucket, String key, String objectVersion)public static S3Code FromBucket(IBucketRef bucket, string key, string? objectVersion = null)func FromBucket(Bucket IBucketRef, Key *string, ObjectVersion *string) S3Codestatic#Specify code from an s3 bucket.
The object in the s3 bucket must be a .zip file that contains the structure nodejs/node_modules/myCanaryFilename.js.
3 parameters · returns
Parameters
bucketbucketbucketbucketBucket— The S3 bucket.keykeykeykeyKey— The object key.objectVersionobject_versionobjectVersionobjectVersionObjectVersion— Optional S3 object version.
Returns: S3Code associated with the specified S3 object.
fromInline(code: string): InlineCode@staticmethod def from_inline(code: str) -> InlineCodepublic static InlineCode fromInline(String code)public static InlineCode FromInline(string code)func FromInline(Code *string) InlineCodestatic#Specify code inline.
1 parameter · returns
Parameters
codecodecodecodeCode— The actual handler code (limited to 5MB).
Returns: InlineCode with inline code.