InitFileOptions

class aws_cdk.aws_ec2.InitFileOptions(*, base64_encoded=None, group=None, mode=None, owner=None, service_restart_handles=None)

Bases: object

Options for InitFile.

Parameters
  • base64_encoded (Optional[bool]) – True if the inlined content (from a string or file) should be treated as base64 encoded. Only applicable for inlined string and file content. Default: false

  • group (Optional[str]) – The name of the owning group for this file. Not supported for Windows systems. Default: ‘root’

  • mode (Optional[str]) – 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. Default: ‘000644’

  • owner (Optional[str]) – The name of the owning user for this file. Not supported for Windows systems. Default: ‘root’

  • service_restart_handles (Optional[Sequence[InitServiceRestartHandle]]) – Restart the given service after this file has been written. Default: - Do not restart any service

Example:

# my_bucket is of type Bucket


handle = ec2.InitServiceRestartHandle()

ec2.CloudFormationInit.from_elements(
    ec2.InitFile.from_string("/etc/nginx/nginx.conf", "...", service_restart_handles=[handle]),
    ec2.InitSource.from_s3_object("/var/www/html", my_bucket, "html.zip", service_restart_handles=[handle]),
    ec2.InitService.enable("nginx",
        service_restart_handle=handle
    ))

Attributes

base64_encoded

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

Only applicable for inlined string and file content.

Default

false

Return type

Optional[bool]

group

The name of the owning group for this file.

Not supported for Windows systems.

Default

‘root’

Return type

Optional[str]

mode

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.

Default

‘000644’

Return type

Optional[str]

owner

The name of the owning user for this file.

Not supported for Windows systems.

Default

‘root’

Return type

Optional[str]

service_restart_handles

Restart the given service after this file has been written.

Default
  • Do not restart any service

Return type

Optional[List[InitServiceRestartHandle]]