- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
摘要
我正在尝试使用 CDK 在 AWS 上部署 Redis ElastiCache 集群。
出于安全原因,我希望集群位于 VPC 内。
我的代码(参见上文)定义了一个 VPC、一个安全组、一个缓存子网组(链接到 vpc 私有(private)子网)和缓存集群(链接到缓存子网组和安全组)。
使用cdk部署
,部署进展顺利,直到我收到此错误:
ACL_redis (ACLredis) Subnet group [default] belongs to a different VPC [vpc-326ce55b] than [vpc-0c45b593f3a5fdc4d] (Service: AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 901398f4-c355-418d-921b-65e6c52dfe3a)
我尝试过的
禁用回滚时,缓存集群似乎是在该区域的默认 VPC 中创建的,而不是在我的堆栈中定义的 VPC 中创建的。我不明白为什么 Cloud Formation 会这样做,因为安全组和缓存子网组都链接到堆栈的 VPC。
根本没有提及区域默认 VPC。
一些代码
这是CDK代码
from aws_cdk import (
core,
aws_stepfunctions,
aws_lambda,
aws_stepfunctions_tasks,
aws_sqs,
aws_elasticache,
aws_ec2,
)
PROJECT_CODE = 'ACL'
class AclAwsCdkLearningStack(core.Stack):
def __init__(self, scope: core.Construct, id: str, **kwargs) -> None:
super().__init__(scope, id, **kwargs)
vpc = aws_ec2.Vpc(self, f"{PROJECT_CODE}_vpc",
cidr="10.0.0.0/16"
)
security_group = aws_ec2.SecurityGroup(
scope=self,
id=f"{PROJECT_CODE}_security_group",
vpc=vpc,
)
private_subnets_ids = [ps.subnet_id for ps in vpc.private_subnets]
cache_subnet_group = aws_elasticache.CfnSubnetGroup(
scope=self,
id=f"{PROJECT_CODE}_cache_subnet_group",
subnet_ids=private_subnets_ids, # todo: add list of subnet ids here
description="subnet group for redis",
)
redis_cluster = aws_elasticache.CfnCacheCluster(
scope=self,
id=f"{PROJECT_CODE}_redis",
engine="redis",
cache_node_type="cache.t2.small",
num_cache_nodes=1,
cache_subnet_group_name=cache_subnet_group.cache_subnet_group_name,
vpc_security_group_ids=[security_group.security_group_id],
)
redis_cluster.add_depends_on(cache_subnet_group)
以下是生成的 JSON CloudFormation 代码:
{
"Resources": {
"ACLvpcAC1CD0C2": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"EnableDnsHostnames": true,
"EnableDnsSupport": true,
"InstanceTenancy": "default",
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/Resource"
}
},
"ACLvpcPublicSubnet1SubnetAB5536F8": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.0.0/19",
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"AvailabilityZone": "eu-west-3a",
"MapPublicIpOnLaunch": true,
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1"
},
{
"Key": "aws-cdk:subnet-name",
"Value": "Public"
},
{
"Key": "aws-cdk:subnet-type",
"Value": "Public"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1/Subnet"
}
},
"ACLvpcPublicSubnet1RouteTable973DCC99": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1/RouteTable"
}
},
"ACLvpcPublicSubnet1RouteTableAssociation07D70069": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPublicSubnet1RouteTable973DCC99"
},
"SubnetId": {
"Ref": "ACLvpcPublicSubnet1SubnetAB5536F8"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1/RouteTableAssociation"
}
},
"ACLvpcPublicSubnet1DefaultRoute5F1B7BC7": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPublicSubnet1RouteTable973DCC99"
},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "ACLvpcIGWA284CC51"
}
},
"DependsOn": [
"ACLvpcVPCGWA01262F1"
],
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1/DefaultRoute"
}
},
"ACLvpcPublicSubnet1EIP0233C01E": {
"Type": "AWS::EC2::EIP",
"Properties": {
"Domain": "vpc",
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1/EIP"
}
},
"ACLvpcPublicSubnet1NATGateway7D889FAC": {
"Type": "AWS::EC2::NatGateway",
"Properties": {
"AllocationId": {
"Fn::GetAtt": [
"ACLvpcPublicSubnet1EIP0233C01E",
"AllocationId"
]
},
"SubnetId": {
"Ref": "ACLvpcPublicSubnet1SubnetAB5536F8"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet1/NATGateway"
}
},
"ACLvpcPublicSubnet2Subnet1243F1B8": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.32.0/19",
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"AvailabilityZone": "eu-west-3b",
"MapPublicIpOnLaunch": true,
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2"
},
{
"Key": "aws-cdk:subnet-name",
"Value": "Public"
},
{
"Key": "aws-cdk:subnet-type",
"Value": "Public"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2/Subnet"
}
},
"ACLvpcPublicSubnet2RouteTableBFA33E2A": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2/RouteTable"
}
},
"ACLvpcPublicSubnet2RouteTableAssociation0E367E2F": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPublicSubnet2RouteTableBFA33E2A"
},
"SubnetId": {
"Ref": "ACLvpcPublicSubnet2Subnet1243F1B8"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2/RouteTableAssociation"
}
},
"ACLvpcPublicSubnet2DefaultRoute6918C2C0": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPublicSubnet2RouteTableBFA33E2A"
},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "ACLvpcIGWA284CC51"
}
},
"DependsOn": [
"ACLvpcVPCGWA01262F1"
],
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2/DefaultRoute"
}
},
"ACLvpcPublicSubnet2EIPBB2E0F7F": {
"Type": "AWS::EC2::EIP",
"Properties": {
"Domain": "vpc",
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2/EIP"
}
},
"ACLvpcPublicSubnet2NATGatewayA823B2BD": {
"Type": "AWS::EC2::NatGateway",
"Properties": {
"AllocationId": {
"Fn::GetAtt": [
"ACLvpcPublicSubnet2EIPBB2E0F7F",
"AllocationId"
]
},
"SubnetId": {
"Ref": "ACLvpcPublicSubnet2Subnet1243F1B8"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet2/NATGateway"
}
},
"ACLvpcPublicSubnet3Subnet74DB8A91": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.64.0/19",
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"AvailabilityZone": "eu-west-3c",
"MapPublicIpOnLaunch": true,
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3"
},
{
"Key": "aws-cdk:subnet-name",
"Value": "Public"
},
{
"Key": "aws-cdk:subnet-type",
"Value": "Public"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3/Subnet"
}
},
"ACLvpcPublicSubnet3RouteTable48D5C590": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3/RouteTable"
}
},
"ACLvpcPublicSubnet3RouteTableAssociation6304EEEC": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPublicSubnet3RouteTable48D5C590"
},
"SubnetId": {
"Ref": "ACLvpcPublicSubnet3Subnet74DB8A91"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3/RouteTableAssociation"
}
},
"ACLvpcPublicSubnet3DefaultRoute5ED7E66D": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPublicSubnet3RouteTable48D5C590"
},
"DestinationCidrBlock": "0.0.0.0/0",
"GatewayId": {
"Ref": "ACLvpcIGWA284CC51"
}
},
"DependsOn": [
"ACLvpcVPCGWA01262F1"
],
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3/DefaultRoute"
}
},
"ACLvpcPublicSubnet3EIP2A75DA44": {
"Type": "AWS::EC2::EIP",
"Properties": {
"Domain": "vpc",
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3/EIP"
}
},
"ACLvpcPublicSubnet3NATGateway88BC6345": {
"Type": "AWS::EC2::NatGateway",
"Properties": {
"AllocationId": {
"Fn::GetAtt": [
"ACLvpcPublicSubnet3EIP2A75DA44",
"AllocationId"
]
},
"SubnetId": {
"Ref": "ACLvpcPublicSubnet3Subnet74DB8A91"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PublicSubnet3/NATGateway"
}
},
"ACLvpcPrivateSubnet1SubnetB88404CC": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.96.0/19",
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"AvailabilityZone": "eu-west-3a",
"MapPublicIpOnLaunch": false,
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet1"
},
{
"Key": "aws-cdk:subnet-name",
"Value": "Private"
},
{
"Key": "aws-cdk:subnet-type",
"Value": "Private"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet1/Subnet"
}
},
"ACLvpcPrivateSubnet1RouteTable52EFE8B4": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet1"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet1/RouteTable"
}
},
"ACLvpcPrivateSubnet1RouteTableAssociation07BBA734": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPrivateSubnet1RouteTable52EFE8B4"
},
"SubnetId": {
"Ref": "ACLvpcPrivateSubnet1SubnetB88404CC"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet1/RouteTableAssociation"
}
},
"ACLvpcPrivateSubnet1DefaultRoute1D5645F3": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPrivateSubnet1RouteTable52EFE8B4"
},
"DestinationCidrBlock": "0.0.0.0/0",
"NatGatewayId": {
"Ref": "ACLvpcPublicSubnet1NATGateway7D889FAC"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet1/DefaultRoute"
}
},
"ACLvpcPrivateSubnet2Subnet63321773": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.128.0/19",
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"AvailabilityZone": "eu-west-3b",
"MapPublicIpOnLaunch": false,
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet2"
},
{
"Key": "aws-cdk:subnet-name",
"Value": "Private"
},
{
"Key": "aws-cdk:subnet-type",
"Value": "Private"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet2/Subnet"
}
},
"ACLvpcPrivateSubnet2RouteTable66EECACC": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet2"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet2/RouteTable"
}
},
"ACLvpcPrivateSubnet2RouteTableAssociationB47D85D6": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPrivateSubnet2RouteTable66EECACC"
},
"SubnetId": {
"Ref": "ACLvpcPrivateSubnet2Subnet63321773"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet2/RouteTableAssociation"
}
},
"ACLvpcPrivateSubnet2DefaultRoute692EE131": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPrivateSubnet2RouteTable66EECACC"
},
"DestinationCidrBlock": "0.0.0.0/0",
"NatGatewayId": {
"Ref": "ACLvpcPublicSubnet2NATGatewayA823B2BD"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet2/DefaultRoute"
}
},
"ACLvpcPrivateSubnet3SubnetC5349B6D": {
"Type": "AWS::EC2::Subnet",
"Properties": {
"CidrBlock": "10.0.160.0/19",
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"AvailabilityZone": "eu-west-3c",
"MapPublicIpOnLaunch": false,
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet3"
},
{
"Key": "aws-cdk:subnet-name",
"Value": "Private"
},
{
"Key": "aws-cdk:subnet-type",
"Value": "Private"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet3/Subnet"
}
},
"ACLvpcPrivateSubnet3RouteTableFCCC4D72": {
"Type": "AWS::EC2::RouteTable",
"Properties": {
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet3"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet3/RouteTable"
}
},
"ACLvpcPrivateSubnet3RouteTableAssociationD5EEF6F8": {
"Type": "AWS::EC2::SubnetRouteTableAssociation",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPrivateSubnet3RouteTableFCCC4D72"
},
"SubnetId": {
"Ref": "ACLvpcPrivateSubnet3SubnetC5349B6D"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet3/RouteTableAssociation"
}
},
"ACLvpcPrivateSubnet3DefaultRoute6D60CB6B": {
"Type": "AWS::EC2::Route",
"Properties": {
"RouteTableId": {
"Ref": "ACLvpcPrivateSubnet3RouteTableFCCC4D72"
},
"DestinationCidrBlock": "0.0.0.0/0",
"NatGatewayId": {
"Ref": "ACLvpcPublicSubnet3NATGateway88BC6345"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/PrivateSubnet3/DefaultRoute"
}
},
"ACLvpcIGWA284CC51": {
"Type": "AWS::EC2::InternetGateway",
"Properties": {
"Tags": [
{
"Key": "Name",
"Value": "acl-aws-cdk-learning/ACL_vpc"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/IGW"
}
},
"ACLvpcVPCGWA01262F1": {
"Type": "AWS::EC2::VPCGatewayAttachment",
"Properties": {
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
},
"InternetGatewayId": {
"Ref": "ACLvpcIGWA284CC51"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_vpc/VPCGW"
}
},
"ACLsecuritygroupF744FA96": {
"Type": "AWS::EC2::SecurityGroup",
"Properties": {
"GroupDescription": "acl-aws-cdk-learning/ACL_security_group",
"SecurityGroupEgress": [
{
"CidrIp": "0.0.0.0/0",
"Description": "Allow all outbound traffic by default",
"IpProtocol": "-1"
}
],
"VpcId": {
"Ref": "ACLvpcAC1CD0C2"
}
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_security_group/Resource"
}
},
"ACLcachesubnetgroup": {
"Type": "AWS::ElastiCache::SubnetGroup",
"Properties": {
"Description": "subnet group for redis",
"SubnetIds": [
{
"Ref": "ACLvpcPrivateSubnet1SubnetB88404CC"
},
{
"Ref": "ACLvpcPrivateSubnet2Subnet63321773"
},
{
"Ref": "ACLvpcPrivateSubnet3SubnetC5349B6D"
}
]
},
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_cache_subnet_group"
}
},
"ACLredis": {
"Type": "AWS::ElastiCache::CacheCluster",
"Properties": {
"CacheNodeType": "cache.t2.small",
"Engine": "redis",
"NumCacheNodes": 1,
"VpcSecurityGroupIds": [
{
"Fn::GetAtt": [
"ACLsecuritygroupF744FA96",
"GroupId"
]
}
]
},
"DependsOn": [
"ACLcachesubnetgroup"
],
"Metadata": {
"aws:cdk:path": "acl-aws-cdk-learning/ACL_redis"
}
}
}
}
重击内容:
(.env) acl-aws-cdk-learning % cdk deploy
This deployment will make potentially sensitive changes according to your current security approval level (--require-approval broadening).
Please confirm you intend to make the following modifications:
Security Group Changes
┌───┬───────────────────────────────┬─────┬────────────┬─────────────────┐
│ │ Group │ Dir │ Protocol │ Peer │
├───┼───────────────────────────────┼─────┼────────────┼─────────────────┤
│ + │ ${ACL_security_group.GroupId} │ Out │ Everything │ Everyone (IPv4) │
└───┴───────────────────────────────┴─────┴────────────┴─────────────────┘
(NOTE: There may be security-related changes not in this list. See https://github.com/aws/aws-cdk/issues/1299)
Do you wish to deploy these changes (y/n)? y
acl-aws-cdk-learning: deploying...
acl-aws-cdk-learning: creating CloudFormation changeset...
0/38 | 11:00:17 | CREATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata
0/38 | 11:00:17 | CREATE_IN_PROGRESS | AWS::EC2::InternetGateway | ACL_vpc/IGW (ACLvpcIGWA284CC51)
(...)
20/38 | 11:00:53 | CREATE_IN_PROGRESS | AWS::ElastiCache::SubnetGroup | ACL_cache_subnet_group (ACLcachesubnetgroup) Resource creation Initiated
21/38 | 11:00:53 | CREATE_COMPLETE | AWS::ElastiCache::SubnetGroup | ACL_cache_subnet_group (ACLcachesubnetgroup)
21/38 | 11:00:55 | CREATE_IN_PROGRESS | AWS::ElastiCache::CacheCluster | ACL_redis (ACLredis)
22/38 | 11:00:56 | CREATE_FAILED | AWS::ElastiCache::CacheCluster | ACL_redis (ACLredis) Subnet group [default] belongs to a different VPC [vpc-326ce55b] than [vpc-0c45b593f3a5fdc4d] (Service: AmazonElastiCache; Status Code: 400; Error Code: InvalidParameterCombination; Request ID: 901398f4-c355-418d-921b-65e6c52dfe3a)
obj._wrapSandboxCode (/Users/private/Git/acl-aws-cdk-learning/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7761:49)
\_ Kernel._wrapSandboxCode (/Users/private/Git/acl-aws-cdk-learning/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:8221:20)
\_ Kernel._create (/Users/private/Git/acl-aws-cdk-learning/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7761:26)
\_ Kernel.create (/Users/private/Git/acl-aws-cdk-learning/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7508:21)
\_ KernelHost.processRequest (/Users/private/Git/acl-aws-cdk-learning/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7296:28)
\_ KernelHost.run (/Users/private/Git/acl-aws-cdk-learning/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7236:14)
\_ Immediate.setImmediate [as _onImmediate] (/Users/private/Git/acl-aws-cdk-learning/.env/lib/python3.7/site-packages/jsii/_embedded/jsii/jsii-runtime.js:7239:37)
\_ runCallback (timers.js:694:18)
\_ tryOnImmediate (timers.js:665:5)
\_ processImmediate (timers.js:647:5)
最佳答案
我可以看到生成的模板的 CacheCluster 定义中缺少 CacheSubnetGroupName。这就是缓存使用默认 VPC 的原因。
CDK 会忽略您的子网组定义,因为您分配的子网组定义不正确。使用 Cfn 资源时,您应该使用 ref
引用代码中的其他资源,而不是像您那样直接分配资源。
您的代码只需更新以下代码行即可工作。
redis_cluster = aws_elasticache.CfnCacheCluster(
...
cache_subnet_group_name=cache_subnet_group.ref
)
关于python - AWS CDK : Error when deploying Redis ElastiCache: Subnet group belongs to a different VPC than CacheCluster,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59643874/
reqwest v0.9 将 serde v1.0 作为依赖项,因此实现 converting serde_json errors into reqwest error . 在我的代码中,我使用 se
我有这个代码: let file = FileStorage { // ... }; file.write("Test", bytes.as_ref()) .map_err(|e| Mu
我只是尝试用angular-cli创建一个新项目,然后运行服务器,但是它停止并显示一条有趣的消息:Error: No errors。 我以这种方式更新了(希望有帮助):npm uninstall -g
我从我的 javascript 发送交易 Metamask 打开传输对话框 我确定 i get an error message in metamask (inpage.js:1 MetaMask -
这个问题在这里已经有了答案: How do you define custom `Error` types in Rust? (3 个答案) How to get a reference to a
我想知道两者之间有什么大的区别 if let error = error{} vs if error != nil?或者只是人们的不同之处,比如他们如何用代码表达自己? 例如,如果我使用这段代码: u
当我尝试发送超过 50KB 的图像时,我在 Blazor 服务器应用程序上收到以下错误消息 Error: Connection disconnected with error 'Error: Serv
我有一个error-page指令,它将所有异常重定向到错误显示页面 我的web.xml: [...] java.lang.Exception /vi
我有这样的对象: address: { "phone" : 888, "value" : 12 } 在 WHERE 中我需要通过 address.value 查找对象,但是在 SQL 中有函数
每次我尝试编译我的代码时,我都会遇到大量错误。这不是我的代码的问题,因为它在另一台计算机上工作得很好。我尝试重新安装和修复,但这没有帮助。这是整个错误消息: 1>------ Build starte
在我的代码的类部分,如果我写一个错误,则在不应该的情况下,将有几行报告为错误。我将'| error'放在可以从错误中恢复的良好/安全位置,但是我认为它没有使用它。也许它试图在某个地方恢复中间表情? 有
我遇到了 csv 输入文件整体读取故障的问题,我可以通过在 read_csv 函数中添加 "error_bad_lines=False" 来删除这些问题来解决这个问题。 但是我需要报告这些造成问题的文
在 Spring 中,验证后我们在 controller 中得到一个 BindingResult 对象。 很简单,如果我收到验证错误,我想重新显示我的表单,并在每个受影响的字段上方显示错误消息。 因此
我不知道出了什么问题,因为我用 Java 编程了大约一年,从来没有遇到过这个错误。在一分钟前在 Eclipse 中编译和运行工作,现在我得到这个错误: #A fatal error has been
SELECT to_char(messages. TIME, 'YYYY/MM/DD') AS FullDate, to_char(messages. TIME, 'MM/DD
我收到这些错误: AnonymousPath\Anonymized.vb : error BC30037: Character is not valid. AnonymousPath\Anonymiz
我刚刚安装了 gridengine 并在执行 qstat 时出现错误: error: commlib error: got select error (Connection refused) erro
嗨,我正在学习 PHP,我从 CRUD 系统开始,我在 Windows 上安装了 WAMP 服务器,当我运行它时,我收到以下错误消息。 SCREAM: Error suppression ignore
我刚刚开始一个新项目,我正在学习核心数据教程,可以找到:https://www.youtube.com/watch?v=zZJpsszfTHM 我似乎无法弄清楚为什么会抛出此错误。我有一个名为“Exp
当我使用 Jenkins 运行新构建时,出现以下错误: "FilePathY\XXX.cpp : fatal error C1853: 'FilePathZ\XXX.pch' precompiled
我是一名优秀的程序员,十分优秀!