Skip to content
v2.274.0

InitElement Class ​

Base class for all CloudFormation Init elements.

Example ​

ts
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,
  })
);

Initializer ​

ts
new InitElement()
python
InitElement()
java
new InitElement()
csharp
new InitElement()
go
NewInitElement()

Properties ​

elementTypestringelement_typestrelementTypeStringElementTypestringElementType*string#
Returns the init element type for this element.