Module: AWSCDK::EC2::IInstance

Includes:
IConnectable, IAM::IGrantable, IResource, Interfaces::AWSEC2::IInstanceRef
Included in:
BastionHostLinux, Instance
Defined in:
ec2/i_instance.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.jsii_overridable_methodsObject



137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'ec2/i_instance.rb', line 137

def self.jsii_overridable_methods
  {
    :node => { kind: :property, name: "node", is_optional: false },
    :env => { kind: :property, name: "env", is_optional: false },
    :stack => { kind: :property, name: "stack", is_optional: false },
    :connections => { kind: :property, name: "connections", is_optional: false },
    :grant_principal => { kind: :property, name: "grantPrincipal", is_optional: false },
    :instance_ref => { kind: :property, name: "instanceRef", is_optional: false },
    :instance_availability_zone => { kind: :property, name: "instanceAvailabilityZone", is_optional: false },
    :instance_id => { kind: :property, name: "instanceId", is_optional: false },
    :instance_private_dns_name => { kind: :property, name: "instancePrivateDnsName", is_optional: false },
    :instance_private_ip => { kind: :property, name: "instancePrivateIp", is_optional: false },
    :instance_public_dns_name => { kind: :property, name: "instancePublicDnsName", is_optional: false },
    :instance_public_ip => { kind: :property, name: "instancePublicIp", is_optional: false },
    :with => { kind: :method, name: "with", is_optional: false },
    :apply_removal_policy => { kind: :method, name: "applyRemovalPolicy", is_optional: false },
  }
end

Instance Method Details

#apply_removal_policy(policy) ⇒ void

This method returns an undefined value.

Apply the given removal policy to this resource.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters:



132
133
134
135
# File 'ec2/i_instance.rb', line 132

def apply_removal_policy(policy)
  Jsii::Type.check_type(policy, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJhd3MtY2RrLWxpYi5SZW1vdmFsUG9saWN5In0=")), "policy")
  jsii_call_method("applyRemovalPolicy", [policy])
end

#connectionsAWSCDK::EC2::Connections

The network connections associated with this resource.



42
43
44
# File 'ec2/i_instance.rb', line 42

def connections()
  jsii_get_property("connections")
end

#envAWSCDK::Interfaces::ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.

For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.



28
29
30
# File 'ec2/i_instance.rb', line 28

def env()
  jsii_get_property("env")
end

#grant_principalAWSCDK::IAM::IPrincipal

The principal to grant permissions to.



49
50
51
# File 'ec2/i_instance.rb', line 49

def grant_principal()
  jsii_get_property("grantPrincipal")
end

#instance_availability_zoneString

The availability zone the instance was launched in.

Returns:

  • (String)


63
64
65
# File 'ec2/i_instance.rb', line 63

def instance_availability_zone()
  jsii_get_property("instanceAvailabilityZone")
end

#instance_idString

The instance's ID.

Returns:

  • (String)


70
71
72
# File 'ec2/i_instance.rb', line 70

def instance_id()
  jsii_get_property("instanceId")
end

#instance_private_dns_nameString

Private DNS name for this instance.

Returns:

  • (String)


77
78
79
# File 'ec2/i_instance.rb', line 77

def instance_private_dns_name()
  jsii_get_property("instancePrivateDnsName")
end

#instance_private_ipString

Private IP for this instance.

Returns:

  • (String)


84
85
86
# File 'ec2/i_instance.rb', line 84

def instance_private_ip()
  jsii_get_property("instancePrivateIp")
end

#instance_public_dns_nameString

Publicly-routable DNS name for this instance.

(May be an empty string if the instance does not have a public name).

Returns:

  • (String)


93
94
95
# File 'ec2/i_instance.rb', line 93

def instance_public_dns_name()
  jsii_get_property("instancePublicDnsName")
end

#instance_public_ipString

Publicly-routable IP address for this instance.

(May be an empty string if the instance does not have a public IP).

Returns:

  • (String)


102
103
104
# File 'ec2/i_instance.rb', line 102

def instance_public_ip()
  jsii_get_property("instancePublicIp")
end

#instance_refAWSCDK::Interfaces::AWSEC2::InstanceReference

A reference to a Instance resource.



56
57
58
# File 'ec2/i_instance.rb', line 56

def instance_ref()
  jsii_get_property("instanceRef")
end

#nodeConstructs::Node

The tree node.

Returns:

  • (Constructs::Node)


13
14
15
# File 'ec2/i_instance.rb', line 13

def node()
  jsii_get_property("node")
end

#stackAWSCDK::Stack

The stack in which this resource is defined.

Returns:



35
36
37
# File 'ec2/i_instance.rb', line 35

def stack()
  jsii_get_property("stack")
end

#with(*mixins) ⇒ Constructs::IConstruct

Applies one or more mixins to this construct.

Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited.

Parameters:

  • mixins (Array<Constructs::IMixin>)

    The mixins to apply.

Returns:

  • (Constructs::IConstruct)

    This construct for chaining



113
114
115
116
117
118
# File 'ec2/i_instance.rb', line 113

def with(*mixins)
  mixins.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJmcW4iOiJjb25zdHJ1Y3RzLklNaXhpbiJ9")), "mixins[#{index}]")
  end
  jsii_call_method("with", [*mixins])
end