-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Description of Bug:
For an unknown reason, a new EC2 instance and EIP is generated at each deployment.
This has the important negative effect of requiring us to update the bypassed IP address in the Vercel API.
Steps to Reproduce:
- Log into AWS, note the development
us-east-1environment EC2 instance id and its Elastic IP address - Manually trigger deployment to development (https://github.com/source-cooperative/data.source.coop/actions/workflows/dev-deploy.yaml)
- After deployment complete, note different EC2 instance ID and Elastic IP address
Expected Behavior:
If the EC2 instance's properties aren't altered, there's no need for a new EC2 instance to be deployed.
Actual Behavior:
DataProxy-dev: start: Building DataProxy-dev Template
DataProxy-dev: success: Built DataProxy-dev Template
DataProxy-dev: start: Publishing DataProxy-dev Template (417712557820-us-east-1-71560aad)
DataProxy-dev: success: Published DataProxy-dev Template (417712557820-us-east-1-71560aad)
DataProxy-dev: deploying... [1/1]
DataProxy-dev: creating CloudFormation changeset...
DataProxy-dev | 0/7 | 11:27:40 PM | UPDATE_IN_PROGRESS | AWS::CloudFormation::Stack | DataProxy-dev User Initiated
DataProxy-dev | 0/7 | 11:27:45 PM | UPDATE_IN_PROGRESS | AWS::ECS::Cluster | source-data-proxy/cluster (sourcedataproxycluster2EC137A2)
DataProxy-dev | 0/7 | 11:27:45 PM | UPDATE_IN_PROGRESS | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata)
DataProxy-dev | 1/7 | 11:27:46 PM | UPDATE_COMPLETE | AWS::CDK::Metadata | CDKMetadata/Default (CDKMetadata)
DataProxy-dev | 1/7 | 11:27:46 PM | UPDATE_IN_PROGRESS | AWS::EC2::Instance | vercel-api-proxy/squid-proxy (vercelapiproxysquidproxy8D06990C) Requested update requires the creation of a new physical resource; hence creating one.
DataProxy-dev | 2/7 | 11:27:47 PM | UPDATE_COMPLETE | AWS::ECS::Cluster | source-data-proxy/cluster (sourcedataproxycluster2EC137A2)
DataProxy-dev | 2/7 | 11:27:48 PM | UPDATE_IN_PROGRESS | AWS::EC2::Instance | vercel-api-proxy/squid-proxy (vercelapiproxysquidproxy8D06990C) Resource creation Initiated
DataProxy-dev | 3/7 | 11:27:58 PM | UPDATE_COMPLETE | AWS::EC2::Instance | vercel-api-proxy/squid-proxy (vercelapiproxysquidproxy8D06990C)
DataProxy-dev | 3/7 | 11:28:00 PM | UPDATE_IN_PROGRESS | AWS::EC2::EIPAssociation | vercel-api-proxy/proxy-eip-assoc (vercelapiproxyproxyeipassoc901196F9)
DataProxy-dev | 3/7 | 11:28:01 PM | UPDATE_IN_PROGRESS | AWS::Route53::RecordSet | vercel-api-proxy/proxy-a-record (vercelapiproxyproxyarecord4599A561)
DataProxy-dev | 3/7 | 11:28:02 PM | DELETE_IN_PROGRESS | AWS::EC2::EIPAssociation | vercel-api-proxy/proxy-eip-assoc (vercelapiproxyproxyeipassoc901196F9) Requested update requires the replacement of the existing resource; deleting existing resource, then creating a new one.
DataProxy-dev | 4/7 | 11:28:04 PM | DELETE_COMPLETE | AWS::EC2::EIPAssociation | vercel-api-proxy/proxy-eip-assoc (vercelapiproxyproxyeipassoc901196F9) Resource eipassoc-0025f2d6b1f477e74 delete complete
DataProxy-dev | 4/7 | 11:28:08 PM | CREATE_IN_PROGRESS | AWS::EC2::EIPAssociation | vercel-api-proxy/proxy-eip-assoc (vercelapiproxyproxyeipassoc901196F9) Resource creation Initiated
DataProxy-dev | 3/7 | 11:28:08 PM | CREATE_COMPLETE | AWS::EC2::EIPAssociation | vercel-api-proxy/proxy-eip-assoc (vercelapiproxyproxyeipassoc901196F9)
DataProxy-dev | 2/7 | 11:28:09 PM | UPDATE_COMPLETE | AWS::EC2::EIPAssociation | vercel-api-proxy/proxy-eip-assoc (vercelapiproxyproxyeipassoc901196F9)
DataProxy-dev | 3/7 | 11:28:12 PM | UPDATE_COMPLETE | AWS::Route53::RecordSet | vercel-api-proxy/proxy-a-record (vercelapiproxyproxyarecord4599A561)
DataProxy-dev | 4/7 | 11:28:13 PM | UPDATE_COMPLETE_CLEA | AWS::CloudFormation::Stack | DataProxy-dev
DataProxy-dev | 4/7 | 11:28:15 PM | DELETE_IN_PROGRESS | AWS::EC2::Instance | vercel-api-proxy/squid-proxy (vercelapiproxysquidproxy8D06990C)
DataProxy-dev | 3/7 | 11:29:21 PM | DELETE_COMPLETE | AWS::EC2::Instance | vercel-api-proxy/squid-proxy (vercelapiproxysquidproxy8D06990C)
DataProxy-dev | 4/7 | 11:29:21 PM | UPDATE_COMPLETE | AWS::CloudFormation::Stack | DataProxy-dev
✅ DataProxy-dev
Screenshots:
Additional Context:
data.source.coop/deploy/lib/vercel-api-proxy.ts
Lines 71 to 98 in 5976f73
| // Launch EC2 instance | |
| const instance = new ec2.Instance(this, "squid-proxy", { | |
| vpc: props.vpc, | |
| role: ssmRole, | |
| instanceType: ec2.InstanceType.of( | |
| ec2.InstanceClass.T3, | |
| ec2.InstanceSize.MICRO | |
| ), | |
| machineImage: ec2.MachineImage.latestAmazonLinux2023(), | |
| vpcSubnets: { subnetType: ec2.SubnetType.PUBLIC }, | |
| securityGroup: proxySg, | |
| userData, | |
| }); | |
| // Allocate and associate Elastic IP | |
| const eip = new ec2.CfnEIP(this, "proxy-eip", { | |
| domain: "vpc", | |
| tags: [ | |
| { | |
| key: "Name", | |
| value: `${cdk.Stack.of(this).stackName}-proxy-eip`, | |
| }, | |
| ], | |
| }); | |
| new ec2.CfnEIPAssociation(this, "proxy-eip-assoc", { | |
| allocationId: eip.attrAllocationId, | |
| instanceId: instance.instanceId, | |
| }); |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working