changing VPC to use outputs

This commit is contained in:
2020-04-29 17:16:45 +01:00
parent e8b4954821
commit 92c33e519e
3 changed files with 19 additions and 6 deletions

View File

@@ -75,19 +75,19 @@ Outputs:
Description: The VPC ID.
Value: !Ref PublicVPC
Export:
Name: ELBStrapiPublicVPC
Name: !Sub "${AWS::StackName}-ELBStrapiPublicVPC"
PublicSubnet0ID:
Description: The ID of the subnet.
Value: !Ref PublicSubnet0
Export:
Name: ELBStrapiSubnet0
Name: !Sub "${AWS::StackName}-ELBStrapiSubnet0"
PublicSubnet1ID:
Description: The ID of the subnet.
Value: !Ref PublicSubnet1
Export:
Name: ELBStrapiSubnet1
Name: !Sub "${AWS::StackName}-ELBStrapiSubnet1"
PublicSubnet2ID:
Description: The ID of the subnet.
Value: !Ref PublicSubnet2
Export:
Name: ELBStrapiSubnet2
Name: !Sub "${AWS::StackName}-ELBStrapiSubnet2"

View File

@@ -1,5 +1,5 @@
option_settings:
aws:ec2:vpc:
VPCId: "vpc-003597eb63a0a3efe"
VPCId: !FN::ImportValue" "temp-vpc-ELBStrapiPublicVPC"
Subnets: "subnet-02cd8f7981ddfe345,subnet-02d9e1338e8d92d09,subnet-0e07d4d35394db524"
DBSubnets: "subnet-02cd8f7981ddfe345,subnet-02d9e1338e8d92d09,subnet-0e07d4d35394db524"

15
todo.md
View File

@@ -42,6 +42,19 @@ Decouple an exisitng RDS instance from ELB to RDS: <https://aws.amazon.com/premi
Deploy the ELB environment referencing the VPC + Subnets created with Cloudformation. Use https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/vpc-rds.html as a reference.
This works! Create all the VPC + Subnet resources using Cloudformation and specify them in option settings:
```yaml
option_settings:
aws:ec2:vpc:
VPCId: "vpc-003597eb63a0a3efe"
Subnets: "subnet-02cd8f7981ddfe345,subnet-02d9e1338e8d92d09,subnet-0e07d4d35394db524"
DBSubnets: "subnet-02cd8f7981ddfe345,subnet-02d9e1338e8d92d09,subnet-0e07d4d35394db524"
```
Recreate env with database, check the DB subnets - are they the same as the EC2 subnets? If so we can reference them in https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/command-options-general.html#command-options-general-ec2vpc with ELBSubnets
Can we use cloudformation functions (imports) in .config files under option_settings? (reference a VPC that already exists?)
Can we use cloudformation functions (imports) in .config files under option_settings? (reference a VPC that already exists?) (https://www.reddit.com/r/aws/comments/a2uoae/is_there_a_way_to_reference_an_elastic_beanstalk/) Yes?
Append the stackname to the outputs for the VPC and Subnets