How to use the aws-cdk.SDK function in aws-cdk

To help you get started, we’ve selected a few aws-cdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github seagull-js / seagull / packages / deploy-aws / src / templates / seagull_pipeline.ts View on Github external
async createPipeline() {
    setCredsByProfile(this.profile)
    // preparations for deployment
    const isTest = this.stage === 'test'
    const suffix = `${isTest ? `-${this.branch}-test` : ''}-ci`
    const pkgJson = require(`${this.appPath}/package.json`)
    const name = `${pkgJson.name}${suffix}`.replace(/[^0-9A-Za-z-]/g, '')
    const sdk = new SDK({})
    const account = await sdk.defaultAccount()
    const stackProps = { env: { account, region: this.region } }
    const props = { projectName: name, sdk, stackProps }
    const actions = this.actions

    // construct the stack and the app
    const pipelineApp = new SeagullApp(props)
    const stack = pipelineApp.stack
    const principal = 'codebuild.amazonaws.com'
    const role = stack.addIAMRole('role', principal, actions)
    const pipeline = stack.addPipeline('pipeline')
    const token = this.githubToken
    const tokenName = token ? `${name}-github` : this.ssmParam || undefined
    const secretParams = { ssmHandler: this.ssm, token, tokenName }
    const ssmSecret = await handleSSMSecret(secretParams)
    const gitDataProps = {
github seagull-js / seagull / packages / deploy-aws / src / seagull_app.ts View on Github external
async diffStack() {
    const sdk = new cdk.SDK({})
    const synthStack = this.synthesizeStack(this.projectName)
    const cfn = await sdk.cloudFormation(synthStack.environment, 0)
    const templateData = { StackName: synthStack.name }
    const template = await cfn.getTemplate(templateData).promise()
    const body = template.TemplateBody
    const curTemplate = (body && yaml.parse(body, { schema: 'yaml-1.1' })) || {}
    const logicalToPathMap = lib.createLogicalToPathMap(synthStack)
    const diff = cfnDiff.diffTemplate(curTemplate, synthStack.template)
    // tslint:disable-next-line:no-unused-expression
    diff.isEmpty && lib.noChangesInDiff()
    cfnDiff.formatDifferences(process.stdout, diff, logicalToPathMap)
  }
}
github seagull-js / seagull / packages / deploy-aws / src / templates / seagull_project.ts View on Github external
async createBareApp() {
    const account = this.account || (await new SDK({}).defaultAccount())
    const itemsProps = {
      accountId: (await aws.getAccountId(this.sts)) || '',
      branch: this.branch,
      projectName: this.pkgJson.name,
      region: this.region,
      stage: this.stage,
      topic: 'items',
    }
    const appProps = {
      addAssets: true,
      appPath: this.appPath,
      itemsBucket: lib.getBucketName(itemsProps),
      projectName: this.getAppName(),
      stackProps: { env: { account, region: this.region } },
    }
    return new SeagullApp(appProps)
github seagull-js / seagull / packages / pipeline / src / pipeline.ts View on Github external
constructor(appPath: string, opts: Options) {
    this.appPath = appPath
    this.opts = opts
    this.projectName = `${require(`${appPath}/package.json`).name}-pipeline`
    this.sdk = new cdk.SDK({})
    this.logicalToPathMap = {}
    this.synthStack = {} as SynthesizedStack
  }
github seagull-js / seagull / packages / deploy-aws / src / seagull_app.ts View on Github external
async deployStack() {
    const sdk = new cdk.SDK({})
    const synthStack = this.synthesizeStack(this.projectName)
    const env = synthStack.environment
    await cdk.bootstrapEnvironment(env, sdk, 'CDKToolkit', undefined)
    const toolkitInfo = await cdk.loadToolkitInfo(env, sdk, 'CDKToolkit')
    await cdk.deployStack({ sdk, stack: synthStack, toolkitInfo })
  }

aws-cdk

CDK Toolkit, the command line tool for CDK apps

Apache-2.0
Latest version published 4 days ago

Package Health Score

95 / 100
Full package analysis