func New(cfg Config) (backend.Backend, error) {
	log.Info("[DynamoDB] Initializing DynamoDB backend")
	if err := cfg.Check(); err != nil {
		return nil, trace.Wrap(err)
	}
	b := &DynamoDBBackend{tableName: cfg.Tablename, region: cfg.Region}
	var awsConfig aws.Config
	awsConfig.Region = &b.region
	if cfg.AccessKey != "" && cfg.SecretKey != "" {
		creds := credentials.NewStaticCredentials(cfg.AccessKey, cfg.SecretKey, "")
		awsConfig.Credentials = creds
	}
	sess, err := session.NewSession(&awsConfig)
	if err != nil {
		return nil, trace.Wrap(err)
	}

	b.svc = dynamodb.New(sess)
	log.Debug("[DynamoDB] AWS session created")
	b.checkOrCreateTable()
	return b, nil
}
// New returns new instance of Etcd-powered backend
New returns new instance of Etcd-powered backend
// New returns new instance of Etcd - powered backend
func New(cfg Config) (backend.Backend, error) {
	log.Info("[DynamoDB] Initializing DynamoDB backend")
	if err := cfg.Check(); err != nil {
		return nil, trace.Wrap(err)
	}
	b := &DynamoDBBackend{tableName: cfg.Tablename, region: cfg.Region}
	var awsConfig aws.Config
	awsConfig.Region = &b.region
	if cfg.AccessKey != "" && cfg.SecretKey != "" {
		creds := credentials.NewStaticCredentials(cfg.AccessKey, cfg.SecretKey, "")
		awsConfig.Credentials = creds
	}
	sess, err := session.NewSession(&awsConfig)
	if err != nil {
		return nil, trace.Wrap(err)
	}
	b.svc = dynamodb.New(sess)
	log.Debug("[DynamoDB] AWS session created")
	b.checkOrCreateTable()
	return b, nil
}
func New ( cfg Config ) ( backend . Backend , error ) { log . Info ( " " ) if err := cfg . Check ( ) ; err != nil { return nil , trace . Wrap ( err ) } b := & DynamoDBBackend { tableName : cfg . Tablename , region : cfg . Region } var awsConfig aws . Config awsConfig . Region = & b . region if cfg . AccessKey != " " && cfg . SecretKey != " " { creds := credentials . NewStaticCredentials ( cfg . AccessKey , cfg . SecretKey , " " ) awsConfig . Credentials = creds } sess , err := session . NewSession ( & awsConfig ) if err != nil { return nil , trace . Wrap ( err ) } b . svc = dynamodb . New ( sess ) log . Debug ( " " ) b . checkOrCreateTable ( ) return b , nil }
New returns new instance of Etcd-powered backend
New returns new instance of Etcd - powered backend