Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
In case you have an AWS API Gateway useful resource, and want it to drive a redeployment utilizing CloudFormation, then you should utilize the TIMESTAMP
trick.
template.yaml
extract:
APIGatewayStage:
Kind: AWS::ApiGateway::Stage
Properties:
StageName: !Sub ${EnvironmentTagName}
RestApiId: !Ref APIGateway
DeploymentId: !Ref APIGatewayDeployment__TIMESTAMP__
TracingEnabled: true
MethodSettings:
- DataTraceEnabled: true
HttpMethod: "*"
LoggingLevel: INFO
ResourcePath: "/*"
MetricsEnabled: true
APIGatewayDeployment__TIMESTAMP__:
Kind: AWS::ApiGateway::Deployment
Properties:
RestApiId: !Ref APIGateway
Description: !Sub ${EnvironmentTagName} Deployment __TIMESTAMP__
APIGateway:
Kind: AWS::ApiGateway::RestApi
Properties:
Identify: !Ref "AWS::StackName"
...
As we are able to see, on line 15 above, we use the __TIMESTAMP__
string within the APIGatewayDeployment
stage.
Now we merely be certain to replace the template.yaml
file with our CI run, changing the occurence of __TIMESTAMP__
with the TIMESTAMP
variable generated:
TIMESTAMP="$(date +%s)"
sed -i "s/__TIMESTAMP__/${TIMESTAMP}/g" template.yaml