You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> NOTE: This is a reduced version of #8788, which is the full
CloudFormation-init support. This has been reduced down to only support
instances (not ASGs), and to only support the InitCommand and InitService init
elements, rather than the full set. This is to reduce the PR size and encourage
a more thorough review. A follow-up review will add the remainder of the
elements and auto-scaling group support.
Add CloudFormation-init support.
The CloudFormation-init metadata is encapsulated in a CloudFormationInit object,
and using it automatically renders the UserData to apply it and send a signal to
the appropriate CloudFormation resource and adds the permissions required to use
cfn-init, cfn-signal and any S3 files/assets to the instance role.
On an Instance, using CloudFormation-init automatically adds a ResourceSignal
with a default timeout to the instance.
Note this currently also includes the same changes as #9063, as this relies on it. #9063 can be independently shipped.
----
*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
A VPC endpoint enables you to privately connect your VPC to supported AWS services and VPC endpoint services powered by PrivateLink without requiring an internet gateway, NAT device, VPN connection, or AWS Direct Connect connection. Instances in your VPC do not require public IP addresses to communicate with resources in the service. Traffic between your VPC and the other service does not leave the Amazon network.
559
562
560
563
Endpoints are virtual devices. They are horizontally scaled, redundant, and highly available VPC components that allow communication between instances in your VPC and services without imposing availability risks or bandwidth constraints on your network traffic.
561
564
562
565
[example of setting up VPC endpoints](test/integ.vpc-endpoint.lit.ts)
563
566
564
-
By default, CDK will place a VPC endpoint in one subnet per AZ. If you wish to override the AZs CDK places the VPC endpoint in,
567
+
By default, CDK will place a VPC endpoint in one subnet per AZ. If you wish to override the AZs CDK places the VPC endpoint in,
565
568
use the `subnets` parameter as follows:
566
569
567
570
```ts
@@ -591,7 +594,8 @@ new InterfaceVpcEndpoint(stack, 'VPC Endpoint', {
591
594
});
592
595
```
593
596
594
-
### Security groups for interface VPC endpoints
597
+
#### Security groups for interface VPC endpoints
598
+
595
599
By default, interface VPC endpoints create a new security group and traffic is **not**
Alternatively, existing security groups can be used by specifying the `securityGroups` prop.
605
609
606
-
## VPC endpoint services
610
+
### VPC endpoint services
611
+
607
612
A VPC endpoint service enables you to expose a Network Load Balancer(s) as a provider service to consumers, who connect to your service over a VPC endpoint. You can restrict access to your service via whitelisted principals (anything that extends ArnPrincipal), and require that new connections be manually accepted.
608
613
609
614
```ts
@@ -614,17 +619,69 @@ new VpcEndpointService(this, 'EndpointService', {
614
619
});
615
620
```
616
621
617
-
## Bastion Hosts
622
+
## Instances
623
+
624
+
You can use the `Instance` class to start up a single EC2 instance. For production setups, we recommend
625
+
you use an `AutoScalingGroup` from the `aws-autoscaling` module instead, as AutoScalingGroups will take
626
+
care of restarting your instance if it ever fails.
627
+
628
+
### Configuring Instances using CloudFormation Init (cfn-init)
629
+
630
+
CloudFormation Init allows you to configure your instances by writing files to them, installing software
631
+
packages, starting services and running arbitrary commands. By default, if any of the instance setup
632
+
commands throw an error, the deployment will fail and roll back to the previously known good state.
633
+
The following documentation also applies to `AutoScalingGroup`s.
634
+
635
+
For the full set of capabilities of this system, see the documentation for
A bastion host functions as an instance used to access servers and resources in a VPC without open up the complete VPC on a network level.
619
674
You can use bastion hosts using a standard SSH connection targetting port 22 on the host. As an alternative, you can connect the SSH connection
620
675
feature of AWS Systems Manager Session Manager, which does not need an opened security group. (https://aws.amazon.com/about-aws/whats-new/2019/07/session-manager-launches-tunneling-support-for-ssh-and-scp/)
621
676
622
677
A default bastion host for use via SSM can be configured like:
@@ -649,7 +707,7 @@ EBS volume for the bastion host can be encrypted like:
649
707
});
650
708
```
651
709
652
-
## Block Devices
710
+
###Block Devices
653
711
654
712
To add EBS block device mappings, specify the `blockDeviceMappings` property. The follow example sets the EBS-backed
655
713
root device (`/dev/sda1`) size to 50 GiB, and adds another EBS-backed device mapped to `/dev/sdm` that is 100 GiB in
@@ -672,7 +730,7 @@ new ec2.Instance(this, 'Instance', {
672
730
673
731
```
674
732
675
-
## Volumes
733
+
###Volumes
676
734
677
735
Whereas a `BlockDeviceVolume` is an EBS volume that is created and destroyed as part of the creation and destruction of a specific instance. A `Volume` is for when you want an EBS volume separate from any particular instance. A `Volume` is an EBS block device that can be attached to, or detached from, any instance at any time. Some types of `Volume`s can also be attached to multiple instances at the same time to allow you to have shared storage between those instances.
If you need to grant an instance the ability to attach/detach an EBS volume to/from itself, then using `grantAttachVolume` and `grantDetachVolume` as outlined above
702
760
will lead to an unresolvable circular reference between the instance role and the instance. In this case, use `grantAttachVolumeByResourceTag` and `grantDetachVolumeByResourceTag` as follows:
VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. Flow log data can be published to Amazon CloudWatch Logs and Amazon S3. After you've created a flow log, you can retrieve and view its data in the chosen destination. (https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html).
802
+
803
+
VPC Flow Logs is a feature that enables you to capture information about the IP traffic going to and from network interfaces in your VPC. Flow log data can be published to Amazon CloudWatch Logs and Amazon S3. After you've created a flow log, you can retrieve and view its data in the chosen destination. (<https://docs.aws.amazon.com/vpc/latest/userguide/flow-logs.html>).
745
804
746
805
By default a flow log will be created with CloudWatch Logs as the destination.
747
806
@@ -752,6 +811,7 @@ new ec2.FlowLog(this, 'FlowLog', {
0 commit comments