Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
7a3c6c5
cli flow for connecting api to existing database
chrisbonifacio Nov 10, 2023
0dbb785
add sql data types to cspell
chrisbonifacio Nov 10, 2023
a9d9f85
add link to rds proxy pricing page
chrisbonifacio Nov 10, 2023
cba3c3c
make schema.sql.graphql consistent
chrisbonifacio Nov 10, 2023
1459bac
change cyan mapping to skyblue for better readability
chrisbonifacio Nov 10, 2023
38cd4b2
adjust date type colors
chrisbonifacio Nov 10, 2023
08e1bb7
Add page to directory.mjs
chrisbonifacio Nov 14, 2023
f572551
update cdk with csv script and schema gen step
chrisbonifacio Nov 14, 2023
7fcb385
add terms to cspell
chrisbonifacio Nov 14, 2023
621ee93
add callout for time zone offsets
chrisbonifacio Nov 14, 2023
6bde20b
adjust header levels
chrisbonifacio Nov 14, 2023
9a9e7b5
remove redundant text
chrisbonifacio Nov 14, 2023
118d06f
add step to replace <database-name> in sql script
chrisbonifacio Nov 14, 2023
422b332
add step to replace <database-name> in sql script
chrisbonifacio Nov 14, 2023
d80162b
mention updating the path to the graphql file
chrisbonifacio Nov 14, 2023
7f0b182
Merge branch 'next-release/main' of github.com:aws-amplify/docs into …
chrisbonifacio Nov 14, 2023
1a83236
Merge branch 'next-release/main' of github.com:aws-amplify/docs into …
chrisbonifacio Nov 14, 2023
8297896
update links to point to platform/<v6-path>
chrisbonifacio Nov 14, 2023
49afe34
remove gen2/existing-projects page from directory.mjs
chrisbonifacio Nov 14, 2023
0218aa1
update MySQL csv script
chrisbonifacio Nov 15, 2023
9d707e7
update cdk construct api
chrisbonifacio Nov 15, 2023
11121ec
update sql script for postgres
chrisbonifacio Nov 15, 2023
684cf66
update sql scripts under iterative changes section
chrisbonifacio Nov 15, 2023
0ec4fc7
merge main into cbonif/connect-api-to-db
chrisbonifacio Nov 23, 2023
8f2e19a
refactor to CDK only workflow
chrisbonifacio Nov 24, 2023
5e22369
Add experimental note to iterative change section
chrisbonifacio Nov 24, 2023
48b9a9f
Merge branch 'main' of github.com:aws-amplify/docs into cbonif/connec…
chrisbonifacio Nov 24, 2023
ff6e457
applied edits for launch
Nov 27, 2023
a33e67e
reverted unintende file changes
Nov 27, 2023
58ef119
reverted unencessary file changes
Nov 27, 2023
b5cfe13
removed empty line hack
Nov 27, 2023
e243d2e
removed final model reference
Nov 27, 2023
cee25d8
removed the reference fo the word "model"
Nov 27, 2023
bf26898
Merge branch 'main' into cbonif/connect-api-to-db
renebrandel Nov 27, 2023
a075928
removed sandbox reference
Nov 27, 2023
1863c02
Merge branch 'cbonif/connect-api-to-db' of github.com:aws-amplify/doc…
Nov 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update cdk construct api
  • Loading branch information
chrisbonifacio committed Nov 15, 2023
commit 9d707e71c808d29360a8373495dc3b615065bd4b
Original file line number Diff line number Diff line change
Expand Up @@ -250,35 +250,34 @@ In the main stack class, add the following code to define a new GraphQL API. Rep
```ts
new AmplifyGraphqlApi(stack, 'SqlBoundApi', {
apiName: 'MySqlBoundApi',
definition: AmplifyGraphqlDefinition.fromFilesAndDefinition(
definition: AmplifyGraphqlDefinition.fromFilesAndStrategy(
[path.join(__dirname, 'schema.sql.graphql')],
{
strategy: {
dbType: 'MYSQL',
vpcConfiguration: {
vpcId: 'vpc-123456',
securityGroupIds: ['sg-123', 'sg-456'],
subnetAvailabilityZoneConfig: [
{ subnetId: 'sn-123456', availabilityZone: 'us-east-1a' },
{ subnetId: 'sn-987654', availabilityZone: 'us-east-1b' }
]
},
dbConnectionConfig: {
hostnameSsmPath:
'/path/to/ssm/SecretString/containing/value/of/hostname',
portSsmPath: '/path/to/ssm/SecretString/containing/value/of/port',
usernameSsmPath:
'/path/to/ssm/SecretString/containing/value/of/username',
passwordSsmPath:
'/path/to/ssm/SecretString/containing/value/of/password',
databaseNameSsmPath:
'/path/to/ssm/SecretString/containing/value/of/databaseName'
}
name: 'MyBlogSiteDatabase',
dbType: 'MYSQL',
vpcConfiguration: {
vpcId: 'vpc-123456',
securityGroupIds: ['sg-123', 'sg-456'],
subnetAvailabilityZoneConfig: [
{ subnetId: 'sn-123456', availabilityZone: 'us-east-1a' },
{ subnetId: 'sn-987654', availabilityZone: 'us-east-1b' }
]
},
dbConnectionConfig: {
hostnameSsmPath:
'/path/to/ssm/SecretString/containing/value/of/hostname',
portSsmPath: '/path/to/ssm/SecretString/containing/value/of/port',
usernameSsmPath:
'/path/to/ssm/SecretString/containing/value/of/username',
passwordSsmPath:
'/path/to/ssm/SecretString/containing/value/of/password',
databaseNameSsmPath:
'/path/to/ssm/SecretString/containing/value/of/databaseName'
}
}
),
authorizationModes: {
apiKeyConfig: { expires: Duration.days(7) }
apiKeyConfig: { expires: cdk.Duration.days(7) }
},
translationBehavior: {
sandboxModeEnabled: true
Expand All @@ -290,11 +289,13 @@ The API will have an API key enabled for authorization. Sandbox mode is enabled

Before deploying, make sure to:

- Change the `dbType` to match your database engine of either MySQL or PostgreSQL.
- Set a value for `name`. This will be used to name the AppSync DataSource itself, plus any associated resources like resolver Lambdas. This name must be unique across all schema definitions in a GraphQL API.

- Update the `vpcId`, `securityGroupIds`, and `subnetAvailabilityZoneConfig` with your vpc details.
- Change the `dbType` to match your database engine. This is the type of the SQL database used to process model operations for this definition.Supported engines are `"MYSQL"`, `"POSTGRES"`, or `"DYNAMODB"`.

- Update the SSM parameter paths within `dbConnectionConfig` to point to those existing in your AWS account.
- Update the `vpcId`, `securityGroupIds`, and `subnetAvailabilityZoneConfig` with your vpc details. This is the configuration of the VPC into which to install the SQL Lambda.

- Update the SSM parameter paths within `dbConnectionConfig` to point to those existing in your AWS account. These are the parameters the SQL Lambda will use to connect to the database.

</Block>
</BlockSwitcher>
Expand Down