Class: AWSCDK::ECS::CfnTaskDefinition::VolumeProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
ecs/cfn_task_definition.rb

Overview

The data volume configuration for tasks launched using this task definition.

Specifying a volume configuration in a task definition is optional. The volume configuration may contain multiple volumes but only one volume configured at launch is supported. Each volume defined in the volume configuration may only specify a name and one of either configured_at_launch , docker_volume_configuration , efs_volume_configuration , fsx_windows_file_server_volume_configuration , or host . If an empty volume configuration is specified, by default Amazon ECS uses a host volume. For more information, see Using data volumes in tasks .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(configured_at_launch: nil, docker_volume_configuration: nil, efs_volume_configuration: nil, f_sx_windows_file_server_volume_configuration: nil, host: nil, name: nil, s3_files_volume_configuration: nil) ⇒ VolumeProperty

Returns a new instance of VolumeProperty.

Parameters:



3484
3485
3486
3487
3488
3489
3490
3491
3492
3493
3494
3495
3496
3497
3498
3499
# File 'ecs/cfn_task_definition.rb', line 3484

def initialize(configured_at_launch: nil, docker_volume_configuration: nil, efs_volume_configuration: nil, f_sx_windows_file_server_volume_configuration: nil, host: nil, name: nil, s3_files_volume_configuration: nil)
  @configured_at_launch = configured_at_launch
  Jsii::Type.check_type(@configured_at_launch, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3sicHJpbWl0aXZlIjoiYm9vbGVhbiJ9LHsiZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifV19fQ==")), "configuredAtLaunch") unless @configured_at_launch.nil?
  @docker_volume_configuration = docker_volume_configuration.is_a?(Hash) ? ::AWSCDK::ECS::CfnTaskDefinition::DockerVolumeConfigurationProperty.new(**docker_volume_configuration.transform_keys(&:to_sym)) : docker_volume_configuration
  Jsii::Type.check_type(@docker_volume_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuVGFza0RlZmluaXRpb24uRG9ja2VyVm9sdW1lQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "dockerVolumeConfiguration") unless @docker_volume_configuration.nil?
  @efs_volume_configuration = efs_volume_configuration.is_a?(Hash) ? ::AWSCDK::ECS::CfnTaskDefinition::EFSVolumeConfigurationProperty.new(**efs_volume_configuration.transform_keys(&:to_sym)) : efs_volume_configuration
  Jsii::Type.check_type(@efs_volume_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuVGFza0RlZmluaXRpb24uRUZTVm9sdW1lQ29uZmlndXJhdGlvblByb3BlcnR5In1dfX0=")), "efsVolumeConfiguration") unless @efs_volume_configuration.nil?
  @f_sx_windows_file_server_volume_configuration = f_sx_windows_file_server_volume_configuration.is_a?(Hash) ? ::AWSCDK::ECS::CfnTaskDefinition::FSXWindowsFileServerVolumeConfigurationProperty.new(**f_sx_windows_file_server_volume_configuration.transform_keys(&:to_sym)) : f_sx_windows_file_server_volume_configuration
  Jsii::Type.check_type(@f_sx_windows_file_server_volume_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuVGFza0RlZmluaXRpb24uRlN4V2luZG93c0ZpbGVTZXJ2ZXJWb2x1bWVDb25maWd1cmF0aW9uUHJvcGVydHkifV19fQ==")), "fSxWindowsFileServerVolumeConfiguration") unless @f_sx_windows_file_server_volume_configuration.nil?
  @host = host.is_a?(Hash) ? ::AWSCDK::ECS::CfnTaskDefinition::HostVolumePropertiesProperty.new(**host.transform_keys(&:to_sym)) : host
  Jsii::Type.check_type(@host, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuVGFza0RlZmluaXRpb24uSG9zdFZvbHVtZVByb3BlcnRpZXNQcm9wZXJ0eSJ9XX19")), "host") unless @host.nil?
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name") unless @name.nil?
  @s3_files_volume_configuration = s3_files_volume_configuration.is_a?(Hash) ? ::AWSCDK::ECS::CfnTaskDefinition::S3FilesVolumeConfigurationProperty.new(**s3_files_volume_configuration.transform_keys(&:to_sym)) : s3_files_volume_configuration
  Jsii::Type.check_type(@s3_files_volume_configuration, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19lY3MuQ2ZuVGFza0RlZmluaXRpb24uUzNGaWxlc1ZvbHVtZUNvbmZpZ3VyYXRpb25Qcm9wZXJ0eSJ9XX19")), "s3FilesVolumeConfiguration") unless @s3_files_volume_configuration.nil?
end

Instance Attribute Details

#configured_at_launchBoolean, ... (readonly)

Indicates whether the volume should be configured at launch time.

This is used to create Amazon EBS volumes for standalone tasks or tasks created as part of a service. Each task definition revision may only have one volume configured at launch in the volume configuration.

To configure a volume at launch time, use this task definition revision and specify a volume_configurations object when calling the CreateService , UpdateService , RunTask or StartTask APIs.



3509
3510
3511
# File 'ecs/cfn_task_definition.rb', line 3509

def configured_at_launch
  @configured_at_launch
end

#docker_volume_configurationAWSCDK::IResolvable, ... (readonly)

This parameter is specified when you use Docker volumes.

Windows containers only support the use of the local driver. To use bind mounts, specify the host parameter instead.

Docker volumes aren't supported by tasks run on AWS Fargate .



3518
3519
3520
# File 'ecs/cfn_task_definition.rb', line 3518

def docker_volume_configuration
  @docker_volume_configuration
end

#efs_volume_configurationAWSCDK::IResolvable, ... (readonly)

This parameter is specified when you use an Amazon Elastic File System file system for task storage.



3523
3524
3525
# File 'ecs/cfn_task_definition.rb', line 3523

def efs_volume_configuration
  @efs_volume_configuration
end

#f_sx_windows_file_server_volume_configurationAWSCDK::IResolvable, ... (readonly)

This parameter is specified when you use Amazon FSx for Windows File Server file system for task storage.



3528
3529
3530
# File 'ecs/cfn_task_definition.rb', line 3528

def f_sx_windows_file_server_volume_configuration
  @f_sx_windows_file_server_volume_configuration
end

#hostAWSCDK::IResolvable, ... (readonly)

This parameter is specified when you use bind mount host volumes.

The contents of the host parameter determine whether your bind mount host volume persists on the host container instance and where it's stored. If the host parameter is empty, then the Docker daemon assigns a host path for your data volume. However, the data isn't guaranteed to persist after the containers that are associated with it stop running.

Windows containers can mount whole directories on the same drive as $env:ProgramData . Windows containers can't mount directories on a different drive, and mount point can't be across drives. For example, you can mount C:\my\path:C:\my\path and D:\:D:\ , but not D:\my\path:C:\my\path or D:\:C:\my\path .



3537
3538
3539
# File 'ecs/cfn_task_definition.rb', line 3537

def host
  @host
end

#nameString? (readonly)

The name of the volume. Up to 255 letters (uppercase and lowercase), numbers, underscores, and hyphens are allowed.

When using a volume configured at launch, the name is required and must also be specified as the volume name in the ServiceVolumeConfiguration or TaskVolumeConfiguration parameter when creating your service or standalone task.

For all other types of volumes, this name is referenced in the source_volume parameter of the mount_points object in the container definition.

When a volume is using the efs_volume_configuration , the name is required.



3548
3549
3550
# File 'ecs/cfn_task_definition.rb', line 3548

def name
  @name
end

#s3_files_volume_configurationAWSCDK::IResolvable, ... (readonly)

This parameter is specified when you're using an Amazon S3 Files file system for task storage.

For more information, see Amazon S3 Files volumes in the Amazon Elastic Container Service Developer Guide. Your task definition must include a Task IAM Role. See IAM role for attaching your file system to compute resources for required permissions.



3556
3557
3558
# File 'ecs/cfn_task_definition.rb', line 3556

def s3_files_volume_configuration
  @s3_files_volume_configuration
end

Class Method Details

.jsii_propertiesObject



3558
3559
3560
3561
3562
3563
3564
3565
3566
3567
3568
# File 'ecs/cfn_task_definition.rb', line 3558

def self.jsii_properties
  {
    :configured_at_launch => "configuredAtLaunch",
    :docker_volume_configuration => "dockerVolumeConfiguration",
    :efs_volume_configuration => "efsVolumeConfiguration",
    :f_sx_windows_file_server_volume_configuration => "fSxWindowsFileServerVolumeConfiguration",
    :host => "host",
    :name => "name",
    :s3_files_volume_configuration => "s3FilesVolumeConfiguration",
  }
end

Instance Method Details

#to_jsiiObject



3570
3571
3572
3573
3574
3575
3576
3577
3578
3579
3580
3581
3582
# File 'ecs/cfn_task_definition.rb', line 3570

def to_jsii
  result = {}
  result.merge!({
    "configuredAtLaunch" => @configured_at_launch,
    "dockerVolumeConfiguration" => @docker_volume_configuration,
    "efsVolumeConfiguration" => @efs_volume_configuration,
    "fSxWindowsFileServerVolumeConfiguration" => @f_sx_windows_file_server_volume_configuration,
    "host" => @host,
    "name" => @name,
    "s3FilesVolumeConfiguration" => @s3_files_volume_configuration,
  })
  result.compact
end