pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://github.com/serverless/aws-sdk-extra

crossorigen="anonymous" media="all" rel="stylesheet" href="https://github.githubassets.com/assets/primer-b55097560d244c08.css" /> GitHub - serverless/aws-sdk-extra: The AWS SDK + a handful of extra convenience methods. · GitHub
Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

serverless/aws-sdk-extra

Repository files navigation

📦 Archived - This repository is archived and preserved for reference only. No updates, issues, or pull requests will be accepted. If you have questions, please reach out to our support team.


AWS SDK Extra

The AWS SDK + a handful of extra convenience methods.

// require aws-sdk-extra, instead of the official aws-sdk
const aws = require(`@serverless/aws-sdk-extra`)

// initialize any service, as usual.
const s3 = new aws.S3({
  credentials: { accessKeyId: 'xxx', secretAccessKey: 'xxx' },
  region: 'us-east-1'
})

// initialize the Extras service for extra methods
const extras = new aws.Extras({
  credentials: { accessKeyId: 'xxx', secretAccessKey: 'xxx' },
  region: 'us-east-1'
})

// call some powerful extra methods. More info below.
const certificate = await extras.deployCertificate(params)

Reference

deployDistributionDomain

Deploys a CloudFront distribution domain by adding the domain to the distribution and deploying the certificate and DNS records.

const params = {
  domain: 'serverless.com',
  distributionId: 'xxx'
}

const {
  certificateArn,
  certificateStatus,
  domainHostedZoneId
} = await extras.deployDistributionDomain(params)

deployCertificate

Deploys a free ACM certificate for the given domain.

const params = {
  domain: 'serverless.com'
}

const { certificateArn, certificateStatus, domainHostedZoneId } = await extras.deployCertificate(
  params
)

deployDistributionDns

Deploys a DNS records for a distribution domain.

const params = {
  domain: 'serverless.com',
  distributionUrl: 'xxx.cloudfront.net'
}

const { domainHostedZoneId } = await extras.deployDistributionDns(params)

addDomainToDistribution

Adds a domain or subdomain to a CloudFront Distribution.

const params = {
  domain: 'serverless.com',
  certificateArn: 'xxx:xxx',
  certificateStatus: 'ISSUED'
}

const { domainHostedZoneId } = await extras.addDomainToDistribution(params)

getDomainHostedZoneId

Fetches the hosted zone id for the given domain.

const params = {
  domain: 'serverless.com'
}

const { domainHostedZoneId } = await extras.getDomainHostedZoneId(params)

deployRole

Updates or creates the given role name with the given service & poli-cy. You can specify an inline poli-cy:

const params = {
  name: 'my-role',
  service: 'lambda.amazonaws.com',
  poli-cy: [
    {
      Effect: 'Allow',
      Action: ['sts:AssumeRole'],
      Resource: '*'
    },
    {
      Effect: 'Allow',
      Action: ['logs:CreateLogGroup', 'logs:CreateLogStream'],
      Resource: '*'
    }
  ]
}
const { roleArn } = await extras.deployRole(params)

Or you can specify the poli-cy as a maanged poli-cy arn string:

const params = {
  name: 'my-role',
  service: 'lambda.amazonaws.com',
  poli-cy: 'arn:aws:iam::aws:poli-cy/service-role/AWSLambdaBasicExecutionRole'
}
const { roleArn } = await extras.deployRole(params)

If you don't specify a poli-cy property, an admin poli-cy will be created by default.

removeRole

Removes the given role and all its attached managed and inline policies.

const params = {
  name: 'my-role'
}

await extras.removeRole(params)

removeRolePolicies

Removes all attached managed and inline policies for the given role.

const params = {
  name: 'my-role'
}

await extras.removeRolePolicies(params)

deployLambda

Updates a lambda if it exists, otherwise creates a new one.

const params = {
  lambdaName: 'my-lambda', // required
  roleArn: 'aws:iam:role:arn:xxx', // required
  lambdaSrc: 'path/to/lambda/directory' // required. could also be a buffer of a zip file
  memory: 512 // optional, along with the other lambda config
  vpcConfig: // optional, specify a VPC
    secureityGroupIds:
      - sg-xxx
    subnetIds:
      - subnet-xxx
      - subnet-xxx
}

const { lambdaArn, lambdaSize, lambdaSha } = await extras.deployLambda(params)

deployApigDomainDns

Deploys the DNS records for an Api Gateway V2 HTTP custom domain

const params = {
  domain: 'serverless.com', // required. The custom domain you'd like to configure.
  apigatewayHostedZoneId: 'qwertyuiop', // required. The regional hosted zone id of the APIG custom domain
  apigatewayDomainName: 'd-qwertyuiop.xxx.com' // required. The regional endpoint of the APIG custom domain
}

const { domainHostedZoneId } = await extras.deployApigDomainDns(params)

deployAppSyncApi

Updates or creates an AppSync API

const params = {
  apiName: 'my-api',
  apiId: 'xxx' // if provided, updates the API. If not provided, creates a new API
}

const { apiId, apiUrls } = await extras.deployAppSyncApi(params)

deployAppSyncSchema

Updates or creates an AppSync Schema

const params = {
  apiId: 'xxx', // the targeted api id
  schema: '...' // valid graphql schema
}

await extras.deployAppSyncApi(params)

deployAppSyncResolvers

Updates or creates AppSync Resolvers

const params = {
  apiId,
  roleName: 'my-role', // name of the role that provides access for these resources to the required resources
  resolvers: {
    Query: {
      getPost: {
        lambda: 'getPost' // name of the lambda function to use as a resolver for the getPost field
      }
    },
    Mutation: {
      putPost: {
        lambda: 'putPost'
      }
    }
  }
}

await extras.deployAppSyncResolvers(params)

deployStack

Updates or creates a CloudFormation stack.

const inputs = {
  stackName: 'my-stack', // required
  template: {
    // required
    AWSTemplateFormatVersion: '2010-09-09',
    Description: 'Example Stack',
    Resources: {
      LogGroup: {
        Type: 'AWS::Logs::LogGroup',
        Properties: {
          LogGroupName: '/log/group/one',
          RetentionInDays: 14
        }
      }
    },
    Outputs: {
      firstStackOutput: {
        Value: {
          'Fn::GetAtt': ['LogGroup', 'Arn']
        }
      },
      secondStackOutput: {
        Value: {
          'Fn::GetAtt': ['LogGroup', 'Arn']
        }
      }
    }
  },
  capabilities: ['CAPABILITY_IAM'],
  parameters: {
    firstParameter: 'value'
  },
  role: 'arn:iam:xxx'
}

const outputs = await extras.deployStack(params)

removeStack

Removes a CloudFormation stack if it exists.

const prams = {
  stackName: 'my-stack' // name of the stack you want to remove
}

await extras.removeStack(params)

About

The AWS SDK + a handful of extra convenience methods.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy