Skip to content

Resource: awsStoragegatewayGateway

Manages an AWS Storage Gateway file, tape, or volume gateway in the provider region.

\~> NOTE: The Storage Gateway API requires the gateway to be connected to properly return information after activation. If you are receiving theSpecifiedGatewayIsNotConnected errors during resource creation (gateway activation), ensure your gateway instance meets the Storage Gateway requirements.

Example Usage

Local Cache

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.volumeAttachment.VolumeAttachment(this, "test", {
  deviceName: "/dev/xvdb",
  instanceId: "${aws_instance.test.id}",
  volumeId: "${aws_ebs_volume.test.id}",
});
const dataAwsStoragegatewayLocalDiskTest =
  new aws.dataAwsStoragegatewayLocalDisk.DataAwsStoragegatewayLocalDisk(
    this,
    "test_1",
    {
      diskNode: "${data.aws_volume_attachment.test.device_name}",
      gatewayArn: "${aws_storagegateway_gateway.test.arn}",
    }
  );
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
dataAwsStoragegatewayLocalDiskTest.overrideLogicalId("test");
const awsStoragegatewayCacheTest =
  new aws.storagegatewayCache.StoragegatewayCache(this, "test_2", {
    diskId: dataAwsStoragegatewayLocalDiskTest.diskId,
    gatewayArn: "${aws_storagegateway_gateway.test.arn}",
  });
/*This allows the Terraform resource name to match the original name. You can remove the call if you don't need them to match.*/
awsStoragegatewayCacheTest.overrideLogicalId("test");

FSx File Gateway

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.storagegatewayGateway.StoragegatewayGateway(this, "example", {
  gatewayIpAddress: "1.2.3.4",
  gatewayName: "example",
  gatewayTimezone: "GMT",
  gatewayType: "FILE_FSX_SMB",
  smbActiveDirectorySettings: {
    domainName: "corp.example.com",
    password: "avoid-plaintext-passwords",
    username: "Admin",
  },
});

S3 File Gateway

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.storagegatewayGateway.StoragegatewayGateway(this, "example", {
  gatewayIpAddress: "1.2.3.4",
  gatewayName: "example",
  gatewayTimezone: "GMT",
  gatewayType: "FILE_S3",
});

Tape Gateway

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.storagegatewayGateway.StoragegatewayGateway(this, "example", {
  gatewayIpAddress: "1.2.3.4",
  gatewayName: "example",
  gatewayTimezone: "GMT",
  gatewayType: "VTL",
  mediumChangerType: "AWS-Gateway-VTL",
  tapeDriveType: "IBM-ULT3580-TD5",
});

Volume Gateway (Cached)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.storagegatewayGateway.StoragegatewayGateway(this, "example", {
  gatewayIpAddress: "1.2.3.4",
  gatewayName: "example",
  gatewayTimezone: "GMT",
  gatewayType: "CACHED",
});

Volume Gateway (Stored)

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
new aws.storagegatewayGateway.StoragegatewayGateway(this, "example", {
  gatewayIpAddress: "1.2.3.4",
  gatewayName: "example",
  gatewayTimezone: "GMT",
  gatewayType: "STORED",
});

Argument Reference

\~> NOTE: One of activationKey or gatewayIpAddress must be provided for resource creation (gateway activation). Neither is required for resource import. If using gatewayIpAddress, Terraform must be able to make an HTTP (port 80) GET request to the specified IP address from where it is running.

The following arguments are supported:

  • gatewayName - (Required) Name of the gateway.
  • gatewayTimezone - (Required) Time zone for the gateway. The time zone is of the format "GMT", "GMT-hr:mm", or "GMT+hr:mm". For example, gmt4:00 indicates the time is 4 hours behind GMT. The time zone is used, for example, for scheduling snapshots and your gateway's maintenance schedule.
  • activationKey - (Optional) Gateway activation key during resource creation. Conflicts with gatewayIpAddress. Additional information is available in the Storage Gateway User Guide.
  • averageDownloadRateLimitInBitsPerSec - (Optional) The average download bandwidth rate limit in bits per second. This is supported for the cached, stored, and vtl gateway types.
  • averageUploadRateLimitInBitsPerSec - (Optional) The average upload bandwidth rate limit in bits per second. This is supported for the cached, stored, and vtl gateway types.
  • gatewayIpAddress - (Optional) Gateway IP address to retrieve activation key during resource creation. Conflicts with activationKey. Gateway must be accessible on port 80 from where Terraform is running. Additional information is available in the Storage Gateway User Guide.
  • gatewayType - (Optional) Type of the gateway. The default value is stored. Valid values: cached, FILE_FSX_SMB, FILE_S3, stored, vtl.
  • gatewayVpcEndpoint - (Optional) VPC endpoint address to be used when activating your gateway. This should be used when your instance is in a private subnet. Requires HTTP access from client computer running terraform. More info on what ports are required by your VPC Endpoint Security group in Activating a Gateway in a Virtual Private Cloud.
  • cloudwatchLogGroupArn - (Optional) The Amazon Resource Name (ARN) of the Amazon CloudWatch log group to use to monitor and log events in the gateway.
  • maintenanceStartTime - (Optional) The gateway's weekly maintenance start time information, including day and time of the week. The maintenance time is the time in your gateway's time zone. More details below.
  • mediumChangerType - (Optional) Type of medium changer to use for tape gateway. Terraform cannot detect drift of this argument. Valid values: stkL700, awsGatewayVtl, ibm03584L320402.
  • smbActiveDirectorySettings - (Optional) Nested argument with Active Directory domain join information for Server Message Block (SMB) file shares. Only valid for FILE_S3 and FILE_FSX_SMB gateway types. Must be set before creating activeDirectory authentication SMB file shares. More details below.
  • smbGuestPassword - (Optional) Guest password for Server Message Block (SMB) file shares. Only valid for FILE_S3 and FILE_FSX_SMB gateway types. Must be set before creating guestAccess authentication SMB file shares. Terraform can only detect drift of the existence of a guest password, not its actual value from the gateway. Terraform can however update the password with changing the argument.
  • smbSecurityStrategy - (Optional) Specifies the type of security strategy. Valid values are: clientSpecified, mandatorySigning, and mandatoryEncryption. See Setting a Security Level for Your Gateway for more information.
  • smbFileShareVisibility - (Optional) Specifies whether the shares on this gateway appear when listing shares.
  • tapeDriveType - (Optional) Type of tape drive to use for tape gateway. Terraform cannot detect drift of this argument. Valid values: ibmUlt3580Td5.
  • tags - (Optional) Key-value map of resource tags. If configured with a provider defaultTags configuration block present, tags with matching keys will overwrite those defined at the provider-level.

maintenanceStartTime

  • dayOfMonth - (Optional) The day of the month component of the maintenance start time represented as an ordinal number from 1 to 28, where 1 represents the first day of the month and 28 represents the last day of the month.
  • dayOfWeek - (Optional) The day of the week component of the maintenance start time week represented as an ordinal number from 0 to 6, where 0 represents Sunday and 6 Saturday.
  • hourOfDay - (Required) The hour component of the maintenance start time represented as hh, where hh is the hour (00 to 23). The hour of the day is in the time zone of the gateway.
  • minuteOfHour - (Required) The minute component of the maintenance start time represented as mm, where mm is the minute (00 to 59). The minute of the hour is in the time zone of the gateway.

smbActiveDirectorySettings

Information to join the gateway to an Active Directory domain for Server Message Block (SMB) file shares.

\~> NOTE It is not possible to unconfigure this setting without recreating the gateway. Also, Terraform can only detect drift of the domainName argument from the gateway.

\~> NOTE: The Storage Gateway needs to be able to resolve the name of your Active Directory Domain Controller. If the gateway is hosted on EC2, ensure that DNS/DHCP is configured prior to creating the EC2 instance. If you are receiving NETWORK_ERROR errors during resource creation (gateway joining the domain), ensure your gateway instance meets the FSx File Gateway requirements.

  • domainName - (Required) The name of the domain that you want the gateway to join.
  • password - (Required) The password of the user who has permission to add the gateway to the Active Directory domain.
  • username - (Required) The user name of user who has permission to add the gateway to the Active Directory domain.
  • timeoutInSeconds - (Optional) Specifies the time in seconds, in which the JoinDomain operation must complete. The default is 20 seconds.
  • organizationalUnit - (Optional) The organizational unit (OU) is a container in an Active Directory that can hold users, groups, computers, and other OUs and this parameter specifies the OU that the gateway will join within the AD domain.
  • domainControllers - (Optional) List of IPv4 addresses, NetBIOS names, or host names of your domain server. If you need to specify the port number include it after the colon (“:”). For example, mydcMydomainCom:389.

Attributes Reference

In addition to all arguments above, the following attributes are exported:

  • id - Amazon Resource Name (ARN) of the gateway.
  • arn - Amazon Resource Name (ARN) of the gateway.
  • gatewayId - Identifier of the gateway.
  • ec2InstanceId - The ID of the Amazon EC2 instance that was used to launch the gateway.
  • endpointType - The type of endpoint for your gateway.
  • hostEnvironment - The type of hypervisor environment used by the host.
  • gatewayNetworkInterface - An array that contains descriptions of the gateway network interfaces. See Gateway Network Interface.
  • tagsAll - A map of tags assigned to the resource, including those inherited from the provider defaultTags configuration block.

Gateway Network Interface

  • ipv4Address - The Internet Protocol version 4 (IPv4) address of the interface.

Timeouts

Configuration options:

  • create - (Default 10M)

Import

awsStoragegatewayGateway can be imported by using the gateway Amazon Resource Name (ARN), e.g.,

$ terraform import aws_storagegateway_gateway.example arn:aws:storagegateway:us-east-1:123456789012:gateway/sgw-12345678

Certain resource arguments, like gatewayIpAddress do not have a Storage Gateway API method for reading the information after creation, either omit the argument from the Terraform configuration or use ignoreChanges to hide the difference, e.g.,

/*Provider bindings are generated by running cdktf get.
See https://cdk.tf/provider-generation for more details.*/
import * as aws from "./.gen/providers/aws";
const awsStoragegatewayGatewayExample =
  new aws.storagegatewayGateway.StoragegatewayGateway(this, "example", {
    gatewayIpAddress: "${aws_instance.sgw.private_ip}",
  });
awsStoragegatewayGatewayExample.addOverride("lifecycle", [
  {
    ignore_changes: ["gateway_ip_address"],
  },
]);