Skip to content
v2.275.0

Experimental

@aws-cdk/aws-imagebuilder-alpha is an experimental (alpha) package: its API may change in any release, without a major version bump.

S3DockerfileData Class ​

Helper class for S3-based dockerfile data references, containing additional permission grant methods on the S3 object.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as imagebuilder_alpha from '@aws-cdk/aws-imagebuilder-alpha';
import * as cdk from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_kms as interfaces_kms } from 'aws-cdk-lib/interfaces';

declare const dockerImage: cdk.DockerImage;
declare const grantable: iam.IGrantable;
declare const keyRef: interfaces_kms.IKeyRef;
declare const localBundling: cdk.ILocalBundling;
const s3DockerfileData = imagebuilder_alpha.S3DockerfileData.fromAsset(this, 'MyS3DockerfileData', 'path', /* all optional props */ {
  assetHash: 'assetHash',
  assetHashType: cdk.AssetHashType.SOURCE,
  bundling: {
    image: dockerImage,

    // the properties below are optional
    bundlingFileAccess: cdk.BundlingFileAccess.VOLUME_COPY,
    command: ['command'],
    entrypoint: ['entrypoint'],
    environment: {
      environmentKey: 'environment',
    },
    local: localBundling,
    network: 'network',
    outputType: cdk.BundlingOutput.ARCHIVED,
    platform: 'platform',
    securityOpt: 'securityOpt',
    user: 'user',
    volumes: [{
      containerPath: 'containerPath',
      hostPath: 'hostPath',

      // the properties below are optional
      consistency: cdk.DockerVolumeConsistency.CONSISTENT,
    }],
    volumesFrom: ['volumesFrom'],
    workingDirectory: 'workingDirectory',
  },
  deployTime: false,
  displayName: 'displayName',
  exclude: ['exclude'],
  followSymlinks: cdk.SymlinkFollowMode.NEVER,
  ignoreMode: cdk.IgnoreMode.GLOB,
  readers: [grantable],
  sourceKMSKey: keyRef,
});

Methods ​

fromAsset(scope: Construct, id: string, path: string, options?: AssetOptions): S3DockerfileData // chainable@staticmethod def from_asset(scope: Construct, id: str, path: str, options: typing.Optional[AssetOptions] = None) -> S3DockerfileDatapublic static S3DockerfileData fromAsset(Construct scope, String id, String path, AssetOptions options)public static S3DockerfileData FromAsset(Construct scope, string id, string path, AssetOptions? options = null)func FromAsset(Scope Construct, Id *string, Path *string, Options AssetOptions) S3DockerfileDatastatic#
Uploads dockerfile data from a local file to S3 to use as the dockerfile data.
4 parameters

Parameters

  • scopescopescopescopeScope — The construct scope.
  • ididididId — Identifier of the construct.
  • pathpathpathpathPath — The local path to the dockerfile data file.
  • optionsoptionsoptionsoptionsOptions — S3 asset upload options.
fromInline(data: string): DockerfileData@staticmethod def from_inline(data: str) -> DockerfileDatapublic static DockerfileData fromInline(String data)public static DockerfileData FromInline(string data)func FromInline(Data *string) DockerfileDatastatic#
Uses an inline string as the dockerfile data.
1 parameter

Parameters

  • datadatadatadataData — An inline string representing the dockerfile data.
fromS3(bucket: IBucket, key: string): S3DockerfileData // chainable@staticmethod def from_s3(bucket: IBucket, key: str) -> S3DockerfileDatapublic static S3DockerfileData fromS3(IBucket bucket, String key)public static S3DockerfileData FromS3(IBucket bucket, string key)func FromS3(Bucket IBucket, Key *string) S3DockerfileDatastatic#
References dockerfile data from a pre-existing S3 object.
2 parameters

Parameters

  • bucketbucketbucketbucketBucket — The S3 bucket where the dockerfile data is stored.
  • keykeykeykeyKey — The S3 key of the dockerfile data file.
grantPut(grantee: IGrantable): Grantdef grant_put(self, grantee: IGrantable) -> Grantpublic Grant grantPut(IGrantable grantee)public Grant GrantPut(IGrantable grantee)func GrantPut(Grantee IGrantable) Grant#
Grant put permissions to the given grantee for the dockerfile data in S3 [disable-awslint:no-grants].
1 parameter

Parameters

  • granteegranteegranteegranteeGrantee — The principal.
grantRead(grantee: IGrantable): Grantdef grant_read(self, grantee: IGrantable) -> Grantpublic Grant grantRead(IGrantable grantee)public Grant GrantRead(IGrantable grantee)func GrantRead(Grantee IGrantable) Grant#
Grant read permissions to the given grantee for the dockerfile data in S3 [disable-awslint:no-grants].
1 parameter

Parameters

  • granteegranteegranteegranteeGrantee — The principal.
render(): DockerfileTemplateConfigdef render(self, ) -> DockerfileTemplateConfigpublic DockerfileTemplateConfig render()public DockerfileTemplateConfig Render()func Render() DockerfileTemplateConfig#
The rendered Dockerfile S3 URL, for use in CloudFormation.