aws-cdk-lib.aws_ec2.InitFileOptions

interface InitFileOptions

LanguageType name
.NETAmazon.CDK.AWS.EC2.InitFileOptions
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsec2#InitFileOptions
Javasoftware.amazon.awscdk.services.ec2.InitFileOptions
Pythonaws_cdk.aws_ec2.InitFileOptions
TypeScript (source)aws-cdk-lib » aws_ec2 » InitFileOptions

Options for InitFile.

Example

declare const myBucket: s3.Bucket;

const handle = new ec2.InitServiceRestartHandle();

ec2.CloudFormationInit.fromElements(
  ec2.InitFile.fromString('/etc/nginx/nginx.conf', '...', { serviceRestartHandles: [handle] }),
  ec2.InitSource.fromS3Object('/var/www/html', myBucket, 'html.zip', { serviceRestartHandles: [handle] }),
  ec2.InitService.enable('nginx', {
    serviceRestartHandle: handle,
  })
);

Properties

NameTypeDescription
base64Encoded?booleanTrue if the inlined content (from a string or file) should be treated as base64 encoded.
group?stringThe name of the owning group for this file.
mode?stringA six-digit octal value representing the mode for this file.
owner?stringThe name of the owning user for this file.
serviceRestartHandles?InitServiceRestartHandle[]Restart the given service after this file has been written.

base64Encoded?

Type: boolean (optional, default: false)

True if the inlined content (from a string or file) should be treated as base64 encoded.

Only applicable for inlined string and file content.


group?

Type: string (optional, default: 'root')

The name of the owning group for this file.

Not supported for Windows systems.


mode?

Type: string (optional, default: '000644')

A six-digit octal value representing the mode for this file.

Use the first three digits for symlinks and the last three digits for setting permissions. To create a symlink, specify 120xxx, where xxx defines the permissions of the target file. To specify permissions for a file, use the last three digits, such as 000644.

Not supported for Windows systems.


owner?

Type: string (optional, default: 'root')

The name of the owning user for this file.

Not supported for Windows systems.


serviceRestartHandles?

Type: InitServiceRestartHandle[] (optional, default: Do not restart any service)

Restart the given service after this file has been written.