1개 답변
- 최신
- 최다 투표
- 가장 많은 댓글
0
Hi,
To be transparent, I did not try this on your specific use case: lambda + sec group. But, I usually use CDK Construct.fromXXX() to achieve what you want to achieve here.
The section "How can I reference existing resources?" in this article https://garbe.io/blog/2019/09/20/hey-cdk-how-to-use-existing-resources/ explains it well with all possible options for "fromXXX()" with their differences.
It seems quite possible , see https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.SecurityGroup.html
If you have an existing security group you want to use in your CDK application, you would import it like this:
const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'SG', 'sg-12345', {
mutable: false
});
Best,
Didier
관련 콘텐츠
- AWS 공식업데이트됨 2년 전
- AWS 공식업데이트됨 일 년 전