Readonly
autoReadonly
certificateReadonly
listenerReadonly
loadReadonly
nodeThe tree node.
Readonly
targetReadonly
vpcStatic
isChecks if x
is a construct.
Use this method instead of instanceof
to properly detect Construct
instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs
library on
disk are seen as independent, completely different libraries. As a
consequence, the class Construct
in each copy of the constructs
library
is seen as a different class, and an instance of one class will not test as
instanceof
the other class. npm install
will not create installations
like this, but users may manually symlink construct libraries together or
use a monorepo tool: in those cases, multiple copies of the constructs
library can be accidentally installed, and instanceof
will behave
unpredictably. It is safest to avoid using instanceof
, and using
this type-testing method instead.
true if x
is an object created from a class which extends Construct
.
Any object
Generated using TypeDoc
Pattern which creates the resources needed to run an application on EC2 instances. For convenience, you may wish to use [[
GuPlayApp
]] or [[GuNodeApp
]], which extend this class.This pattern will grant your EC2 instances a number of commonly needed IAM permissions. For more information on this, see [[
GuInstanceRole
]]. To add additional permissions to your EC2 instances, see [[GuEc2AppProps
]].This pattern will automatically create security groups/rules which allow for:
AppAccess
]] specified).Example usage for a public facing app (open to the internet):
Example usage for an app which is restricted to specific CIDR ranges:
Varying values by stage
There are times when you want a resource's configuration to be stage aware, for example the number of instances in an ASG.
To do this, we can use a simple ternary:
If multiple properties need to be stage aware, consider encoding this into the
props
of the calling class:If you must support a non-standard VPC setup, it's possible to override the VPC and subnet selection into which instances will be started. You need to set the three props below in order for this to work: vpc: this must be an IVpc instance indicating the VPC to deploy into (usually obtained from
Vpc.fromVpcAttributes
) privateSubnets: a list of ISubnet indicating the subnets for the autoscaling group to deploy instances into (usually obtained fromGuVpc.subnets
) publicSubnets: a list of ISubnet indicating the subnets for the loadbalancer to use, if the loadbalancer is intended for public access (usually obtained fromGuVpc.subnets
) On the other hand, if the access is private, then an "internal" loadbalancer is used in theprivateSubnets
list. Please note that no checking is applied to the subnet lists to ensure that they correspond to the vpc given; as an advanced feature it is assumed that the caller ensures this. If the subnets are mismatched then the resulting Cloudformation will fail to deploy.Customising the infrastructure generated by this pattern
Although we allow users to customise many aspects of their infrastructure via [[
GuEc2AppProps
]], it's possible that there are less common use-cases which are currently unsupported via the API. In these circumstances escape hatches can be used to override specific resources in the stack.In order to do this: