Skip to content

Commit

Permalink
adding readme changes
Browse files Browse the repository at this point in the history
  • Loading branch information
shikha372 committed Dec 17, 2024
1 parent 6001172 commit 0f7f0ff
Showing 1 changed file with 19 additions and 0 deletions.
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 vpc_v2.VpcV2(stack, 'VPC-integ-test-tag', {
primaryAddressBlock: vpc_v2.IpAddresses.ipv4('10.1.0.0/16'),
enableDnsHostnames: true,
enableDnsSupport: true,
vpcName: 'CDKintegTestVPC',
});

// Add custom tags if needed
Tags.of(vpc).add('Environment', 'Production');
```

0 comments on commit 0f7f0ff

Please sign in to comment.