Created
July 5, 2024 13:11
-
-
Save kkarimi/76dc0635633213a17ffdac78ca885a80 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as cdk from '@aws-cdk/core'; | |
import { Service, Source, GitHubConnection, ConfigurationSourceType, Runtime } from '../lib'; | |
const app = new cdk.App(); | |
const stack = new cdk.Stack(app, 'integ-apprunner'); | |
// Scenario 4: Create the service from Github. Make sure you specify a valid connection ARN. | |
const connectionArn = process.env.CONNECTION_ARN || 'MOCK'; | |
const service4 = new Service(stack, 'Service4', { | |
source: Source.fromGitHub({ | |
repositoryUrl: 'https://github.com/aws-containers/hello-app-runner', | |
branch: 'main', | |
configurationSource: ConfigurationSourceType.REPOSITORY, | |
connection: GitHubConnection.fromConnectionArn(connectionArn), | |
}), | |
}); | |
new cdk.CfnOutput(stack, 'URL4', { value: `https://${service4.serviceUrl}` }); | |
// Scenario 5: Create the service from Github with configuration values override. | |
const service5 = new Service(stack, 'Service5', { | |
source: Source.fromGitHub({ | |
repositoryUrl: 'https://github.com/aws-containers/hello-app-runner', | |
branch: 'main', | |
configurationSource: ConfigurationSourceType.API, | |
codeConfigurationValues: { | |
runtime: Runtime.PYTHON_3, | |
port: '8000', | |
startCommand: 'python app.py', | |
buildCommand: 'yum install -y pycairo && pip install -r requirements.txt', | |
}, | |
connection: GitHubConnection.fromConnectionArn(connectionArn), | |
}), | |
}); | |
new cdk.CfnOutput(stack, 'URL5', { value: `https://${service5.serviceUrl}` }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment