Skip to content

Commit

Permalink
Bring back EIP (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathcolo authored Nov 1, 2023
1 parent 960c654 commit fd92810
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 32 deletions.
39 changes: 9 additions & 30 deletions devops/cloudformation.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,29 +71,6 @@
]
}
},
"RREEipAssociation": {
"Type": "AWS::EC2::EIPAssociation",
"Properties": {
"EIP": {
"Ref": "RREEip"
},
"InstanceId": {
"Ref": "RREInstance"
}
}
},
"RREEip": {
"Type": "AWS::EC2::EIP",
"Properties": {
"Domain": "vpc",
"Tags": [
{
"Key": "Name",
"Value": "RRE-eip"
}
]
}
},
"RREDNSRecord": {
"Type": "AWS::Route53::RecordSet",
"Properties": {
Expand Down Expand Up @@ -157,16 +134,18 @@
"SslSupportMethod": "sni-only"
}
}
},
"DependsOn": [
"RREEipAssociation"
]
}
}
},
"Outputs": {
"InstanceIP": {
"Value": { "Ref": "RREEip" },
"Description": "RRE's public IP address"
"InstanceHostname": {
"Description": "RRE's public hostname",
"Value": {
"Fn::GetAtt": [
"RREInstance",
"PublicDnsName"
]
}
}
}
}
4 changes: 2 additions & 2 deletions devops/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ aws cloudformation deploy --stack-name $STACK_NAME \
RREDomain=$DOMAIN \
RRECertArn=$CERT_ARN

INSTANCE_IP=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].Outputs[?OutputKey=='InstanceIP'].OutputValue" --output text)
INSTANCE_HOSTNAME=$(aws cloudformation describe-stacks --stack-name $STACK_NAME --query "Stacks[0].Outputs[?OutputKey=='InstanceHostname'].OutputValue" --output text)

# Run the playbook! :-)
export ANSIBLE_HOST_KEY_CHECKING=False # If it's a new host, ssh known_hosts not having the key fingerprint will cause an error. Silence it
ansible-playbook -v -i $INSTANCE_IP, -u ubuntu --private-key ~/.ssh/transitmatters-rre.pem playbook.yml
ansible-playbook -v -i $INSTANCE_HOSTNAME, -u ubuntu --private-key ~/.ssh/transitmatters-rre.pem playbook.yml

# Grab the cloudfront ID and invalidate its cache
CLOUDFRONT_ID=$(aws cloudfront list-distributions --query "DistributionList.Items[?Aliases.Items!=null] | [?contains(Aliases.Items, '$HOSTNAME')].Id | [0]" --output text)
Expand Down

0 comments on commit fd92810

Please sign in to comment.