Skip to content

Commit

Permalink
fixing readme
Browse files Browse the repository at this point in the history
  • Loading branch information
shikha372 committed Dec 18, 2024
1 parent 6001172 commit 7ce35b2
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions packages/@aws-cdk/aws-ec2-alpha/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -645,3 +645,22 @@ SubnetV2.fromSubnetV2Attributes(this, 'ImportedSubnet', {
```

By importing existing VPCs and subnets, you can easily integrate your existing AWS infrastructure with new resources created through CDK. This is particularly useful when you need to work with pre-existing network configurations or when you're migrating existing infrastructure to CDK.

### Tagging VPC and its components

By default, when a resource name is given to the construct, it automatically adds a tag with the key `Name` and the value set to the provided resource name. To add additional custom tags, use the Tag Manager, like this: `Tags.of(myConstruct).add('key', 'value');`.

For example, if the `vpcName` is set to `TestVpc`, the following code will add a tag to the VPC with `key: Name` and `value: TestVpc`.

```ts

const vpc = new VpcV2(this, 'VPC-integ-test-tag', {
primaryAddressBlock: IpAddresses.ipv4('10.1.0.0/16'),
enableDnsHostnames: true,
enableDnsSupport: true,
vpcName: 'CDKintegTestVPC',
});

// Add custom tags if needed
Tags.of(vpc).add('Environment', 'Production');
```
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-ec2-alpha/rosetta/default.ts-fixture
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Fixture with packages imported, but nothing else
import { Construct } from 'constructs';
import { Stack, App, Fn } from 'aws-cdk-lib';
import { Stack, App, Fn, Tags } from 'aws-cdk-lib';
import { VpcV2, SubnetV2, IpAddresses, IpamPoolPublicIpSource, RouteTable, InternetGateway, Route, NatGateway, EgressOnlyInternetGateway, VPCPeeringConnection } from '@aws-cdk/aws-ec2-alpha';
import { Ipam, AwsServiceName, IpCidr, AddressFamily } from '@aws-cdk/aws-ec2-alpha';
import { NatConnectivityType } from '@aws-cdk/aws-ec2-alpha';
Expand Down

0 comments on commit 7ce35b2

Please sign in to comment.