https://pulumi.com logo
#aws
Title
# aws
d

damp-school-17708

11/10/2021, 3:36 PM
Hello, I've a question regarding aws api gateway v2 and route53 domains. On the docs (https://www.pulumi.com/registry/packages/aws/api-docs/apigatewayv2/domainname/#associated-route-53-resource-record) I see:
Copy code
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";

const exampleDomainName = new aws.apigatewayv2.DomainName("exampleDomainName", {
    domainName: "<http://http-api.example.com|http-api.example.com>",
    domainNameConfiguration: {
        certificateArn: aws_acm_certificate.example.arn,
        endpointType: "REGIONAL",
        securityPolicy: "TLS_1_2",
    },
});
const exampleRecord = new aws.route53.Record("exampleRecord", {
    name: exampleDomainName.domainName,
    type: "A",
    zoneId: aws_route53_zone.example.zone_id,
    aliases: [{
        name: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration => domainNameConfiguration.targetDomainName),
        zoneId: exampleDomainName.domainNameConfiguration.apply(domainNameConfiguration => domainNameConfiguration.hostedZoneId),
        evaluateTargetHealth: false,
    }],
});
Which I've followed as-is basically. My route53 record though, seems to point to something different to endpoint I used to call the api with (id-here.execute-api.us-east-1.amazonaws.com works; while this now points to something like different-id-here.execute-api.us-east-1.amazonaws.com) does my api call need to change or am I missing something? I would expect the route53 to point to the 'working endpoint' nothing else
just to add a bit more, looking into this, now, if I use this:
Copy code
const route = new aws.apigatewayv2.Route('apiRoute', {
        apiId: apigw.id,
        routeKey: '$default',
        target: pulumi.interpolate`integrations/${integration.id}`,
      })

      const stage = new aws.apigatewayv2.Stage(
        'apiStage',
        {
          apiId: apigw.id,
          name: env,
          routeSettings: [
            {
              routeKey: route.routeKey,
              throttlingBurstLimit: 5000,
              throttlingRateLimit: 10000,
            },
          ],
          autoDeploy: true,
        },
        { dependsOn: [route] },
      )
and then use name: stage.invokeUrl, that points to the correct url (but I'd need to hack it and remove https:// and the /stage at the end)
so to even better explain, the route 53 record seem to point to the API Gateway domain name but I feel like it should point to the stage invoke url
damn I was missing the api mapping
HTH anyone else hitting this someday
2 Views