aws-cdk

AWS CDK: fixed logical ids

六眼飞鱼酱① 提交于 2020-08-23 05:01:10
问题 Currently logical ID of a resource is formed by concatenating the names of all of the constructs in the resource’s path and appending an eight-character MD5 hash. This produces garbage like VpcPrivateSubnet1DefaultRouteBE02A9ED and unfortunatelly makes it unable to query the resources by their logical id. Is there any way to control how logical ids are named? 回答1: In TypeScript the method you are looking for is overrideLogicalId . But you have to get the lower level CfnVpc construct first by

How to create VPC that can be shared across stacks?

霸气de小男生 提交于 2020-08-22 10:54:14
问题 I am trying to wrap my head around how to create a reusable VPC that can be used across multiple stacks using AWS CDK. I want to be able to create different stack per project and then be able to import the VPC that should be assigned to the different stacks. I also want to create this using a good structure where I can deploy different stacks at different times (meaning: I do not want to deploy all stacks at once). I have tried the following approach but this will create a new VPC per stack

How to create VPC that can be shared across stacks?

岁酱吖の 提交于 2020-08-22 10:53:18
问题 I am trying to wrap my head around how to create a reusable VPC that can be used across multiple stacks using AWS CDK. I want to be able to create different stack per project and then be able to import the VPC that should be assigned to the different stacks. I also want to create this using a good structure where I can deploy different stacks at different times (meaning: I do not want to deploy all stacks at once). I have tried the following approach but this will create a new VPC per stack

How to import existing VPC in aws cdk?

最后都变了- 提交于 2020-08-19 04:58:01
问题 Hi I am working on aws cdk. I am trying to get existing non-default vpc. I tried below options. vpc = ec2.Vpc.from_lookup(self, id = "VPC", vpc_id='vpcid', vpc_name='vpc-dev') This results in below error [Error at /LocationCdkStack-cdkstack] Request has expired. [Warning at /LocationCdkStack-cdkstack/TaskDef/mw-service] Proper policies need to be attached before pulling from ECR repository, or use 'fromEcrRepository'. Found errors Other method I tried is vpc = ec2.Vpc.from_vpc_attributes(self

How to import existing VPC in aws cdk?

这一生的挚爱 提交于 2020-08-19 04:56:36
问题 Hi I am working on aws cdk. I am trying to get existing non-default vpc. I tried below options. vpc = ec2.Vpc.from_lookup(self, id = "VPC", vpc_id='vpcid', vpc_name='vpc-dev') This results in below error [Error at /LocationCdkStack-cdkstack] Request has expired. [Warning at /LocationCdkStack-cdkstack/TaskDef/mw-service] Proper policies need to be attached before pulling from ECR repository, or use 'fromEcrRepository'. Found errors Other method I tried is vpc = ec2.Vpc.from_vpc_attributes(self

use existing vpc and security group when adding an ec2 instance

血红的双手。 提交于 2020-08-04 08:00:07
问题 There is lots of example code, but the rapidly improving cdk package isn't helping me find working examples of some (I thought) simple things. eg., even an import I found in an example fails: import { VpcNetworkRef } from '@aws-cdk/aws-ec2'; error TS2724: Module '"../node_modules/@aws-cdk/aws-ec2/lib"' has no exported member 'VpcNetworkRef'. Did you mean 'IVpcNetwork'? Why does the example ec2 code not show creation of raw ec2 instances? WHAT would help is example cdk code that uses hardcoded

On aws-rds on aws-cdk, where is the setting to make database publicly accessible?

大憨熊 提交于 2020-06-14 06:28:09
问题 With AWS RDS, the console and the CLI/API both have a switch to make the database publicly accessible, but I cannot find a way to do this with the new aws-cdk using the constructs provided. There is a boolean for this in the Cloud Formation classes (e.g. CfnDBInstance), but I can't find documentation on how to use that in combination with the constructs. The CDK is pretty amazing, and it set up everything perfectly with just a few lines of code, except for this one piece. 回答1: Whether the