aws-cdk-lib.aws_ec2.InitElement

class InitElement

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

Implemented by InitCommand, InitGroup, InitPackage, InitService, InitUser

Base class for all CloudFormation Init elements.

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

Initializer

new InitElement()

Properties

NameTypeDescription
elementTypestringReturns the init element type for this element.

elementType

Type: string

Returns the init element type for this element.