aws / aws/aws-toolkit-visual-studio

Ref API-ID in Serverless.Template

Open
#39 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
135
Forks
37
PR merge metrics
No merged PRs in 30d

Description

Hi guys

I would like to be able to reference the api-id in serverless.template when an Api Gateway endpoint is created. I am creating a serverless app (see below)

` "BesoftwareTestGraphQLApi": {
"Type": "AWS::Serverless::Function",
"Properties": {
"FunctionName": "BesoftwareTestGraphQL",
"Handler": "BesoftwareTest.Services::BesoftwareTest.Services.LambdaEntryPoint::FunctionHandlerAsync",
"Runtime": "dotnetcore2.1",
"Tracing": "Active",
"CodeUri": "",
"MemorySize": 1024,
"Timeout": 30,
"Role": { "Ref": "PRole" },
"Policies": [ "AWSLambdaFullAccess" ],
"Environment": {
"Variables": {
"ASPNETCORE_ENVIRONMENT": { "Ref": "PEnvironment" }
}
},
"Events": {
"PostResource": {
"Type": "Api",
"Properties": {
"Path": "/graphql",
"Method": "POST"
}
}
},
"VpcConfig": {
"SecurityGroupIds": [
{ "Ref": "PSecurityGroupId" }
],
"SubnetIds": [
{ "Ref": "PSubnetId1" },
{ "Ref": "PSubnetId2" },
{ "Ref": "PSubnetId3" }
]
}
}
},`

and I am creating a custom domain (see below)

` "APIDomainName": {
"Type": "AWS::ApiGateway::DomainName",
"Properties": {
"CertificateArn": "**********************************************************",
"DomainName": "bsapistage.mcdevelop.com" ,
"EndpointConfiguration": {
"Types": [ "EDGE" ]
}
}
},`

and BasePathMapping (see below)

` "APIBasePathMapping": {
"Type": "AWS::ApiGateway::BasePathMapping",
"Properties": {
"DomainName": "bsapistage.mcdevelop.com",
"RestApiId": { [NOTHING FITS HERE] },
"Stage": "Stage"
}
},`

I need to get the api-id of the generated api gateway endpoint and use it as the RestApiId of BasePathMapping. However, I cannot find away to get this value. Can you point me in the right direction please?

TIA

Contributor guide

Open the contributing guide

Research direction

Start by tracing how serverless.template turns the AWS::Serverless::Function Api event into an API Gateway resource. Review the generated API Gateway resources and the AWS::ApiGateway::BasePathMapping configuration shown in the issue. Done means the template can reference the generated API ID as RestApiId for the custom domain mapping, with behavior verified by the relevant project tests or deployment flow.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws
Domain
api, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.