aws / aws/chalice

Add ability to re-use existing API Gateway with deploy

Open
#972 11 comments 25 reactions 0 assignees View on GitHub
feature-request
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Currently, the only way to re-use an existing API Gateway endpoint in a `chalice deploy` command is to have the deployed resource index stored in the `.chalice/deployed/.json` file. In a multiple user environment, this works fine as long as the `.json` file is committed to the GIT repo.

However, when trying to use `chalice deploy` in a CI/CD pipeline (such as GitLab CI), the first release must commit the new `.json` file to the repository. Otherwise, each deployment creates a new API Gateway endpoint. Other resources, such as Lambda function or IAM role, which have a consistent name per account and stage, are correctly re-deployed.

**Proposal**:

Add an additional option, `--reuse-api-gateway` to the `chalice deploy` command. Usage would look something like:

```
chalice deploy --reuse-api-gateway --stage prod
```

**Expected behavior without option**:

Chalice would deploy exactly as it currently does

**Expected behavior with option**:

Chalice would interrogate the API Gateway to find the API ID that matches the name of the api being deployed and re-use it, rather than creating a new one.

Contributor guide

Open the contributing guide

Research direction

Start by tracing the `chalice deploy` command and how `.chalice/deployed/.json` is used to identify existing resources. Review the deployment path for API Gateway and the GitLab CI scenario described in the issue. Done means the new `--reuse-api-gateway` option reuses an API Gateway matching the API name, while deployment without it behaves unchanged.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.