sentence1
stringlengths 52
3.87M
| sentence2
stringlengths 1
47.2k
| label
stringclasses 1
value |
---|---|---|
def setSpeciesFromJson(self, speciesJson):
"""
Sets the species, an OntologyTerm, to the specified value, given as
a JSON string.
See the documentation for details of this field.
"""
try:
parsed = protocol.fromJson(speciesJson, protocol.OntologyTerm)
except:
raise exceptions.InvalidJsonException(speciesJson)
self._species = protocol.toJsonDict(parsed) | Sets the species, an OntologyTerm, to the specified value, given as
a JSON string.
See the documentation for details of this field. | entailment |
def getReferenceByName(self, name):
"""
Returns the reference with the specified name.
"""
if name not in self._referenceNameMap:
raise exceptions.ReferenceNameNotFoundException(name)
return self._referenceNameMap[name] | Returns the reference with the specified name. | entailment |
def getReference(self, id_):
"""
Returns the Reference with the specified ID or raises a
ReferenceNotFoundException if it does not exist.
"""
if id_ not in self._referenceIdMap:
raise exceptions.ReferenceNotFoundException(id_)
return self._referenceIdMap[id_] | Returns the Reference with the specified ID or raises a
ReferenceNotFoundException if it does not exist. | entailment |
def getMd5Checksum(self):
"""
Returns the MD5 checksum for this reference set. This checksum is
calculated by making a list of `Reference.md5checksum` for all
`Reference`s in this set. We then sort this list, and take the
MD5 hash of all the strings concatenated together.
"""
references = sorted(
self.getReferences(),
key=lambda ref: ref.getMd5Checksum())
checksums = ''.join([ref.getMd5Checksum() for ref in references])
md5checksum = hashlib.md5(checksums).hexdigest()
return md5checksum | Returns the MD5 checksum for this reference set. This checksum is
calculated by making a list of `Reference.md5checksum` for all
`Reference`s in this set. We then sort this list, and take the
MD5 hash of all the strings concatenated together. | entailment |
def toProtocolElement(self):
"""
Returns the GA4GH protocol representation of this ReferenceSet.
"""
ret = protocol.ReferenceSet()
ret.assembly_id = pb.string(self.getAssemblyId())
ret.description = pb.string(self.getDescription())
ret.id = self.getId()
ret.is_derived = self.getIsDerived()
ret.md5checksum = self.getMd5Checksum()
if self.getSpecies():
term = protocol.fromJson(
json.dumps(self.getSpecies()), protocol.OntologyTerm)
ret.species.term_id = term.term_id
ret.species.term = term.term
ret.source_accessions.extend(self.getSourceAccessions())
ret.source_uri = pb.string(self.getSourceUri())
ret.name = self.getLocalId()
self.serializeAttributes(ret)
return ret | Returns the GA4GH protocol representation of this ReferenceSet. | entailment |
def toProtocolElement(self):
"""
Returns the GA4GH protocol representation of this Reference.
"""
reference = protocol.Reference()
reference.id = self.getId()
reference.is_derived = self.getIsDerived()
reference.length = self.getLength()
reference.md5checksum = self.getMd5Checksum()
reference.name = self.getName()
if self.getSpecies():
term = protocol.fromJson(
json.dumps(self.getSpecies()), protocol.OntologyTerm)
reference.species.term_id = term.term_id
reference.species.term = term.term
reference.source_accessions.extend(self.getSourceAccessions())
reference.source_divergence = pb.int(self.getSourceDivergence())
reference.source_uri = self.getSourceUri()
self.serializeAttributes(reference)
return reference | Returns the GA4GH protocol representation of this Reference. | entailment |
def checkQueryRange(self, start, end):
"""
Checks to ensure that the query range is valid within this reference.
If not, raise ReferenceRangeErrorException.
"""
condition = (
(start < 0 or end > self.getLength()) or
start > end or start == end)
if condition:
raise exceptions.ReferenceRangeErrorException(
self.getId(), start, end) | Checks to ensure that the query range is valid within this reference.
If not, raise ReferenceRangeErrorException. | entailment |
def populateFromFile(self, dataUrl):
"""
Populates the instance variables of this ReferencSet from the
data URL.
"""
self._dataUrl = dataUrl
fastaFile = self.getFastaFile()
for referenceName in fastaFile.references:
reference = HtslibReference(self, referenceName)
# TODO break this up into chunks and calculate the MD5
# in bits (say, 64K chunks?)
bases = fastaFile.fetch(referenceName)
md5checksum = hashlib.md5(bases).hexdigest()
reference.setMd5checksum(md5checksum)
reference.setLength(len(bases))
self.addReference(reference) | Populates the instance variables of this ReferencSet from the
data URL. | entailment |
def populateFromRow(self, referenceSetRecord):
"""
Populates this reference set from the values in the specified DB
row.
"""
self._dataUrl = referenceSetRecord.dataurl
self._description = referenceSetRecord.description
self._assemblyId = referenceSetRecord.assemblyid
self._isDerived = bool(referenceSetRecord.isderived)
self._md5checksum = referenceSetRecord.md5checksum
species = referenceSetRecord.species
if species is not None and species != 'null':
self.setSpeciesFromJson(species)
self._sourceAccessions = json.loads(
referenceSetRecord.sourceaccessions)
self._sourceUri = referenceSetRecord.sourceuri | Populates this reference set from the values in the specified DB
row. | entailment |
def populateFromRow(self, referenceRecord):
"""
Populates this reference from the values in the specified DB row.
"""
self._length = referenceRecord.length
self._isDerived = bool(referenceRecord.isderived)
self._md5checksum = referenceRecord.md5checksum
species = referenceRecord.species
if species is not None and species != 'null':
self.setSpeciesFromJson(species)
self._sourceAccessions = json.loads(referenceRecord.sourceaccessions)
self._sourceDivergence = referenceRecord.sourcedivergence
self._sourceUri = referenceRecord.sourceuri | Populates this reference from the values in the specified DB row. | entailment |
def _extractAssociationsDetails(self, associations):
"""
Given a set of results from our search query, return the
`details` (feature,environment,phenotype)
"""
detailedURIRef = []
for row in associations.bindings:
if 'feature' in row:
detailedURIRef.append(row['feature'])
detailedURIRef.append(row['environment'])
detailedURIRef.append(row['phenotype'])
return detailedURIRef | Given a set of results from our search query, return the
`details` (feature,environment,phenotype) | entailment |
def _detailTuples(self, uriRefs):
"""
Given a list of uriRefs, return a list of dicts:
{'subject': s, 'predicate': p, 'object': o }
all values are strings
"""
details = []
for uriRef in uriRefs:
for subject, predicate, object_ in self._rdfGraph.triples(
(uriRef, None, None)):
details.append({
'subject': subject.toPython(),
'predicate': predicate.toPython(),
'object': object_.toPython()
})
return details | Given a list of uriRefs, return a list of dicts:
{'subject': s, 'predicate': p, 'object': o }
all values are strings | entailment |
def _bindingsToDict(self, bindings):
"""
Given a binding from the sparql query result,
create a dict of plain text
"""
myDict = {}
for key, val in bindings.iteritems():
myDict[key.toPython().replace('?', '')] = val.toPython()
return myDict | Given a binding from the sparql query result,
create a dict of plain text | entailment |
def _addDataFile(self, filename):
"""
Given a filename, add it to the graph
"""
if filename.endswith('.ttl'):
self._rdfGraph.parse(filename, format='n3')
else:
self._rdfGraph.parse(filename, format='xml') | Given a filename, add it to the graph | entailment |
def _getDetails(self, uriRef, associations_details):
"""
Given a uriRef, return a dict of all the details for that Ref
use the uriRef as the 'id' of the dict
"""
associationDetail = {}
for detail in associations_details:
if detail['subject'] == uriRef:
associationDetail[detail['predicate']] = detail['object']
associationDetail['id'] = uriRef
return associationDetail | Given a uriRef, return a dict of all the details for that Ref
use the uriRef as the 'id' of the dict | entailment |
def _formatExternalIdentifiers(self, element, element_type):
"""
Formats several external identifiers for query
"""
elementClause = None
elements = []
if not issubclass(element.__class__, dict):
element = protocol.toJsonDict(element)
if element['externalIdentifiers']:
for _id in element['externalIdentifiers']:
elements.append(self._formatExternalIdentifier(
_id, element_type))
elementClause = "({})".format(" || ".join(elements))
return elementClause | Formats several external identifiers for query | entailment |
def _formatExternalIdentifier(self, element, element_type):
"""
Formats a single external identifier for query
"""
if "http" not in element['database']:
term = "{}:{}".format(element['database'], element['identifier'])
namespaceTerm = self._toNamespaceURL(term)
else:
namespaceTerm = "{}{}".format(
element['database'], element['identifier'])
comparison = '?{} = <{}> '.format(element_type, namespaceTerm)
return comparison | Formats a single external identifier for query | entailment |
def _formatOntologyTerm(self, element, element_type):
"""
Formats the ontology terms for query
"""
elementClause = None
if isinstance(element, dict) and element.get('terms'):
elements = []
for _term in element['terms']:
if _term.get('id'):
elements.append('?{} = <{}> '.format(
element_type, _term['id']))
else:
elements.append('?{} = <{}> '.format(
element_type, self._toNamespaceURL(_term['term'])))
elementClause = "({})".format(" || ".join(elements))
return elementClause | Formats the ontology terms for query | entailment |
def _formatOntologyTermObject(self, terms, element_type):
"""
Formats the ontology term object for query
"""
elementClause = None
if not isinstance(terms, collections.Iterable):
terms = [terms]
elements = []
for term in terms:
if term.term_id:
elements.append('?{} = <{}> '.format(
element_type, term.term_id))
else:
elements.append('?{} = <{}> '.format(
element_type, self._toNamespaceURL(term.term)))
elementClause = "({})".format(" || ".join(elements))
return elementClause | Formats the ontology term object for query | entailment |
def _formatIds(self, element, element_type):
"""
Formats a set of identifiers for query
"""
elementClause = None
if isinstance(element, collections.Iterable):
elements = []
for _id in element:
elements.append('?{} = <{}> '.format(
element_type, _id))
elementClause = "({})".format(" || ".join(elements))
return elementClause | Formats a set of identifiers for query | entailment |
def _formatEvidence(self, elements):
"""
Formats elements passed into parts of a query for filtering
"""
elementClause = None
filters = []
for evidence in elements:
if evidence.description:
elementClause = 'regex(?{}, "{}")'.format(
'environment_label', evidence.description)
if (hasattr(evidence, 'externalIdentifiers') and
evidence.externalIdentifiers):
# TODO will this pick up > 1 externalIdentifiers ?
for externalIdentifier in evidence['externalIdentifiers']:
exid_clause = self._formatExternalIdentifier(
externalIdentifier, 'environment')
# cleanup parens from _formatExternalIdentifier method
elementClause = exid_clause[1:-1]
if elementClause:
filters.append(elementClause)
elementClause = "({})".format(" || ".join(filters))
return elementClause | Formats elements passed into parts of a query for filtering | entailment |
def _getIdentifier(self, url):
"""
Given a url identifier return identifier portion
Leverages prefixes already in graph namespace
Returns None if no match
Ex. "http://www.drugbank.ca/drugs/DB01268" -> "DB01268"
"""
for prefix, namespace in self._rdfGraph.namespaces():
if namespace in url:
return url.replace(namespace, '') | Given a url identifier return identifier portion
Leverages prefixes already in graph namespace
Returns None if no match
Ex. "http://www.drugbank.ca/drugs/DB01268" -> "DB01268" | entailment |
def _getPrefixURL(self, url):
"""
Given a url return namespace prefix.
Leverages prefixes already in graph namespace
Ex. "http://www.drugbank.ca/drugs/DDD"
-> "http://www.drugbank.ca/drugs/"
"""
for prefix, namespace in self._rdfGraph.namespaces():
if namespace.toPython() in url:
return namespace | Given a url return namespace prefix.
Leverages prefixes already in graph namespace
Ex. "http://www.drugbank.ca/drugs/DDD"
-> "http://www.drugbank.ca/drugs/" | entailment |
def _toGA4GH(self, association, featureSets=[]):
"""
given an association dict,
return a protocol.FeaturePhenotypeAssociation
"""
# The association dict has the keys: environment, environment
# label, evidence, feature label, phenotype and sources. Each
# key's value is a dict with the RDF predicates as keys and
# subject as values
# 1) map a GA4GH FeaturePhenotypeAssociation
# from the association dict passed to us
feature = association['feature']
fpa = protocol.FeaturePhenotypeAssociation()
fpa.id = association['id']
feature_id = feature['id']
for feature_set in featureSets:
if self.getLocalId() in feature_set.getLocalId():
feature_id = feature_set.getCompoundIdForFeatureId(feature_id)
fpa.feature_ids.extend([feature_id])
msg = 'Association: genotype:[{}] phenotype:[{}] environment:[{}] ' \
'evidence:[{}] publications:[{}]'
fpa.description = msg.format(
association['feature_label'],
association['phenotype_label'],
association['environment_label'],
self._getIdentifier(association['evidence']),
association['sources']
)
# 2) map a GA4GH Evidence
# from the association's phenotype & evidence
evidence = protocol.Evidence()
phenotype = association['phenotype']
term = protocol.OntologyTerm()
term.term = association['evidence_type']
term.term_id = phenotype['id']
evidence.evidence_type.MergeFrom(term)
evidence.description = self._getIdentifier(association['evidence'])
# 3) Store publications from the list of sources
for source in association['sources'].split("|"):
evidence.info['publications'].values.add().string_value = source
fpa.evidence.extend([evidence])
# 4) map environment (drug) to environmentalContext
environmentalContext = protocol.EnvironmentalContext()
environment = association['environment']
environmentalContext.id = environment['id']
environmentalContext.description = association['environment_label']
term = protocol.OntologyTerm()
term.term = environment['id']
term.term_id = 'http://purl.obolibrary.org/obo/RO_0002606'
environmentalContext.environment_type.MergeFrom(term)
fpa.environmental_contexts.extend([environmentalContext])
# 5) map the phenotype
phenotypeInstance = protocol.PhenotypeInstance()
term = protocol.OntologyTerm()
term.term = phenotype[TYPE]
term.term_id = phenotype['id']
phenotypeInstance.type.MergeFrom(term)
phenotypeInstance.description = phenotype[LABEL]
phenotypeInstance.id = phenotype['id']
fpa.phenotype.MergeFrom(phenotypeInstance)
fpa.phenotype_association_set_id = self.getId()
return fpa | given an association dict,
return a protocol.FeaturePhenotypeAssociation | entailment |
def getAssociations(
self, request=None, featureSets=[]):
"""
This query is the main search mechanism.
It queries the graph for annotations that match the
AND of [feature,environment,phenotype].
"""
if len(featureSets) == 0:
featureSets = self.getParentContainer().getFeatureSets()
# query to do search
query = self._formatFilterQuery(request, featureSets)
associations = self._rdfGraph.query(query)
# associations is now a dict with rdflib terms with variable and
# URIrefs or literals
# given get the details for the feature,phenotype and environment
associations_details = self._detailTuples(
self._extractAssociationsDetails(
associations))
# association_details is now a list of {subject,predicate,object}
# for each of the association detail
# http://nmrml.org/cv/v1.0.rc1/doc/doc/objectproperties/BFO0000159___-324347567.html
# label "has quality at all times" (en)
associationList = []
for assoc in associations.bindings:
if '?feature' in assoc:
association = self._bindingsToDict(assoc)
association['feature'] = self._getDetails(
association['feature'],
associations_details)
association['environment'] = self._getDetails(
association['environment'],
associations_details)
association['phenotype'] = self._getDetails(
association['phenotype'],
associations_details)
association['evidence'] = association['phenotype'][HAS_QUALITY]
association['id'] = association['association']
associationList.append(association)
# our association list is now a list of dicts with the
# elements of an association: environment, evidence,
# feature, phenotype and sources, each with their
# references (labels or URIrefs)
# create GA4GH objects
associations = [
self._toGA4GH(assoc, featureSets) for
assoc in associationList]
return associations | This query is the main search mechanism.
It queries the graph for annotations that match the
AND of [feature,environment,phenotype]. | entailment |
def _formatFilterQuery(self, request=None, featureSets=[]):
"""
Generate a formatted sparql query with appropriate filters
"""
query = self._baseQuery()
filters = []
if issubclass(request.__class__,
protocol.SearchGenotypePhenotypeRequest):
filters += self._filterSearchGenotypePhenotypeRequest(
request, featureSets)
if issubclass(request.__class__, protocol.SearchPhenotypesRequest):
filters += self._filterSearchPhenotypesRequest(request)
# apply filters
filter = "FILTER ({})".format(' && '.join(filters))
if len(filters) == 0:
filter = ""
query = query.replace("#%FILTER%", filter)
return query | Generate a formatted sparql query with appropriate filters | entailment |
def _filterSearchPhenotypesRequest(self, request):
"""
Filters request for phenotype search requests
"""
filters = []
if request.id:
filters.append("?phenotype = <{}>".format(request.id))
if request.description:
filters.append(
'regex(?phenotype_label, "{}")'.format(request.description))
# OntologyTerms
# TODO: refactor this repetitive code
if hasattr(request.type, 'id') and request.type.id:
ontolgytermsClause = self._formatOntologyTermObject(
request.type, 'phenotype')
if ontolgytermsClause:
filters.append(ontolgytermsClause)
if len(request.qualifiers) > 0:
ontolgytermsClause = self._formatOntologyTermObject(
request.qualifiers, 'phenotype_quality')
if ontolgytermsClause:
filters.append(ontolgytermsClause)
if hasattr(request.age_of_onset, 'id') and request.age_of_onset.id:
ontolgytermsClause = self._formatOntologyTermObject(
request.age_of_onset, 'phenotype_quality')
if ontolgytermsClause:
filters.append(ontolgytermsClause)
return filters | Filters request for phenotype search requests | entailment |
def parseStep(self, line):
"""
Parse the line describing the mode.
One of:
variableStep chrom=<reference> [span=<window_size>]
fixedStep chrom=<reference> start=<position> step=<step_interval>
[span=<window_size>]
Span is optional, defaulting to 1. It indicates that each value
applies to region, starting at the given position and extending
<span> positions.
"""
fields = dict([field.split('=') for field in line.split()[1:]])
if 'chrom' in fields:
self._reference = fields['chrom']
else:
raise ValueError("Missing chrom field in %s" % line.strip())
if line.startswith("fixedStep"):
if 'start' in fields:
self._start = int(fields['start']) - 1 # to 0-based
else:
raise ValueError("Missing start field in %s" % line.strip())
if 'span' in fields:
self._span = int(fields['span'])
if 'step' in fields:
self._step = int(fields['step']) | Parse the line describing the mode.
One of:
variableStep chrom=<reference> [span=<window_size>]
fixedStep chrom=<reference> start=<position> step=<step_interval>
[span=<window_size>]
Span is optional, defaulting to 1. It indicates that each value
applies to region, starting at the given position and extending
<span> positions. | entailment |
def readWiggleLine(self, line):
"""
Read a wiggle line. If it is a data line, add values to the
protocol object.
"""
if(line.isspace() or line.startswith("#")
or line.startswith("browser") or line.startswith("track")):
return
elif line.startswith("variableStep"):
self._mode = self._VARIABLE_STEP
self.parseStep(line)
return
elif line.startswith("fixedStep"):
self._mode = self._FIXED_STEP
self.parseStep(line)
return
elif self._mode is None:
raise ValueError("Unexpected input line: %s" % line.strip())
if self._queryReference != self._reference:
return
# read data lines
fields = line.split()
if self._mode == self._VARIABLE_STEP:
start = int(fields[0])-1 # to 0-based
val = float(fields[1])
else:
start = self._start
self._start += self._step
val = float(fields[0])
if start < self._queryEnd and start > self._queryStart:
if self._position is None:
self._position = start
self._data.start = start
# fill gap
while self._position < start:
self._data.values.append(float('NaN'))
self._position += 1
for _ in xrange(self._span):
self._data.values.append(val)
self._position += self._span | Read a wiggle line. If it is a data line, add values to the
protocol object. | entailment |
def wiggleFileHandleToProtocol(self, fileHandle):
"""
Return a continuous protocol object satsifiying the given query
parameters from the given wiggle file handle.
"""
for line in fileHandle:
self.readWiggleLine(line)
return self._data | Return a continuous protocol object satsifiying the given query
parameters from the given wiggle file handle. | entailment |
def checkReference(self, reference):
"""
Check the reference for security. Tries to avoid any characters
necessary for doing a script injection.
"""
pattern = re.compile(r'[\s,;"\'&\\]')
if pattern.findall(reference.strip()):
return False
return True | Check the reference for security. Tries to avoid any characters
necessary for doing a script injection. | entailment |
def readValuesPyBigWig(self, reference, start, end):
"""
Use pyBigWig package to read a BigWig file for the
given range and return a protocol object.
pyBigWig returns an array of values that fill the query range.
Not sure if it is possible to get the step and span.
This method trims NaN values from the start and end.
pyBigWig throws an exception if end is outside of the
reference range. This function checks the query range
and throws its own exceptions to avoid the ones thrown
by pyBigWig.
"""
if not self.checkReference(reference):
raise exceptions.ReferenceNameNotFoundException(reference)
if start < 0:
start = 0
bw = pyBigWig.open(self._sourceFile)
referenceLen = bw.chroms(reference)
if referenceLen is None:
raise exceptions.ReferenceNameNotFoundException(reference)
if end > referenceLen:
end = referenceLen
if start >= end:
raise exceptions.ReferenceRangeErrorException(
reference, start, end)
data = protocol.Continuous()
curStart = start
curEnd = curStart + self._INCREMENT
while curStart < end:
if curEnd > end:
curEnd = end
for i, val in enumerate(bw.values(reference, curStart, curEnd)):
if not math.isnan(val):
if len(data.values) == 0:
data.start = curStart + i
data.values.append(val)
if len(data.values) == self._MAX_VALUES:
yield data
data = protocol.Continuous()
elif len(data.values) > 0:
# data.values.append(float('NaN'))
yield data
data = protocol.Continuous()
curStart = curEnd
curEnd = curStart + self._INCREMENT
bw.close()
if len(data.values) > 0:
yield data | Use pyBigWig package to read a BigWig file for the
given range and return a protocol object.
pyBigWig returns an array of values that fill the query range.
Not sure if it is possible to get the step and span.
This method trims NaN values from the start and end.
pyBigWig throws an exception if end is outside of the
reference range. This function checks the query range
and throws its own exceptions to avoid the ones thrown
by pyBigWig. | entailment |
def readValuesBigWigToWig(self, reference, start, end):
"""
Read a bigwig file and return a protocol object with values
within the query range.
This method uses the bigWigToWig command line tool from UCSC
GoldenPath. The tool is used to return values within a query region.
The output is in wiggle format, which is processed by the WiggleReader
class.
There could be memory issues if the returned results are large.
The input reference can be a security problem (script injection).
Ideally, it should be checked against a list of known chromosomes.
Start and end should not be problems since they are integers.
"""
if not self.checkReference(reference):
raise exceptions.ReferenceNameNotFoundException(reference)
if start < 0:
raise exceptions.ReferenceRangeErrorException(
reference, start, end)
# TODO: CHECK IF QUERY IS BEYOND END
cmd = ["bigWigToWig", self._sourceFile, "stdout", "-chrom="+reference,
"-start="+str(start), "-end="+str(end)]
wiggleReader = WiggleReader(reference, start, end)
try:
# run command and grab output simultaneously
process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
while True:
line = process.stdout.readline()
if line == '' and process.poll() is not None:
break
wiggleReader.readWiggleLine(line.strip())
except ValueError:
raise
except:
raise Exception("bigWigToWig failed to run")
return wiggleReader.getData() | Read a bigwig file and return a protocol object with values
within the query range.
This method uses the bigWigToWig command line tool from UCSC
GoldenPath. The tool is used to return values within a query region.
The output is in wiggle format, which is processed by the WiggleReader
class.
There could be memory issues if the returned results are large.
The input reference can be a security problem (script injection).
Ideally, it should be checked against a list of known chromosomes.
Start and end should not be problems since they are integers. | entailment |
def toProtocolElement(self):
"""
Returns the representation of this ContinuousSet as the corresponding
ProtocolElement.
"""
gaContinuousSet = protocol.ContinuousSet()
gaContinuousSet.id = self.getId()
gaContinuousSet.dataset_id = self.getParentContainer().getId()
gaContinuousSet.reference_set_id = pb.string(
self._referenceSet.getId())
gaContinuousSet.name = self._name
gaContinuousSet.source_uri = self._sourceUri
attributes = self.getAttributes()
for key in attributes:
gaContinuousSet.attributes.attr[key] \
.values.extend(protocol.encodeValue(attributes[key]))
return gaContinuousSet | Returns the representation of this ContinuousSet as the corresponding
ProtocolElement. | entailment |
def populateFromRow(self, continuousSetRecord):
"""
Populates the instance variables of this ContinuousSet from the
specified DB row.
"""
self._filePath = continuousSetRecord.dataurl
self.setAttributesJson(continuousSetRecord.attributes) | Populates the instance variables of this ContinuousSet from the
specified DB row. | entailment |
def getContinuous(self, referenceName=None, start=None, end=None):
"""
Method passed to runSearchRequest to fulfill the request to
yield continuous protocol objects that satisfy the given query.
:param str referenceName: name of reference (ex: "chr1")
:param start: castable to int, start position on reference
:param end: castable to int, end position on reference
:return: yields a protocol.Continuous at a time
"""
bigWigReader = BigWigDataSource(self._filePath)
for continuousObj in bigWigReader.bigWigToProtocol(
referenceName, start, end):
yield continuousObj | Method passed to runSearchRequest to fulfill the request to
yield continuous protocol objects that satisfy the given query.
:param str referenceName: name of reference (ex: "chr1")
:param start: castable to int, start position on reference
:param end: castable to int, end position on reference
:return: yields a protocol.Continuous at a time | entailment |
def getContinuousData(self, referenceName=None, start=None, end=None):
"""
Returns a set number of simulated continuous data.
:param referenceName: name of reference to "search" on
:param start: start coordinate of query
:param end: end coordinate of query
:return: Yields continuous list
"""
randomNumberGenerator = random.Random()
randomNumberGenerator.seed(self._randomSeed)
for i in range(100):
gaContinuous = self._generateSimulatedContinuous(
randomNumberGenerator)
match = (
gaContinuous.start < end and
gaContinuous.end > start and
gaContinuous.reference_name == referenceName)
if match:
yield gaContinuous | Returns a set number of simulated continuous data.
:param referenceName: name of reference to "search" on
:param start: start coordinate of query
:param end: end coordinate of query
:return: Yields continuous list | entailment |
def load_template(self, template_name, template_source=None,
template_path=None, **template_vars):
"""
Will load a templated configuration on the device.
:param cls: Instance of the driver class.
:param template_name: Identifies the template name.
:param template_source (optional): Custom config template rendered and loaded on device
:param template_path (optional): Absolute path to directory for the configuration templates
:param template_vars: Dictionary with arguments to be used when the template is rendered.
:raise DriverTemplateNotImplemented: No template defined for the device type.
:raise TemplateNotImplemented: The template specified in template_name does not exist in \
the default path or in the custom path if any specified using parameter `template_path`.
:raise TemplateRenderException: The template could not be rendered. Either the template \
source does not have the right format, either the arguments in `template_vars` are not \
properly specified.
"""
return napalm_base.helpers.load_template(self,
template_name,
template_source=template_source,
template_path=template_path,
**template_vars) | Will load a templated configuration on the device.
:param cls: Instance of the driver class.
:param template_name: Identifies the template name.
:param template_source (optional): Custom config template rendered and loaded on device
:param template_path (optional): Absolute path to directory for the configuration templates
:param template_vars: Dictionary with arguments to be used when the template is rendered.
:raise DriverTemplateNotImplemented: No template defined for the device type.
:raise TemplateNotImplemented: The template specified in template_name does not exist in \
the default path or in the custom path if any specified using parameter `template_path`.
:raise TemplateRenderException: The template could not be rendered. Either the template \
source does not have the right format, either the arguments in `template_vars` are not \
properly specified. | entailment |
def ping(self, destination, source=c.PING_SOURCE, ttl=c.PING_TTL, timeout=c.PING_TIMEOUT,
size=c.PING_SIZE, count=c.PING_COUNT, vrf=c.PING_VRF):
"""
Executes ping on the device and returns a dictionary with the result
:param destination: Host or IP Address of the destination
:param source (optional): Source address of echo request
:param ttl (optional): Maximum number of hops
:param timeout (optional): Maximum seconds to wait after sending final packet
:param size (optional): Size of request (bytes)
:param count (optional): Number of ping request to send
Output dictionary has one of following keys:
* success
* error
In case of success, inner dictionary will have the followin keys:
* probes_sent (int)
* packet_loss (int)
* rtt_min (float)
* rtt_max (float)
* rtt_avg (float)
* rtt_stddev (float)
* results (list)
'results' is a list of dictionaries with the following keys:
* ip_address (str)
* rtt (float)
Example::
{
'success': {
'probes_sent': 5,
'packet_loss': 0,
'rtt_min': 72.158,
'rtt_max': 72.433,
'rtt_avg': 72.268,
'rtt_stddev': 0.094,
'results': [
{
'ip_address': u'1.1.1.1',
'rtt': 72.248
},
{
'ip_address': '2.2.2.2',
'rtt': 72.299
}
]
}
}
OR
{
'error': 'unknown host 8.8.8.8.8'
}
"""
raise NotImplementedError | Executes ping on the device and returns a dictionary with the result
:param destination: Host or IP Address of the destination
:param source (optional): Source address of echo request
:param ttl (optional): Maximum number of hops
:param timeout (optional): Maximum seconds to wait after sending final packet
:param size (optional): Size of request (bytes)
:param count (optional): Number of ping request to send
Output dictionary has one of following keys:
* success
* error
In case of success, inner dictionary will have the followin keys:
* probes_sent (int)
* packet_loss (int)
* rtt_min (float)
* rtt_max (float)
* rtt_avg (float)
* rtt_stddev (float)
* results (list)
'results' is a list of dictionaries with the following keys:
* ip_address (str)
* rtt (float)
Example::
{
'success': {
'probes_sent': 5,
'packet_loss': 0,
'rtt_min': 72.158,
'rtt_max': 72.433,
'rtt_avg': 72.268,
'rtt_stddev': 0.094,
'results': [
{
'ip_address': u'1.1.1.1',
'rtt': 72.248
},
{
'ip_address': '2.2.2.2',
'rtt': 72.299
}
]
}
}
OR
{
'error': 'unknown host 8.8.8.8.8'
} | entailment |
def run_commands(self, commands):
"""Only useful for EOS"""
if "eos" in self.profile:
return list(self.parent.cli(commands).values())[0]
else:
raise AttributeError("MockedDriver instance has not attribute '_rpc'") | Only useful for EOS | entailment |
def textfsm_extractor(cls, template_name, raw_text):
"""
Applies a TextFSM template over a raw text and return the matching table.
Main usage of this method will be to extract data form a non-structured output
from a network device and return the values in a table format.
:param cls: Instance of the driver class
:param template_name: Specifies the name of the template to be used
:param raw_text: Text output as the devices prompts on the CLI
:return: table-like list of entries
"""
textfsm_data = list()
cls.__class__.__name__.replace('Driver', '')
current_dir = os.path.dirname(os.path.abspath(sys.modules[cls.__module__].__file__))
template_dir_path = '{current_dir}/utils/textfsm_templates'.format(
current_dir=current_dir
)
template_path = '{template_dir_path}/{template_name}.tpl'.format(
template_dir_path=template_dir_path,
template_name=template_name
)
try:
fsm_handler = textfsm.TextFSM(open(template_path))
except IOError:
raise napalm_base.exceptions.TemplateNotImplemented(
"TextFSM template {template_name}.tpl is not defined under {path}".format(
template_name=template_name,
path=template_dir_path
)
)
except textfsm.TextFSMTemplateError as tfte:
raise napalm_base.exceptions.TemplateRenderException(
"Wrong format of TextFSM template {template_name}: {error}".format(
template_name=template_name,
error=py23_compat.text_type(tfte)
)
)
objects = fsm_handler.ParseText(raw_text)
for obj in objects:
index = 0
entry = {}
for entry_value in obj:
entry[fsm_handler.header[index].lower()] = entry_value
index += 1
textfsm_data.append(entry)
return textfsm_data | Applies a TextFSM template over a raw text and return the matching table.
Main usage of this method will be to extract data form a non-structured output
from a network device and return the values in a table format.
:param cls: Instance of the driver class
:param template_name: Specifies the name of the template to be used
:param raw_text: Text output as the devices prompts on the CLI
:return: table-like list of entries | entailment |
def find_txt(xml_tree, path, default=''):
"""
Extracts the text value from an XML tree, using XPath.
In case of error, will return a default value.
:param xml_tree: the XML Tree object. Assumed is <type 'lxml.etree._Element'>.
:param path: XPath to be applied, in order to extract the desired data.
:param default: Value to be returned in case of error.
:return: a str value.
"""
value = ''
try:
xpath_applied = xml_tree.xpath(path) # will consider the first match only
if len(xpath_applied) and xpath_applied[0] is not None:
xpath_result = xpath_applied[0]
if isinstance(xpath_result, type(xml_tree)):
value = xpath_result.text.strip()
else:
value = xpath_result
except Exception: # in case of any exception, returns default
value = default
return py23_compat.text_type(value) | Extracts the text value from an XML tree, using XPath.
In case of error, will return a default value.
:param xml_tree: the XML Tree object. Assumed is <type 'lxml.etree._Element'>.
:param path: XPath to be applied, in order to extract the desired data.
:param default: Value to be returned in case of error.
:return: a str value. | entailment |
def convert(to, who, default=u''):
"""
Converts data to a specific datatype.
In case of error, will return a default value.
:param to: datatype to be casted to.
:param who: value to cast.
:param default: value to return in case of error.
:return: a str value.
"""
if who is None:
return default
try:
return to(who)
except: # noqa
return default | Converts data to a specific datatype.
In case of error, will return a default value.
:param to: datatype to be casted to.
:param who: value to cast.
:param default: value to return in case of error.
:return: a str value. | entailment |
def mac(raw):
"""
Converts a raw string to a standardised MAC Address EUI Format.
:param raw: the raw string containing the value of the MAC Address
:return: a string with the MAC Address in EUI format
Example:
.. code-block:: python
>>> mac('0123.4567.89ab')
u'01:23:45:67:89:AB'
Some vendors like Cisco return MAC addresses like a9:c5:2e:7b:6: which is not entirely valid
(with respect to EUI48 or EUI64 standards). Therefore we need to stuff with trailing zeros
Example
>>> mac('a9:c5:2e:7b:6:')
u'A9:C5:2E:7B:60:00'
If Cisco or other obscure vendors use their own standards, will throw an error and we can fix
later, however, still works with weird formats like:
>>> mac('123.4567.89ab')
u'01:23:45:67:89:AB'
>>> mac('23.4567.89ab')
u'00:23:45:67:89:AB'
"""
if raw.endswith(':'):
flat_raw = raw.replace(':', '')
raw = '{flat_raw}{zeros_stuffed}'.format(
flat_raw=flat_raw,
zeros_stuffed='0'*(12-len(flat_raw))
)
return py23_compat.text_type(EUI(raw, dialect=_MACFormat)) | Converts a raw string to a standardised MAC Address EUI Format.
:param raw: the raw string containing the value of the MAC Address
:return: a string with the MAC Address in EUI format
Example:
.. code-block:: python
>>> mac('0123.4567.89ab')
u'01:23:45:67:89:AB'
Some vendors like Cisco return MAC addresses like a9:c5:2e:7b:6: which is not entirely valid
(with respect to EUI48 or EUI64 standards). Therefore we need to stuff with trailing zeros
Example
>>> mac('a9:c5:2e:7b:6:')
u'A9:C5:2E:7B:60:00'
If Cisco or other obscure vendors use their own standards, will throw an error and we can fix
later, however, still works with weird formats like:
>>> mac('123.4567.89ab')
u'01:23:45:67:89:AB'
>>> mac('23.4567.89ab')
u'00:23:45:67:89:AB' | entailment |
def compare_numeric(src_num, dst_num):
"""Compare numerical values. You can use '<%d','>%d'."""
dst_num = float(dst_num)
match = numeric_compare_regex.match(src_num)
if not match:
error = "Failed numeric comparison. Collected: {}. Expected: {}".format(dst_num, src_num)
raise ValueError(error)
operand = {
"<": "__lt__",
">": "__gt__",
">=": "__ge__",
"<=": "__le__",
"==": "__eq__",
"!=": "__ne__",
}
return getattr(dst_num, operand[match.group(1)])(float(match.group(2))) | Compare numerical values. You can use '<%d','>%d'. | entailment |
def colon_separated_string_to_dict(string, separator=':'):
'''
Converts a string in the format:
Name: Et3
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
MAC Address Learning: enabled
Access Mode VLAN: 3 (VLAN0003)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: disabled
Administrative private VLAN mapping: ALL
Trunking VLANs Enabled: 2-3,5-7,20-21,23,100-200
Trunk Groups:
into a dictionary
'''
dictionary = dict()
for line in string.splitlines():
line_data = line.split(separator)
if len(line_data) > 1:
dictionary[line_data[0].strip()] = ''.join(line_data[1:]).strip()
elif len(line_data) == 1:
dictionary[line_data[0].strip()] = None
else:
raise Exception('Something went wrong parsing the colo separated string {}'
.format(line))
return dictionary | Converts a string in the format:
Name: Et3
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
MAC Address Learning: enabled
Access Mode VLAN: 3 (VLAN0003)
Trunking Native Mode VLAN: 1 (default)
Administrative Native VLAN tagging: disabled
Administrative private VLAN mapping: ALL
Trunking VLANs Enabled: 2-3,5-7,20-21,23,100-200
Trunk Groups:
into a dictionary | entailment |
def hyphen_range(string):
'''
Expands a string of numbers separated by commas and hyphens into a list of integers.
For example: 2-3,5-7,20-21,23,100-200
'''
list_numbers = list()
temporary_list = string.split(',')
for element in temporary_list:
sub_element = element.split('-')
if len(sub_element) == 1:
list_numbers.append(int(sub_element[0]))
elif len(sub_element) == 2:
for x in range(int(sub_element[0]), int(sub_element[1])+1):
list_numbers.append(x)
else:
raise Exception('Something went wrong expanding the range'.format(string))
return list_numbers | Expands a string of numbers separated by commas and hyphens into a list of integers.
For example: 2-3,5-7,20-21,23,100-200 | entailment |
def convert_uptime_string_seconds(uptime):
'''Convert uptime strings to seconds. The string can be formatted various ways.'''
regex_list = [
# n years, n weeks, n days, n hours, n minutes where each of the fields except minutes
# is optional. Additionally, can be either singular or plural
(r"((?P<years>\d+) year(s)?,\s+)?((?P<weeks>\d+) week(s)?,\s+)?"
r"((?P<days>\d+) day(s)?,\s+)?((?P<hours>\d+) "
r"hour(s)?,\s+)?((?P<minutes>\d+) minute(s)?)"),
# n days, HH:MM:SS where each field is required (except for days)
(r"((?P<days>\d+) day(s)?,\s+)?"
r"((?P<hours>\d+)):((?P<minutes>\d+)):((?P<seconds>\d+))"),
# 7w6d5h4m3s where each field is optional
(r"((?P<weeks>\d+)w)?((?P<days>\d+)d)?((?P<hours>\d+)h)?"
r"((?P<minutes>\d+)m)?((?P<seconds>\d+)s)?"),
]
regex_list = [re.compile(x) for x in regex_list]
uptime_dict = {}
for regex in regex_list:
match = regex.search(uptime)
if match:
uptime_dict = match.groupdict()
break
uptime_seconds = 0
for unit, value in uptime_dict.items():
if value is not None:
if unit == 'years':
uptime_seconds += int(value) * 31536000
elif unit == 'weeks':
uptime_seconds += int(value) * 604800
elif unit == 'days':
uptime_seconds += int(value) * 86400
elif unit == 'hours':
uptime_seconds += int(value) * 3600
elif unit == 'minutes':
uptime_seconds += int(value) * 60
elif unit == 'seconds':
uptime_seconds += int(value)
else:
raise Exception('Unrecognized unit "{}" in uptime:{}'.format(unit, uptime))
if not uptime_dict:
raise Exception('Unrecognized uptime string:{}'.format(uptime))
return uptime_seconds | Convert uptime strings to seconds. The string can be formatted various ways. | entailment |
def create_endpoint(EndpointIdentifier=None, EndpointType=None, EngineName=None, Username=None, Password=None, ServerName=None, Port=None, DatabaseName=None, ExtraConnectionAttributes=None, KmsKeyId=None, Tags=None, CertificateArn=None, SslMode=None, DynamoDbSettings=None, S3Settings=None, MongoDbSettings=None):
"""
Creates an endpoint using the provided settings.
See also: AWS API Documentation
:example: response = client.create_endpoint(
EndpointIdentifier='string',
EndpointType='source'|'target',
EngineName='string',
Username='string',
Password='string',
ServerName='string',
Port=123,
DatabaseName='string',
ExtraConnectionAttributes='string',
KmsKeyId='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
CertificateArn='string',
SslMode='none'|'require'|'verify-ca'|'verify-full',
DynamoDbSettings={
'ServiceAccessRoleArn': 'string'
},
S3Settings={
'ServiceAccessRoleArn': 'string',
'ExternalTableDefinition': 'string',
'CsvRowDelimiter': 'string',
'CsvDelimiter': 'string',
'BucketFolder': 'string',
'BucketName': 'string',
'CompressionType': 'none'|'gzip'
},
MongoDbSettings={
'Username': 'string',
'Password': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'AuthType': 'no'|'password',
'AuthMechanism': 'default'|'mongodb_cr'|'scram_sha_1',
'NestingLevel': 'none'|'one',
'ExtractDocId': 'string',
'DocsToInvestigate': 'string',
'AuthSource': 'string'
}
)
:type EndpointIdentifier: string
:param EndpointIdentifier: [REQUIRED]
The database endpoint identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.
:type EndpointType: string
:param EndpointType: [REQUIRED]
The type of endpoint.
:type EngineName: string
:param EngineName: [REQUIRED]
The type of engine for the endpoint. Valid values, depending on the EndPointType, include MYSQL, ORACLE, POSTGRES, MARIADB, AURORA, REDSHIFT, S3, SYBASE, DYNAMODB, MONGODB, and SQLSERVER.
:type Username: string
:param Username: The user name to be used to login to the endpoint database.
:type Password: string
:param Password: The password to be used to login to the endpoint database.
:type ServerName: string
:param ServerName: The name of the server where the endpoint database resides.
:type Port: integer
:param Port: The port used by the endpoint database.
:type DatabaseName: string
:param DatabaseName: The name of the endpoint database.
:type ExtraConnectionAttributes: string
:param ExtraConnectionAttributes: Additional attributes associated with the connection.
:type KmsKeyId: string
:param KmsKeyId: The KMS key identifier that will be used to encrypt the connection parameters. If you do not specify a value for the KmsKeyId parameter, then AWS DMS will use your default encryption key. AWS KMS creates the default encryption key for your AWS account. Your AWS account has a different default encryption key for each AWS region.
:type Tags: list
:param Tags: Tags to be added to the endpoint.
(dict) --
Key (string) --A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
Value (string) --A value is the optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
:type CertificateArn: string
:param CertificateArn: The Amazon Resource Number (ARN) for the certificate.
:type SslMode: string
:param SslMode: The SSL mode to use for the SSL connection.
SSL mode can be one of four values: none, require, verify-ca, verify-full.
The default value is none.
:type DynamoDbSettings: dict
:param DynamoDbSettings: Settings in JSON format for the target Amazon DynamoDB endpoint. For more information about the available settings, see the Using Object Mapping to Migrate Data to DynamoDB section at Using an Amazon DynamoDB Database as a Target for AWS Database Migration Service .
ServiceAccessRoleArn (string) -- [REQUIRED]The Amazon Resource Name (ARN) used by the service access IAM role.
:type S3Settings: dict
:param S3Settings: Settings in JSON format for the target S3 endpoint. For more information about the available settings, see the Extra Connection Attributes section at Using Amazon S3 as a Target for AWS Database Migration Service .
ServiceAccessRoleArn (string) --The Amazon Resource Name (ARN) used by the service access IAM role.
ExternalTableDefinition (string) --
CsvRowDelimiter (string) --The delimiter used to separate rows in the source files. The default is a carriage return (n).
CsvDelimiter (string) --The delimiter used to separate columns in the source files. The default is a comma.
BucketFolder (string) --An optional parameter to set a folder name in the S3 bucket. If provided, tables are created in the path bucketFolder/schema_name/table_name/. If this parameter is not specified, then the path used is schema_name/table_name/.
BucketName (string) --The name of the S3 bucket.
CompressionType (string) --An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files. Set to NONE (the default) or do not use to leave the files uncompressed.
:type MongoDbSettings: dict
:param MongoDbSettings: Settings in JSON format for the source MongoDB endpoint. For more information about the available settings, see the Configuration Properties When Using MongoDB as a Source for AWS Database Migration Service section at Using Amazon S3 as a Target for AWS Database Migration Service .
Username (string) --The user name you use to access the MongoDB source endpoint.
Password (string) --The password for the user account you use to access the MongoDB source endpoint.
ServerName (string) --The name of the server on the MongoDB source endpoint.
Port (integer) --The port value for the MongoDB source endpoint.
DatabaseName (string) --The database name on the MongoDB source endpoint.
AuthType (string) --The authentication type you use to access the MongoDB source endpoint.
Valid values: NO, PASSWORD
When NO is selected, user name and password parameters are not used and can be empty.
AuthMechanism (string) --The authentication mechanism you use to access the MongoDB source endpoint.
Valid values: DEFAULT, MONGODB_CR, SCRAM_SHA_1
DEFAULT For MongoDB version 2.x, use MONGODB_CR. For MongoDB version 3.x, use SCRAM_SHA_1. This attribute is not used when authType=No.
NestingLevel (string) --Specifies either document or table mode.
Valid values: NONE, ONE
Default value is NONE. Specify NONE to use document mode. Specify ONE to use table mode.
ExtractDocId (string) --Specifies the document ID. Use this attribute when NestingLevel is set to NONE.
Default value is false.
DocsToInvestigate (string) --Indicates the number of documents to preview to determine the document organization. Use this attribute when NestingLevel is set to ONE.
Must be a positive value greater than 0. Default value is 1000.
AuthSource (string) --The MongoDB database name. This attribute is not used when authType=NO .
The default is admin.
:rtype: dict
:return: {
'Endpoint': {
'EndpointIdentifier': 'string',
'EndpointType': 'source'|'target',
'EngineName': 'string',
'Username': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'ExtraConnectionAttributes': 'string',
'Status': 'string',
'KmsKeyId': 'string',
'EndpointArn': 'string',
'CertificateArn': 'string',
'SslMode': 'none'|'require'|'verify-ca'|'verify-full',
'ExternalId': 'string',
'DynamoDbSettings': {
'ServiceAccessRoleArn': 'string'
},
'S3Settings': {
'ServiceAccessRoleArn': 'string',
'ExternalTableDefinition': 'string',
'CsvRowDelimiter': 'string',
'CsvDelimiter': 'string',
'BucketFolder': 'string',
'BucketName': 'string',
'CompressionType': 'none'|'gzip'
},
'MongoDbSettings': {
'Username': 'string',
'Password': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'AuthType': 'no'|'password',
'AuthMechanism': 'default'|'mongodb_cr'|'scram_sha_1',
'NestingLevel': 'none'|'one',
'ExtractDocId': 'string',
'DocsToInvestigate': 'string',
'AuthSource': 'string'
}
}
}
"""
pass | Creates an endpoint using the provided settings.
See also: AWS API Documentation
:example: response = client.create_endpoint(
EndpointIdentifier='string',
EndpointType='source'|'target',
EngineName='string',
Username='string',
Password='string',
ServerName='string',
Port=123,
DatabaseName='string',
ExtraConnectionAttributes='string',
KmsKeyId='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
CertificateArn='string',
SslMode='none'|'require'|'verify-ca'|'verify-full',
DynamoDbSettings={
'ServiceAccessRoleArn': 'string'
},
S3Settings={
'ServiceAccessRoleArn': 'string',
'ExternalTableDefinition': 'string',
'CsvRowDelimiter': 'string',
'CsvDelimiter': 'string',
'BucketFolder': 'string',
'BucketName': 'string',
'CompressionType': 'none'|'gzip'
},
MongoDbSettings={
'Username': 'string',
'Password': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'AuthType': 'no'|'password',
'AuthMechanism': 'default'|'mongodb_cr'|'scram_sha_1',
'NestingLevel': 'none'|'one',
'ExtractDocId': 'string',
'DocsToInvestigate': 'string',
'AuthSource': 'string'
}
)
:type EndpointIdentifier: string
:param EndpointIdentifier: [REQUIRED]
The database endpoint identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.
:type EndpointType: string
:param EndpointType: [REQUIRED]
The type of endpoint.
:type EngineName: string
:param EngineName: [REQUIRED]
The type of engine for the endpoint. Valid values, depending on the EndPointType, include MYSQL, ORACLE, POSTGRES, MARIADB, AURORA, REDSHIFT, S3, SYBASE, DYNAMODB, MONGODB, and SQLSERVER.
:type Username: string
:param Username: The user name to be used to login to the endpoint database.
:type Password: string
:param Password: The password to be used to login to the endpoint database.
:type ServerName: string
:param ServerName: The name of the server where the endpoint database resides.
:type Port: integer
:param Port: The port used by the endpoint database.
:type DatabaseName: string
:param DatabaseName: The name of the endpoint database.
:type ExtraConnectionAttributes: string
:param ExtraConnectionAttributes: Additional attributes associated with the connection.
:type KmsKeyId: string
:param KmsKeyId: The KMS key identifier that will be used to encrypt the connection parameters. If you do not specify a value for the KmsKeyId parameter, then AWS DMS will use your default encryption key. AWS KMS creates the default encryption key for your AWS account. Your AWS account has a different default encryption key for each AWS region.
:type Tags: list
:param Tags: Tags to be added to the endpoint.
(dict) --
Key (string) --A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
Value (string) --A value is the optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
:type CertificateArn: string
:param CertificateArn: The Amazon Resource Number (ARN) for the certificate.
:type SslMode: string
:param SslMode: The SSL mode to use for the SSL connection.
SSL mode can be one of four values: none, require, verify-ca, verify-full.
The default value is none.
:type DynamoDbSettings: dict
:param DynamoDbSettings: Settings in JSON format for the target Amazon DynamoDB endpoint. For more information about the available settings, see the Using Object Mapping to Migrate Data to DynamoDB section at Using an Amazon DynamoDB Database as a Target for AWS Database Migration Service .
ServiceAccessRoleArn (string) -- [REQUIRED]The Amazon Resource Name (ARN) used by the service access IAM role.
:type S3Settings: dict
:param S3Settings: Settings in JSON format for the target S3 endpoint. For more information about the available settings, see the Extra Connection Attributes section at Using Amazon S3 as a Target for AWS Database Migration Service .
ServiceAccessRoleArn (string) --The Amazon Resource Name (ARN) used by the service access IAM role.
ExternalTableDefinition (string) --
CsvRowDelimiter (string) --The delimiter used to separate rows in the source files. The default is a carriage return (n).
CsvDelimiter (string) --The delimiter used to separate columns in the source files. The default is a comma.
BucketFolder (string) --An optional parameter to set a folder name in the S3 bucket. If provided, tables are created in the path bucketFolder/schema_name/table_name/. If this parameter is not specified, then the path used is schema_name/table_name/.
BucketName (string) --The name of the S3 bucket.
CompressionType (string) --An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files. Set to NONE (the default) or do not use to leave the files uncompressed.
:type MongoDbSettings: dict
:param MongoDbSettings: Settings in JSON format for the source MongoDB endpoint. For more information about the available settings, see the Configuration Properties When Using MongoDB as a Source for AWS Database Migration Service section at Using Amazon S3 as a Target for AWS Database Migration Service .
Username (string) --The user name you use to access the MongoDB source endpoint.
Password (string) --The password for the user account you use to access the MongoDB source endpoint.
ServerName (string) --The name of the server on the MongoDB source endpoint.
Port (integer) --The port value for the MongoDB source endpoint.
DatabaseName (string) --The database name on the MongoDB source endpoint.
AuthType (string) --The authentication type you use to access the MongoDB source endpoint.
Valid values: NO, PASSWORD
When NO is selected, user name and password parameters are not used and can be empty.
AuthMechanism (string) --The authentication mechanism you use to access the MongoDB source endpoint.
Valid values: DEFAULT, MONGODB_CR, SCRAM_SHA_1
DEFAULT For MongoDB version 2.x, use MONGODB_CR. For MongoDB version 3.x, use SCRAM_SHA_1. This attribute is not used when authType=No.
NestingLevel (string) --Specifies either document or table mode.
Valid values: NONE, ONE
Default value is NONE. Specify NONE to use document mode. Specify ONE to use table mode.
ExtractDocId (string) --Specifies the document ID. Use this attribute when NestingLevel is set to NONE.
Default value is false.
DocsToInvestigate (string) --Indicates the number of documents to preview to determine the document organization. Use this attribute when NestingLevel is set to ONE.
Must be a positive value greater than 0. Default value is 1000.
AuthSource (string) --The MongoDB database name. This attribute is not used when authType=NO .
The default is admin.
:rtype: dict
:return: {
'Endpoint': {
'EndpointIdentifier': 'string',
'EndpointType': 'source'|'target',
'EngineName': 'string',
'Username': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'ExtraConnectionAttributes': 'string',
'Status': 'string',
'KmsKeyId': 'string',
'EndpointArn': 'string',
'CertificateArn': 'string',
'SslMode': 'none'|'require'|'verify-ca'|'verify-full',
'ExternalId': 'string',
'DynamoDbSettings': {
'ServiceAccessRoleArn': 'string'
},
'S3Settings': {
'ServiceAccessRoleArn': 'string',
'ExternalTableDefinition': 'string',
'CsvRowDelimiter': 'string',
'CsvDelimiter': 'string',
'BucketFolder': 'string',
'BucketName': 'string',
'CompressionType': 'none'|'gzip'
},
'MongoDbSettings': {
'Username': 'string',
'Password': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'AuthType': 'no'|'password',
'AuthMechanism': 'default'|'mongodb_cr'|'scram_sha_1',
'NestingLevel': 'none'|'one',
'ExtractDocId': 'string',
'DocsToInvestigate': 'string',
'AuthSource': 'string'
}
}
} | entailment |
def create_replication_instance(ReplicationInstanceIdentifier=None, AllocatedStorage=None, ReplicationInstanceClass=None, VpcSecurityGroupIds=None, AvailabilityZone=None, ReplicationSubnetGroupIdentifier=None, PreferredMaintenanceWindow=None, MultiAZ=None, EngineVersion=None, AutoMinorVersionUpgrade=None, Tags=None, KmsKeyId=None, PubliclyAccessible=None):
"""
Creates the replication instance using the specified parameters.
See also: AWS API Documentation
:example: response = client.create_replication_instance(
ReplicationInstanceIdentifier='string',
AllocatedStorage=123,
ReplicationInstanceClass='string',
VpcSecurityGroupIds=[
'string',
],
AvailabilityZone='string',
ReplicationSubnetGroupIdentifier='string',
PreferredMaintenanceWindow='string',
MultiAZ=True|False,
EngineVersion='string',
AutoMinorVersionUpgrade=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
KmsKeyId='string',
PubliclyAccessible=True|False
)
:type ReplicationInstanceIdentifier: string
:param ReplicationInstanceIdentifier: [REQUIRED]
The replication instance identifier. This parameter is stored as a lowercase string.
Constraints:
Must contain from 1 to 63 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens.
Example: myrepinstance
:type AllocatedStorage: integer
:param AllocatedStorage: The amount of storage (in gigabytes) to be initially allocated for the replication instance.
:type ReplicationInstanceClass: string
:param ReplicationInstanceClass: [REQUIRED]
The compute and memory capacity of the replication instance as specified by the replication instance class.
Valid Values: dms.t2.micro | dms.t2.small | dms.t2.medium | dms.t2.large | dms.c4.large | dms.c4.xlarge | dms.c4.2xlarge | dms.c4.4xlarge
:type VpcSecurityGroupIds: list
:param VpcSecurityGroupIds: Specifies the VPC security group to be used with the replication instance. The VPC security group must work with the VPC containing the replication instance.
(string) --
:type AvailabilityZone: string
:param AvailabilityZone: The EC2 Availability Zone that the replication instance will be created in.
Default: A random, system-chosen Availability Zone in the endpoint's region.
Example: us-east-1d
:type ReplicationSubnetGroupIdentifier: string
:param ReplicationSubnetGroupIdentifier: A subnet group to associate with the replication instance.
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).
Format: ddd:hh24:mi-ddd:hh24:mi
Default: A 30-minute window selected at random from an 8-hour block of time per region, occurring on a random day of the week.
Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
Constraints: Minimum 30-minute window.
:type MultiAZ: boolean
:param MultiAZ: Specifies if the replication instance is a Multi-AZ deployment. You cannot set the AvailabilityZone parameter if the Multi-AZ parameter is set to true .
:type EngineVersion: string
:param EngineVersion: The engine version number of the replication instance.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: Indicates that minor engine upgrades will be applied automatically to the replication instance during the maintenance window.
Default: true
:type Tags: list
:param Tags: Tags to be associated with the replication instance.
(dict) --
Key (string) --A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
Value (string) --A value is the optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
:type KmsKeyId: string
:param KmsKeyId: The KMS key identifier that will be used to encrypt the content on the replication instance. If you do not specify a value for the KmsKeyId parameter, then AWS DMS will use your default encryption key. AWS KMS creates the default encryption key for your AWS account. Your AWS account has a different default encryption key for each AWS region.
:type PubliclyAccessible: boolean
:param PubliclyAccessible: Specifies the accessibility options for the replication instance. A value of true represents an instance with a public IP address. A value of false represents an instance with a private IP address. The default value is true .
:rtype: dict
:return: {
'ReplicationInstance': {
'ReplicationInstanceIdentifier': 'string',
'ReplicationInstanceClass': 'string',
'ReplicationInstanceStatus': 'string',
'AllocatedStorage': 123,
'InstanceCreateTime': datetime(2015, 1, 1),
'VpcSecurityGroups': [
{
'VpcSecurityGroupId': 'string',
'Status': 'string'
},
],
'AvailabilityZone': 'string',
'ReplicationSubnetGroup': {
'ReplicationSubnetGroupIdentifier': 'string',
'ReplicationSubnetGroupDescription': 'string',
'VpcId': 'string',
'SubnetGroupStatus': 'string',
'Subnets': [
{
'SubnetIdentifier': 'string',
'SubnetAvailabilityZone': {
'Name': 'string'
},
'SubnetStatus': 'string'
},
]
},
'PreferredMaintenanceWindow': 'string',
'PendingModifiedValues': {
'ReplicationInstanceClass': 'string',
'AllocatedStorage': 123,
'MultiAZ': True|False,
'EngineVersion': 'string'
},
'MultiAZ': True|False,
'EngineVersion': 'string',
'AutoMinorVersionUpgrade': True|False,
'KmsKeyId': 'string',
'ReplicationInstanceArn': 'string',
'ReplicationInstancePublicIpAddress': 'string',
'ReplicationInstancePrivateIpAddress': 'string',
'ReplicationInstancePublicIpAddresses': [
'string',
],
'ReplicationInstancePrivateIpAddresses': [
'string',
],
'PubliclyAccessible': True|False,
'SecondaryAvailabilityZone': 'string'
}
}
:returns:
Must contain from 1 to 63 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens.
"""
pass | Creates the replication instance using the specified parameters.
See also: AWS API Documentation
:example: response = client.create_replication_instance(
ReplicationInstanceIdentifier='string',
AllocatedStorage=123,
ReplicationInstanceClass='string',
VpcSecurityGroupIds=[
'string',
],
AvailabilityZone='string',
ReplicationSubnetGroupIdentifier='string',
PreferredMaintenanceWindow='string',
MultiAZ=True|False,
EngineVersion='string',
AutoMinorVersionUpgrade=True|False,
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
KmsKeyId='string',
PubliclyAccessible=True|False
)
:type ReplicationInstanceIdentifier: string
:param ReplicationInstanceIdentifier: [REQUIRED]
The replication instance identifier. This parameter is stored as a lowercase string.
Constraints:
Must contain from 1 to 63 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens.
Example: myrepinstance
:type AllocatedStorage: integer
:param AllocatedStorage: The amount of storage (in gigabytes) to be initially allocated for the replication instance.
:type ReplicationInstanceClass: string
:param ReplicationInstanceClass: [REQUIRED]
The compute and memory capacity of the replication instance as specified by the replication instance class.
Valid Values: dms.t2.micro | dms.t2.small | dms.t2.medium | dms.t2.large | dms.c4.large | dms.c4.xlarge | dms.c4.2xlarge | dms.c4.4xlarge
:type VpcSecurityGroupIds: list
:param VpcSecurityGroupIds: Specifies the VPC security group to be used with the replication instance. The VPC security group must work with the VPC containing the replication instance.
(string) --
:type AvailabilityZone: string
:param AvailabilityZone: The EC2 Availability Zone that the replication instance will be created in.
Default: A random, system-chosen Availability Zone in the endpoint's region.
Example: us-east-1d
:type ReplicationSubnetGroupIdentifier: string
:param ReplicationSubnetGroupIdentifier: A subnet group to associate with the replication instance.
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: The weekly time range during which system maintenance can occur, in Universal Coordinated Time (UTC).
Format: ddd:hh24:mi-ddd:hh24:mi
Default: A 30-minute window selected at random from an 8-hour block of time per region, occurring on a random day of the week.
Valid Days: Mon, Tue, Wed, Thu, Fri, Sat, Sun
Constraints: Minimum 30-minute window.
:type MultiAZ: boolean
:param MultiAZ: Specifies if the replication instance is a Multi-AZ deployment. You cannot set the AvailabilityZone parameter if the Multi-AZ parameter is set to true .
:type EngineVersion: string
:param EngineVersion: The engine version number of the replication instance.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: Indicates that minor engine upgrades will be applied automatically to the replication instance during the maintenance window.
Default: true
:type Tags: list
:param Tags: Tags to be associated with the replication instance.
(dict) --
Key (string) --A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
Value (string) --A value is the optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
:type KmsKeyId: string
:param KmsKeyId: The KMS key identifier that will be used to encrypt the content on the replication instance. If you do not specify a value for the KmsKeyId parameter, then AWS DMS will use your default encryption key. AWS KMS creates the default encryption key for your AWS account. Your AWS account has a different default encryption key for each AWS region.
:type PubliclyAccessible: boolean
:param PubliclyAccessible: Specifies the accessibility options for the replication instance. A value of true represents an instance with a public IP address. A value of false represents an instance with a private IP address. The default value is true .
:rtype: dict
:return: {
'ReplicationInstance': {
'ReplicationInstanceIdentifier': 'string',
'ReplicationInstanceClass': 'string',
'ReplicationInstanceStatus': 'string',
'AllocatedStorage': 123,
'InstanceCreateTime': datetime(2015, 1, 1),
'VpcSecurityGroups': [
{
'VpcSecurityGroupId': 'string',
'Status': 'string'
},
],
'AvailabilityZone': 'string',
'ReplicationSubnetGroup': {
'ReplicationSubnetGroupIdentifier': 'string',
'ReplicationSubnetGroupDescription': 'string',
'VpcId': 'string',
'SubnetGroupStatus': 'string',
'Subnets': [
{
'SubnetIdentifier': 'string',
'SubnetAvailabilityZone': {
'Name': 'string'
},
'SubnetStatus': 'string'
},
]
},
'PreferredMaintenanceWindow': 'string',
'PendingModifiedValues': {
'ReplicationInstanceClass': 'string',
'AllocatedStorage': 123,
'MultiAZ': True|False,
'EngineVersion': 'string'
},
'MultiAZ': True|False,
'EngineVersion': 'string',
'AutoMinorVersionUpgrade': True|False,
'KmsKeyId': 'string',
'ReplicationInstanceArn': 'string',
'ReplicationInstancePublicIpAddress': 'string',
'ReplicationInstancePrivateIpAddress': 'string',
'ReplicationInstancePublicIpAddresses': [
'string',
],
'ReplicationInstancePrivateIpAddresses': [
'string',
],
'PubliclyAccessible': True|False,
'SecondaryAvailabilityZone': 'string'
}
}
:returns:
Must contain from 1 to 63 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens. | entailment |
def create_replication_task(ReplicationTaskIdentifier=None, SourceEndpointArn=None, TargetEndpointArn=None, ReplicationInstanceArn=None, MigrationType=None, TableMappings=None, ReplicationTaskSettings=None, CdcStartTime=None, Tags=None):
"""
Creates a replication task using the specified parameters.
See also: AWS API Documentation
:example: response = client.create_replication_task(
ReplicationTaskIdentifier='string',
SourceEndpointArn='string',
TargetEndpointArn='string',
ReplicationInstanceArn='string',
MigrationType='full-load'|'cdc'|'full-load-and-cdc',
TableMappings='string',
ReplicationTaskSettings='string',
CdcStartTime=datetime(2015, 1, 1),
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
:type ReplicationTaskIdentifier: string
:param ReplicationTaskIdentifier: [REQUIRED]
The replication task identifier.
Constraints:
Must contain from 1 to 255 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens.
:type SourceEndpointArn: string
:param SourceEndpointArn: [REQUIRED]
The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
:type TargetEndpointArn: string
:param TargetEndpointArn: [REQUIRED]
The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
:type ReplicationInstanceArn: string
:param ReplicationInstanceArn: [REQUIRED]
The Amazon Resource Name (ARN) of the replication instance.
:type MigrationType: string
:param MigrationType: [REQUIRED]
The migration type.
:type TableMappings: string
:param TableMappings: [REQUIRED]
When using the AWS CLI or boto3, provide the path of the JSON file that contains the table mappings. Precede the path with 'file://'. When working with the DMS API, provide the JSON as the parameter value.
For example, --table-mappings file://mappingfile.json
:type ReplicationTaskSettings: string
:param ReplicationTaskSettings: Settings for the task, such as target metadata settings. For a complete list of task settings, see Task Settings for AWS Database Migration Service Tasks .
:type CdcStartTime: datetime
:param CdcStartTime: The start time for the Change Data Capture (CDC) operation.
:type Tags: list
:param Tags: Tags to be added to the replication instance.
(dict) --
Key (string) --A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
Value (string) --A value is the optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
:rtype: dict
:return: {
'ReplicationTask': {
'ReplicationTaskIdentifier': 'string',
'SourceEndpointArn': 'string',
'TargetEndpointArn': 'string',
'ReplicationInstanceArn': 'string',
'MigrationType': 'full-load'|'cdc'|'full-load-and-cdc',
'TableMappings': 'string',
'ReplicationTaskSettings': 'string',
'Status': 'string',
'LastFailureMessage': 'string',
'StopReason': 'string',
'ReplicationTaskCreationDate': datetime(2015, 1, 1),
'ReplicationTaskStartDate': datetime(2015, 1, 1),
'ReplicationTaskArn': 'string',
'ReplicationTaskStats': {
'FullLoadProgressPercent': 123,
'ElapsedTimeMillis': 123,
'TablesLoaded': 123,
'TablesLoading': 123,
'TablesQueued': 123,
'TablesErrored': 123
}
}
}
:returns:
Must contain from 1 to 255 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens.
"""
pass | Creates a replication task using the specified parameters.
See also: AWS API Documentation
:example: response = client.create_replication_task(
ReplicationTaskIdentifier='string',
SourceEndpointArn='string',
TargetEndpointArn='string',
ReplicationInstanceArn='string',
MigrationType='full-load'|'cdc'|'full-load-and-cdc',
TableMappings='string',
ReplicationTaskSettings='string',
CdcStartTime=datetime(2015, 1, 1),
Tags=[
{
'Key': 'string',
'Value': 'string'
},
]
)
:type ReplicationTaskIdentifier: string
:param ReplicationTaskIdentifier: [REQUIRED]
The replication task identifier.
Constraints:
Must contain from 1 to 255 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens.
:type SourceEndpointArn: string
:param SourceEndpointArn: [REQUIRED]
The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
:type TargetEndpointArn: string
:param TargetEndpointArn: [REQUIRED]
The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
:type ReplicationInstanceArn: string
:param ReplicationInstanceArn: [REQUIRED]
The Amazon Resource Name (ARN) of the replication instance.
:type MigrationType: string
:param MigrationType: [REQUIRED]
The migration type.
:type TableMappings: string
:param TableMappings: [REQUIRED]
When using the AWS CLI or boto3, provide the path of the JSON file that contains the table mappings. Precede the path with 'file://'. When working with the DMS API, provide the JSON as the parameter value.
For example, --table-mappings file://mappingfile.json
:type ReplicationTaskSettings: string
:param ReplicationTaskSettings: Settings for the task, such as target metadata settings. For a complete list of task settings, see Task Settings for AWS Database Migration Service Tasks .
:type CdcStartTime: datetime
:param CdcStartTime: The start time for the Change Data Capture (CDC) operation.
:type Tags: list
:param Tags: Tags to be added to the replication instance.
(dict) --
Key (string) --A key is the required name of the tag. The string value can be from 1 to 128 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
Value (string) --A value is the optional value of the tag. The string value can be from 1 to 256 Unicode characters in length and cannot be prefixed with 'aws:' or 'dms:'. The string can only contain only the set of Unicode letters, digits, white-space, '_', '.', '/', '=', '+', '-' (Java regex: '^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$').
:rtype: dict
:return: {
'ReplicationTask': {
'ReplicationTaskIdentifier': 'string',
'SourceEndpointArn': 'string',
'TargetEndpointArn': 'string',
'ReplicationInstanceArn': 'string',
'MigrationType': 'full-load'|'cdc'|'full-load-and-cdc',
'TableMappings': 'string',
'ReplicationTaskSettings': 'string',
'Status': 'string',
'LastFailureMessage': 'string',
'StopReason': 'string',
'ReplicationTaskCreationDate': datetime(2015, 1, 1),
'ReplicationTaskStartDate': datetime(2015, 1, 1),
'ReplicationTaskArn': 'string',
'ReplicationTaskStats': {
'FullLoadProgressPercent': 123,
'ElapsedTimeMillis': 123,
'TablesLoaded': 123,
'TablesLoading': 123,
'TablesQueued': 123,
'TablesErrored': 123
}
}
}
:returns:
Must contain from 1 to 255 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens. | entailment |
def describe_events(SourceIdentifier=None, SourceType=None, StartTime=None, EndTime=None, Duration=None, EventCategories=None, Filters=None, MaxRecords=None, Marker=None):
"""
Lists events for a given source identifier and source type. You can also specify a start and end time. For more information on AWS DMS events, see Working with Events and Notifications .
See also: AWS API Documentation
:example: response = client.describe_events(
SourceIdentifier='string',
SourceType='replication-instance',
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
Duration=123,
EventCategories=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
MaxRecords=123,
Marker='string'
)
:type SourceIdentifier: string
:param SourceIdentifier: The identifier of the event source. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens. It cannot end with a hyphen or contain two consecutive hyphens.
:type SourceType: string
:param SourceType: The type of AWS DMS resource that generates events.
Valid values: replication-instance | migration-task
:type StartTime: datetime
:param StartTime: The start time for the events to be listed.
:type EndTime: datetime
:param EndTime: The end time for the events to be listed.
:type Duration: integer
:param Duration: The duration of the events to be listed.
:type EventCategories: list
:param EventCategories: A list of event categories for a source type that you want to subscribe to.
(string) --
:type Filters: list
:param Filters: Filters applied to the action.
(dict) --
Name (string) -- [REQUIRED]The name of the filter.
Values (list) -- [REQUIRED]The filter value.
(string) --
:type MaxRecords: integer
:param MaxRecords: The maximum number of records to include in the response. If more records exist than the specified MaxRecords value, a pagination token called a marker is included in the response so that the remaining results can be retrieved.
Default: 100
Constraints: Minimum 20, maximum 100.
:type Marker: string
:param Marker: An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by MaxRecords .
:rtype: dict
:return: {
'Marker': 'string',
'Events': [
{
'SourceIdentifier': 'string',
'SourceType': 'replication-instance',
'Message': 'string',
'EventCategories': [
'string',
],
'Date': datetime(2015, 1, 1)
},
]
}
:returns:
(string) --
"""
pass | Lists events for a given source identifier and source type. You can also specify a start and end time. For more information on AWS DMS events, see Working with Events and Notifications .
See also: AWS API Documentation
:example: response = client.describe_events(
SourceIdentifier='string',
SourceType='replication-instance',
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
Duration=123,
EventCategories=[
'string',
],
Filters=[
{
'Name': 'string',
'Values': [
'string',
]
},
],
MaxRecords=123,
Marker='string'
)
:type SourceIdentifier: string
:param SourceIdentifier: The identifier of the event source. An identifier must begin with a letter and must contain only ASCII letters, digits, and hyphens. It cannot end with a hyphen or contain two consecutive hyphens.
:type SourceType: string
:param SourceType: The type of AWS DMS resource that generates events.
Valid values: replication-instance | migration-task
:type StartTime: datetime
:param StartTime: The start time for the events to be listed.
:type EndTime: datetime
:param EndTime: The end time for the events to be listed.
:type Duration: integer
:param Duration: The duration of the events to be listed.
:type EventCategories: list
:param EventCategories: A list of event categories for a source type that you want to subscribe to.
(string) --
:type Filters: list
:param Filters: Filters applied to the action.
(dict) --
Name (string) -- [REQUIRED]The name of the filter.
Values (list) -- [REQUIRED]The filter value.
(string) --
:type MaxRecords: integer
:param MaxRecords: The maximum number of records to include in the response. If more records exist than the specified MaxRecords value, a pagination token called a marker is included in the response so that the remaining results can be retrieved.
Default: 100
Constraints: Minimum 20, maximum 100.
:type Marker: string
:param Marker: An optional pagination token provided by a previous request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by MaxRecords .
:rtype: dict
:return: {
'Marker': 'string',
'Events': [
{
'SourceIdentifier': 'string',
'SourceType': 'replication-instance',
'Message': 'string',
'EventCategories': [
'string',
],
'Date': datetime(2015, 1, 1)
},
]
}
:returns:
(string) -- | entailment |
def modify_endpoint(EndpointArn=None, EndpointIdentifier=None, EndpointType=None, EngineName=None, Username=None, Password=None, ServerName=None, Port=None, DatabaseName=None, ExtraConnectionAttributes=None, CertificateArn=None, SslMode=None, DynamoDbSettings=None, S3Settings=None, MongoDbSettings=None):
"""
Modifies the specified endpoint.
See also: AWS API Documentation
:example: response = client.modify_endpoint(
EndpointArn='string',
EndpointIdentifier='string',
EndpointType='source'|'target',
EngineName='string',
Username='string',
Password='string',
ServerName='string',
Port=123,
DatabaseName='string',
ExtraConnectionAttributes='string',
CertificateArn='string',
SslMode='none'|'require'|'verify-ca'|'verify-full',
DynamoDbSettings={
'ServiceAccessRoleArn': 'string'
},
S3Settings={
'ServiceAccessRoleArn': 'string',
'ExternalTableDefinition': 'string',
'CsvRowDelimiter': 'string',
'CsvDelimiter': 'string',
'BucketFolder': 'string',
'BucketName': 'string',
'CompressionType': 'none'|'gzip'
},
MongoDbSettings={
'Username': 'string',
'Password': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'AuthType': 'no'|'password',
'AuthMechanism': 'default'|'mongodb_cr'|'scram_sha_1',
'NestingLevel': 'none'|'one',
'ExtractDocId': 'string',
'DocsToInvestigate': 'string',
'AuthSource': 'string'
}
)
:type EndpointArn: string
:param EndpointArn: [REQUIRED]
The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
:type EndpointIdentifier: string
:param EndpointIdentifier: The database endpoint identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.
:type EndpointType: string
:param EndpointType: The type of endpoint.
:type EngineName: string
:param EngineName: The type of engine for the endpoint. Valid values, depending on the EndPointType, include MYSQL, ORACLE, POSTGRES, MARIADB, AURORA, REDSHIFT, S3, DYNAMODB, MONGODB, SYBASE, and SQLSERVER.
:type Username: string
:param Username: The user name to be used to login to the endpoint database.
:type Password: string
:param Password: The password to be used to login to the endpoint database.
:type ServerName: string
:param ServerName: The name of the server where the endpoint database resides.
:type Port: integer
:param Port: The port used by the endpoint database.
:type DatabaseName: string
:param DatabaseName: The name of the endpoint database.
:type ExtraConnectionAttributes: string
:param ExtraConnectionAttributes: Additional attributes associated with the connection.
:type CertificateArn: string
:param CertificateArn: The Amazon Resource Name (ARN) of the certificate used for SSL connection.
:type SslMode: string
:param SslMode: The SSL mode to be used.
SSL mode can be one of four values: none, require, verify-ca, verify-full.
The default value is none.
:type DynamoDbSettings: dict
:param DynamoDbSettings: Settings in JSON format for the target Amazon DynamoDB endpoint. For more information about the available settings, see the Using Object Mapping to Migrate Data to DynamoDB section at Using an Amazon DynamoDB Database as a Target for AWS Database Migration Service .
ServiceAccessRoleArn (string) -- [REQUIRED]The Amazon Resource Name (ARN) used by the service access IAM role.
:type S3Settings: dict
:param S3Settings: Settings in JSON format for the target S3 endpoint. For more information about the available settings, see the Extra Connection Attributes section at Using Amazon S3 as a Target for AWS Database Migration Service .
ServiceAccessRoleArn (string) --The Amazon Resource Name (ARN) used by the service access IAM role.
ExternalTableDefinition (string) --
CsvRowDelimiter (string) --The delimiter used to separate rows in the source files. The default is a carriage return (n).
CsvDelimiter (string) --The delimiter used to separate columns in the source files. The default is a comma.
BucketFolder (string) --An optional parameter to set a folder name in the S3 bucket. If provided, tables are created in the path bucketFolder/schema_name/table_name/. If this parameter is not specified, then the path used is schema_name/table_name/.
BucketName (string) --The name of the S3 bucket.
CompressionType (string) --An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files. Set to NONE (the default) or do not use to leave the files uncompressed.
:type MongoDbSettings: dict
:param MongoDbSettings: Settings in JSON format for the source MongoDB endpoint. For more information about the available settings, see the Configuration Properties When Using MongoDB as a Source for AWS Database Migration Service section at Using Amazon S3 as a Target for AWS Database Migration Service .
Username (string) --The user name you use to access the MongoDB source endpoint.
Password (string) --The password for the user account you use to access the MongoDB source endpoint.
ServerName (string) --The name of the server on the MongoDB source endpoint.
Port (integer) --The port value for the MongoDB source endpoint.
DatabaseName (string) --The database name on the MongoDB source endpoint.
AuthType (string) --The authentication type you use to access the MongoDB source endpoint.
Valid values: NO, PASSWORD
When NO is selected, user name and password parameters are not used and can be empty.
AuthMechanism (string) --The authentication mechanism you use to access the MongoDB source endpoint.
Valid values: DEFAULT, MONGODB_CR, SCRAM_SHA_1
DEFAULT For MongoDB version 2.x, use MONGODB_CR. For MongoDB version 3.x, use SCRAM_SHA_1. This attribute is not used when authType=No.
NestingLevel (string) --Specifies either document or table mode.
Valid values: NONE, ONE
Default value is NONE. Specify NONE to use document mode. Specify ONE to use table mode.
ExtractDocId (string) --Specifies the document ID. Use this attribute when NestingLevel is set to NONE.
Default value is false.
DocsToInvestigate (string) --Indicates the number of documents to preview to determine the document organization. Use this attribute when NestingLevel is set to ONE.
Must be a positive value greater than 0. Default value is 1000.
AuthSource (string) --The MongoDB database name. This attribute is not used when authType=NO .
The default is admin.
:rtype: dict
:return: {
'Endpoint': {
'EndpointIdentifier': 'string',
'EndpointType': 'source'|'target',
'EngineName': 'string',
'Username': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'ExtraConnectionAttributes': 'string',
'Status': 'string',
'KmsKeyId': 'string',
'EndpointArn': 'string',
'CertificateArn': 'string',
'SslMode': 'none'|'require'|'verify-ca'|'verify-full',
'ExternalId': 'string',
'DynamoDbSettings': {
'ServiceAccessRoleArn': 'string'
},
'S3Settings': {
'ServiceAccessRoleArn': 'string',
'ExternalTableDefinition': 'string',
'CsvRowDelimiter': 'string',
'CsvDelimiter': 'string',
'BucketFolder': 'string',
'BucketName': 'string',
'CompressionType': 'none'|'gzip'
},
'MongoDbSettings': {
'Username': 'string',
'Password': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'AuthType': 'no'|'password',
'AuthMechanism': 'default'|'mongodb_cr'|'scram_sha_1',
'NestingLevel': 'none'|'one',
'ExtractDocId': 'string',
'DocsToInvestigate': 'string',
'AuthSource': 'string'
}
}
}
"""
pass | Modifies the specified endpoint.
See also: AWS API Documentation
:example: response = client.modify_endpoint(
EndpointArn='string',
EndpointIdentifier='string',
EndpointType='source'|'target',
EngineName='string',
Username='string',
Password='string',
ServerName='string',
Port=123,
DatabaseName='string',
ExtraConnectionAttributes='string',
CertificateArn='string',
SslMode='none'|'require'|'verify-ca'|'verify-full',
DynamoDbSettings={
'ServiceAccessRoleArn': 'string'
},
S3Settings={
'ServiceAccessRoleArn': 'string',
'ExternalTableDefinition': 'string',
'CsvRowDelimiter': 'string',
'CsvDelimiter': 'string',
'BucketFolder': 'string',
'BucketName': 'string',
'CompressionType': 'none'|'gzip'
},
MongoDbSettings={
'Username': 'string',
'Password': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'AuthType': 'no'|'password',
'AuthMechanism': 'default'|'mongodb_cr'|'scram_sha_1',
'NestingLevel': 'none'|'one',
'ExtractDocId': 'string',
'DocsToInvestigate': 'string',
'AuthSource': 'string'
}
)
:type EndpointArn: string
:param EndpointArn: [REQUIRED]
The Amazon Resource Name (ARN) string that uniquely identifies the endpoint.
:type EndpointIdentifier: string
:param EndpointIdentifier: The database endpoint identifier. Identifiers must begin with a letter; must contain only ASCII letters, digits, and hyphens; and must not end with a hyphen or contain two consecutive hyphens.
:type EndpointType: string
:param EndpointType: The type of endpoint.
:type EngineName: string
:param EngineName: The type of engine for the endpoint. Valid values, depending on the EndPointType, include MYSQL, ORACLE, POSTGRES, MARIADB, AURORA, REDSHIFT, S3, DYNAMODB, MONGODB, SYBASE, and SQLSERVER.
:type Username: string
:param Username: The user name to be used to login to the endpoint database.
:type Password: string
:param Password: The password to be used to login to the endpoint database.
:type ServerName: string
:param ServerName: The name of the server where the endpoint database resides.
:type Port: integer
:param Port: The port used by the endpoint database.
:type DatabaseName: string
:param DatabaseName: The name of the endpoint database.
:type ExtraConnectionAttributes: string
:param ExtraConnectionAttributes: Additional attributes associated with the connection.
:type CertificateArn: string
:param CertificateArn: The Amazon Resource Name (ARN) of the certificate used for SSL connection.
:type SslMode: string
:param SslMode: The SSL mode to be used.
SSL mode can be one of four values: none, require, verify-ca, verify-full.
The default value is none.
:type DynamoDbSettings: dict
:param DynamoDbSettings: Settings in JSON format for the target Amazon DynamoDB endpoint. For more information about the available settings, see the Using Object Mapping to Migrate Data to DynamoDB section at Using an Amazon DynamoDB Database as a Target for AWS Database Migration Service .
ServiceAccessRoleArn (string) -- [REQUIRED]The Amazon Resource Name (ARN) used by the service access IAM role.
:type S3Settings: dict
:param S3Settings: Settings in JSON format for the target S3 endpoint. For more information about the available settings, see the Extra Connection Attributes section at Using Amazon S3 as a Target for AWS Database Migration Service .
ServiceAccessRoleArn (string) --The Amazon Resource Name (ARN) used by the service access IAM role.
ExternalTableDefinition (string) --
CsvRowDelimiter (string) --The delimiter used to separate rows in the source files. The default is a carriage return (n).
CsvDelimiter (string) --The delimiter used to separate columns in the source files. The default is a comma.
BucketFolder (string) --An optional parameter to set a folder name in the S3 bucket. If provided, tables are created in the path bucketFolder/schema_name/table_name/. If this parameter is not specified, then the path used is schema_name/table_name/.
BucketName (string) --The name of the S3 bucket.
CompressionType (string) --An optional parameter to use GZIP to compress the target files. Set to GZIP to compress the target files. Set to NONE (the default) or do not use to leave the files uncompressed.
:type MongoDbSettings: dict
:param MongoDbSettings: Settings in JSON format for the source MongoDB endpoint. For more information about the available settings, see the Configuration Properties When Using MongoDB as a Source for AWS Database Migration Service section at Using Amazon S3 as a Target for AWS Database Migration Service .
Username (string) --The user name you use to access the MongoDB source endpoint.
Password (string) --The password for the user account you use to access the MongoDB source endpoint.
ServerName (string) --The name of the server on the MongoDB source endpoint.
Port (integer) --The port value for the MongoDB source endpoint.
DatabaseName (string) --The database name on the MongoDB source endpoint.
AuthType (string) --The authentication type you use to access the MongoDB source endpoint.
Valid values: NO, PASSWORD
When NO is selected, user name and password parameters are not used and can be empty.
AuthMechanism (string) --The authentication mechanism you use to access the MongoDB source endpoint.
Valid values: DEFAULT, MONGODB_CR, SCRAM_SHA_1
DEFAULT For MongoDB version 2.x, use MONGODB_CR. For MongoDB version 3.x, use SCRAM_SHA_1. This attribute is not used when authType=No.
NestingLevel (string) --Specifies either document or table mode.
Valid values: NONE, ONE
Default value is NONE. Specify NONE to use document mode. Specify ONE to use table mode.
ExtractDocId (string) --Specifies the document ID. Use this attribute when NestingLevel is set to NONE.
Default value is false.
DocsToInvestigate (string) --Indicates the number of documents to preview to determine the document organization. Use this attribute when NestingLevel is set to ONE.
Must be a positive value greater than 0. Default value is 1000.
AuthSource (string) --The MongoDB database name. This attribute is not used when authType=NO .
The default is admin.
:rtype: dict
:return: {
'Endpoint': {
'EndpointIdentifier': 'string',
'EndpointType': 'source'|'target',
'EngineName': 'string',
'Username': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'ExtraConnectionAttributes': 'string',
'Status': 'string',
'KmsKeyId': 'string',
'EndpointArn': 'string',
'CertificateArn': 'string',
'SslMode': 'none'|'require'|'verify-ca'|'verify-full',
'ExternalId': 'string',
'DynamoDbSettings': {
'ServiceAccessRoleArn': 'string'
},
'S3Settings': {
'ServiceAccessRoleArn': 'string',
'ExternalTableDefinition': 'string',
'CsvRowDelimiter': 'string',
'CsvDelimiter': 'string',
'BucketFolder': 'string',
'BucketName': 'string',
'CompressionType': 'none'|'gzip'
},
'MongoDbSettings': {
'Username': 'string',
'Password': 'string',
'ServerName': 'string',
'Port': 123,
'DatabaseName': 'string',
'AuthType': 'no'|'password',
'AuthMechanism': 'default'|'mongodb_cr'|'scram_sha_1',
'NestingLevel': 'none'|'one',
'ExtractDocId': 'string',
'DocsToInvestigate': 'string',
'AuthSource': 'string'
}
}
} | entailment |
def modify_replication_instance(ReplicationInstanceArn=None, AllocatedStorage=None, ApplyImmediately=None, ReplicationInstanceClass=None, VpcSecurityGroupIds=None, PreferredMaintenanceWindow=None, MultiAZ=None, EngineVersion=None, AllowMajorVersionUpgrade=None, AutoMinorVersionUpgrade=None, ReplicationInstanceIdentifier=None):
"""
Modifies the replication instance to apply new settings. You can change one or more parameters by specifying these parameters and the new values in the request.
Some settings are applied during the maintenance window.
See also: AWS API Documentation
:example: response = client.modify_replication_instance(
ReplicationInstanceArn='string',
AllocatedStorage=123,
ApplyImmediately=True|False,
ReplicationInstanceClass='string',
VpcSecurityGroupIds=[
'string',
],
PreferredMaintenanceWindow='string',
MultiAZ=True|False,
EngineVersion='string',
AllowMajorVersionUpgrade=True|False,
AutoMinorVersionUpgrade=True|False,
ReplicationInstanceIdentifier='string'
)
:type ReplicationInstanceArn: string
:param ReplicationInstanceArn: [REQUIRED]
The Amazon Resource Name (ARN) of the replication instance.
:type AllocatedStorage: integer
:param AllocatedStorage: The amount of storage (in gigabytes) to be allocated for the replication instance.
:type ApplyImmediately: boolean
:param ApplyImmediately: Indicates whether the changes should be applied immediately or during the next maintenance window.
:type ReplicationInstanceClass: string
:param ReplicationInstanceClass: The compute and memory capacity of the replication instance.
Valid Values: dms.t2.micro | dms.t2.small | dms.t2.medium | dms.t2.large | dms.c4.large | dms.c4.xlarge | dms.c4.2xlarge | dms.c4.4xlarge
:type VpcSecurityGroupIds: list
:param VpcSecurityGroupIds: Specifies the VPC security group to be used with the replication instance. The VPC security group must work with the VPC containing the replication instance.
(string) --
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: The weekly time range (in UTC) during which system maintenance can occur, which might result in an outage. Changing this parameter does not result in an outage, except in the following situation, and the change is asynchronously applied as soon as possible. If moving this window to the current time, there must be at least 30 minutes between the current time and end of the window to ensure pending changes are applied.
Default: Uses existing setting
Format: ddd:hh24:mi-ddd:hh24:mi
Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun
Constraints: Must be at least 30 minutes
:type MultiAZ: boolean
:param MultiAZ: Specifies if the replication instance is a Multi-AZ deployment. You cannot set the AvailabilityZone parameter if the Multi-AZ parameter is set to true .
:type EngineVersion: string
:param EngineVersion: The engine version number of the replication instance.
:type AllowMajorVersionUpgrade: boolean
:param AllowMajorVersionUpgrade: Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible.
Constraints: This parameter must be set to true when specifying a value for the EngineVersion parameter that is a different major version than the replication instance's current version.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: Indicates that minor version upgrades will be applied automatically to the replication instance during the maintenance window. Changing this parameter does not result in an outage except in the following case and the change is asynchronously applied as soon as possible. An outage will result if this parameter is set to true during the maintenance window, and a newer minor version is available, and AWS DMS has enabled auto patching for that engine version.
:type ReplicationInstanceIdentifier: string
:param ReplicationInstanceIdentifier: The replication instance identifier. This parameter is stored as a lowercase string.
:rtype: dict
:return: {
'ReplicationInstance': {
'ReplicationInstanceIdentifier': 'string',
'ReplicationInstanceClass': 'string',
'ReplicationInstanceStatus': 'string',
'AllocatedStorage': 123,
'InstanceCreateTime': datetime(2015, 1, 1),
'VpcSecurityGroups': [
{
'VpcSecurityGroupId': 'string',
'Status': 'string'
},
],
'AvailabilityZone': 'string',
'ReplicationSubnetGroup': {
'ReplicationSubnetGroupIdentifier': 'string',
'ReplicationSubnetGroupDescription': 'string',
'VpcId': 'string',
'SubnetGroupStatus': 'string',
'Subnets': [
{
'SubnetIdentifier': 'string',
'SubnetAvailabilityZone': {
'Name': 'string'
},
'SubnetStatus': 'string'
},
]
},
'PreferredMaintenanceWindow': 'string',
'PendingModifiedValues': {
'ReplicationInstanceClass': 'string',
'AllocatedStorage': 123,
'MultiAZ': True|False,
'EngineVersion': 'string'
},
'MultiAZ': True|False,
'EngineVersion': 'string',
'AutoMinorVersionUpgrade': True|False,
'KmsKeyId': 'string',
'ReplicationInstanceArn': 'string',
'ReplicationInstancePublicIpAddress': 'string',
'ReplicationInstancePrivateIpAddress': 'string',
'ReplicationInstancePublicIpAddresses': [
'string',
],
'ReplicationInstancePrivateIpAddresses': [
'string',
],
'PubliclyAccessible': True|False,
'SecondaryAvailabilityZone': 'string'
}
}
:returns:
Must contain from 1 to 63 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens.
"""
pass | Modifies the replication instance to apply new settings. You can change one or more parameters by specifying these parameters and the new values in the request.
Some settings are applied during the maintenance window.
See also: AWS API Documentation
:example: response = client.modify_replication_instance(
ReplicationInstanceArn='string',
AllocatedStorage=123,
ApplyImmediately=True|False,
ReplicationInstanceClass='string',
VpcSecurityGroupIds=[
'string',
],
PreferredMaintenanceWindow='string',
MultiAZ=True|False,
EngineVersion='string',
AllowMajorVersionUpgrade=True|False,
AutoMinorVersionUpgrade=True|False,
ReplicationInstanceIdentifier='string'
)
:type ReplicationInstanceArn: string
:param ReplicationInstanceArn: [REQUIRED]
The Amazon Resource Name (ARN) of the replication instance.
:type AllocatedStorage: integer
:param AllocatedStorage: The amount of storage (in gigabytes) to be allocated for the replication instance.
:type ApplyImmediately: boolean
:param ApplyImmediately: Indicates whether the changes should be applied immediately or during the next maintenance window.
:type ReplicationInstanceClass: string
:param ReplicationInstanceClass: The compute and memory capacity of the replication instance.
Valid Values: dms.t2.micro | dms.t2.small | dms.t2.medium | dms.t2.large | dms.c4.large | dms.c4.xlarge | dms.c4.2xlarge | dms.c4.4xlarge
:type VpcSecurityGroupIds: list
:param VpcSecurityGroupIds: Specifies the VPC security group to be used with the replication instance. The VPC security group must work with the VPC containing the replication instance.
(string) --
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: The weekly time range (in UTC) during which system maintenance can occur, which might result in an outage. Changing this parameter does not result in an outage, except in the following situation, and the change is asynchronously applied as soon as possible. If moving this window to the current time, there must be at least 30 minutes between the current time and end of the window to ensure pending changes are applied.
Default: Uses existing setting
Format: ddd:hh24:mi-ddd:hh24:mi
Valid Days: Mon | Tue | Wed | Thu | Fri | Sat | Sun
Constraints: Must be at least 30 minutes
:type MultiAZ: boolean
:param MultiAZ: Specifies if the replication instance is a Multi-AZ deployment. You cannot set the AvailabilityZone parameter if the Multi-AZ parameter is set to true .
:type EngineVersion: string
:param EngineVersion: The engine version number of the replication instance.
:type AllowMajorVersionUpgrade: boolean
:param AllowMajorVersionUpgrade: Indicates that major version upgrades are allowed. Changing this parameter does not result in an outage and the change is asynchronously applied as soon as possible.
Constraints: This parameter must be set to true when specifying a value for the EngineVersion parameter that is a different major version than the replication instance's current version.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: Indicates that minor version upgrades will be applied automatically to the replication instance during the maintenance window. Changing this parameter does not result in an outage except in the following case and the change is asynchronously applied as soon as possible. An outage will result if this parameter is set to true during the maintenance window, and a newer minor version is available, and AWS DMS has enabled auto patching for that engine version.
:type ReplicationInstanceIdentifier: string
:param ReplicationInstanceIdentifier: The replication instance identifier. This parameter is stored as a lowercase string.
:rtype: dict
:return: {
'ReplicationInstance': {
'ReplicationInstanceIdentifier': 'string',
'ReplicationInstanceClass': 'string',
'ReplicationInstanceStatus': 'string',
'AllocatedStorage': 123,
'InstanceCreateTime': datetime(2015, 1, 1),
'VpcSecurityGroups': [
{
'VpcSecurityGroupId': 'string',
'Status': 'string'
},
],
'AvailabilityZone': 'string',
'ReplicationSubnetGroup': {
'ReplicationSubnetGroupIdentifier': 'string',
'ReplicationSubnetGroupDescription': 'string',
'VpcId': 'string',
'SubnetGroupStatus': 'string',
'Subnets': [
{
'SubnetIdentifier': 'string',
'SubnetAvailabilityZone': {
'Name': 'string'
},
'SubnetStatus': 'string'
},
]
},
'PreferredMaintenanceWindow': 'string',
'PendingModifiedValues': {
'ReplicationInstanceClass': 'string',
'AllocatedStorage': 123,
'MultiAZ': True|False,
'EngineVersion': 'string'
},
'MultiAZ': True|False,
'EngineVersion': 'string',
'AutoMinorVersionUpgrade': True|False,
'KmsKeyId': 'string',
'ReplicationInstanceArn': 'string',
'ReplicationInstancePublicIpAddress': 'string',
'ReplicationInstancePrivateIpAddress': 'string',
'ReplicationInstancePublicIpAddresses': [
'string',
],
'ReplicationInstancePrivateIpAddresses': [
'string',
],
'PubliclyAccessible': True|False,
'SecondaryAvailabilityZone': 'string'
}
}
:returns:
Must contain from 1 to 63 alphanumeric characters or hyphens.
First character must be a letter.
Cannot end with a hyphen or contain two consecutive hyphens. | entailment |
def create_fleet(Name=None, ImageName=None, InstanceType=None, ComputeCapacity=None, VpcConfig=None, MaxUserDurationInSeconds=None, DisconnectTimeoutInSeconds=None, Description=None, DisplayName=None, EnableDefaultInternetAccess=None):
"""
Creates a new fleet.
See also: AWS API Documentation
:example: response = client.create_fleet(
Name='string',
ImageName='string',
InstanceType='string',
ComputeCapacity={
'DesiredInstances': 123
},
VpcConfig={
'SubnetIds': [
'string',
]
},
MaxUserDurationInSeconds=123,
DisconnectTimeoutInSeconds=123,
Description='string',
DisplayName='string',
EnableDefaultInternetAccess=True|False
)
:type Name: string
:param Name: [REQUIRED]
A unique identifier for the fleet.
:type ImageName: string
:param ImageName: [REQUIRED]
Unique name of the image used by the fleet.
:type InstanceType: string
:param InstanceType: [REQUIRED]
The instance type of compute resources for the fleet. Fleet instances are launched from this instance type.
:type ComputeCapacity: dict
:param ComputeCapacity: [REQUIRED]
The parameters for the capacity allocated to the fleet.
DesiredInstances (integer) -- [REQUIRED]The desired number of streaming instances.
:type VpcConfig: dict
:param VpcConfig: The VPC configuration for the fleet.
SubnetIds (list) --The list of subnets to which a network interface is established from the fleet instance.
(string) --
:type MaxUserDurationInSeconds: integer
:param MaxUserDurationInSeconds: The maximum time for which a streaming session can run. The input can be any numeric value in seconds between 600 and 57600.
:type DisconnectTimeoutInSeconds: integer
:param DisconnectTimeoutInSeconds: The time after disconnection when a session is considered to have ended. If a user who got disconnected reconnects within this timeout interval, the user is connected back to their previous session. The input can be any numeric value in seconds between 60 and 57600.
:type Description: string
:param Description: The description of the fleet.
:type DisplayName: string
:param DisplayName: The display name of the fleet.
:type EnableDefaultInternetAccess: boolean
:param EnableDefaultInternetAccess: Enables or disables default Internet access for the fleet.
:rtype: dict
:return: {
'Fleet': {
'Arn': 'string',
'Name': 'string',
'DisplayName': 'string',
'Description': 'string',
'ImageName': 'string',
'InstanceType': 'string',
'ComputeCapacityStatus': {
'Desired': 123,
'Running': 123,
'InUse': 123,
'Available': 123
},
'MaxUserDurationInSeconds': 123,
'DisconnectTimeoutInSeconds': 123,
'State': 'STARTING'|'RUNNING'|'STOPPING'|'STOPPED',
'VpcConfig': {
'SubnetIds': [
'string',
]
},
'CreatedTime': datetime(2015, 1, 1),
'FleetErrors': [
{
'ErrorCode': 'IAM_SERVICE_ROLE_MISSING_ENI_DESCRIBE_ACTION'|'IAM_SERVICE_ROLE_MISSING_ENI_CREATE_ACTION'|'IAM_SERVICE_ROLE_MISSING_ENI_DELETE_ACTION'|'NETWORK_INTERFACE_LIMIT_EXCEEDED'|'INTERNAL_SERVICE_ERROR'|'IAM_SERVICE_ROLE_IS_MISSING'|'SUBNET_HAS_INSUFFICIENT_IP_ADDRESSES'|'IAM_SERVICE_ROLE_MISSING_DESCRIBE_SUBNET_ACTION'|'SUBNET_NOT_FOUND'|'IMAGE_NOT_FOUND'|'INVALID_SUBNET_CONFIGURATION',
'ErrorMessage': 'string'
},
],
'EnableDefaultInternetAccess': True|False
}
}
:returns:
(string) --
"""
pass | Creates a new fleet.
See also: AWS API Documentation
:example: response = client.create_fleet(
Name='string',
ImageName='string',
InstanceType='string',
ComputeCapacity={
'DesiredInstances': 123
},
VpcConfig={
'SubnetIds': [
'string',
]
},
MaxUserDurationInSeconds=123,
DisconnectTimeoutInSeconds=123,
Description='string',
DisplayName='string',
EnableDefaultInternetAccess=True|False
)
:type Name: string
:param Name: [REQUIRED]
A unique identifier for the fleet.
:type ImageName: string
:param ImageName: [REQUIRED]
Unique name of the image used by the fleet.
:type InstanceType: string
:param InstanceType: [REQUIRED]
The instance type of compute resources for the fleet. Fleet instances are launched from this instance type.
:type ComputeCapacity: dict
:param ComputeCapacity: [REQUIRED]
The parameters for the capacity allocated to the fleet.
DesiredInstances (integer) -- [REQUIRED]The desired number of streaming instances.
:type VpcConfig: dict
:param VpcConfig: The VPC configuration for the fleet.
SubnetIds (list) --The list of subnets to which a network interface is established from the fleet instance.
(string) --
:type MaxUserDurationInSeconds: integer
:param MaxUserDurationInSeconds: The maximum time for which a streaming session can run. The input can be any numeric value in seconds between 600 and 57600.
:type DisconnectTimeoutInSeconds: integer
:param DisconnectTimeoutInSeconds: The time after disconnection when a session is considered to have ended. If a user who got disconnected reconnects within this timeout interval, the user is connected back to their previous session. The input can be any numeric value in seconds between 60 and 57600.
:type Description: string
:param Description: The description of the fleet.
:type DisplayName: string
:param DisplayName: The display name of the fleet.
:type EnableDefaultInternetAccess: boolean
:param EnableDefaultInternetAccess: Enables or disables default Internet access for the fleet.
:rtype: dict
:return: {
'Fleet': {
'Arn': 'string',
'Name': 'string',
'DisplayName': 'string',
'Description': 'string',
'ImageName': 'string',
'InstanceType': 'string',
'ComputeCapacityStatus': {
'Desired': 123,
'Running': 123,
'InUse': 123,
'Available': 123
},
'MaxUserDurationInSeconds': 123,
'DisconnectTimeoutInSeconds': 123,
'State': 'STARTING'|'RUNNING'|'STOPPING'|'STOPPED',
'VpcConfig': {
'SubnetIds': [
'string',
]
},
'CreatedTime': datetime(2015, 1, 1),
'FleetErrors': [
{
'ErrorCode': 'IAM_SERVICE_ROLE_MISSING_ENI_DESCRIBE_ACTION'|'IAM_SERVICE_ROLE_MISSING_ENI_CREATE_ACTION'|'IAM_SERVICE_ROLE_MISSING_ENI_DELETE_ACTION'|'NETWORK_INTERFACE_LIMIT_EXCEEDED'|'INTERNAL_SERVICE_ERROR'|'IAM_SERVICE_ROLE_IS_MISSING'|'SUBNET_HAS_INSUFFICIENT_IP_ADDRESSES'|'IAM_SERVICE_ROLE_MISSING_DESCRIBE_SUBNET_ACTION'|'SUBNET_NOT_FOUND'|'IMAGE_NOT_FOUND'|'INVALID_SUBNET_CONFIGURATION',
'ErrorMessage': 'string'
},
],
'EnableDefaultInternetAccess': True|False
}
}
:returns:
(string) -- | entailment |
def update_fleet(ImageName=None, Name=None, InstanceType=None, ComputeCapacity=None, VpcConfig=None, MaxUserDurationInSeconds=None, DisconnectTimeoutInSeconds=None, DeleteVpcConfig=None, Description=None, DisplayName=None, EnableDefaultInternetAccess=None):
"""
Updates an existing fleet. All the attributes except the fleet name can be updated in the STOPPED state. When a fleet is in the RUNNING state, only DisplayName and ComputeCapacity can be updated. A fleet cannot be updated in a status of STARTING or STOPPING .
See also: AWS API Documentation
:example: response = client.update_fleet(
ImageName='string',
Name='string',
InstanceType='string',
ComputeCapacity={
'DesiredInstances': 123
},
VpcConfig={
'SubnetIds': [
'string',
]
},
MaxUserDurationInSeconds=123,
DisconnectTimeoutInSeconds=123,
DeleteVpcConfig=True|False,
Description='string',
DisplayName='string',
EnableDefaultInternetAccess=True|False
)
:type ImageName: string
:param ImageName: The image name from which a fleet is created.
:type Name: string
:param Name: [REQUIRED]
The name of the fleet.
:type InstanceType: string
:param InstanceType: The instance type of compute resources for the fleet. Fleet instances are launched from this instance type.
:type ComputeCapacity: dict
:param ComputeCapacity: The parameters for the capacity allocated to the fleet.
DesiredInstances (integer) -- [REQUIRED]The desired number of streaming instances.
:type VpcConfig: dict
:param VpcConfig: The VPC configuration for the fleet.
SubnetIds (list) --The list of subnets to which a network interface is established from the fleet instance.
(string) --
:type MaxUserDurationInSeconds: integer
:param MaxUserDurationInSeconds: The maximum time for which a streaming session can run. The input can be any numeric value in seconds between 600 and 57600.
:type DisconnectTimeoutInSeconds: integer
:param DisconnectTimeoutInSeconds: The time after disconnection when a session is considered to have ended. If a user who got disconnected reconnects within this timeout interval, the user is connected back to their previous session. The input can be any numeric value in seconds between 60 and 57600.
:type DeleteVpcConfig: boolean
:param DeleteVpcConfig: Delete the VPC association for the specified fleet.
:type Description: string
:param Description: The description displayed to end users on the AppStream 2.0 portal.
:type DisplayName: string
:param DisplayName: The name displayed to end users on the AppStream 2.0 portal.
:type EnableDefaultInternetAccess: boolean
:param EnableDefaultInternetAccess: Enables or disables default Internet access for the fleet.
:rtype: dict
:return: {
'Fleet': {
'Arn': 'string',
'Name': 'string',
'DisplayName': 'string',
'Description': 'string',
'ImageName': 'string',
'InstanceType': 'string',
'ComputeCapacityStatus': {
'Desired': 123,
'Running': 123,
'InUse': 123,
'Available': 123
},
'MaxUserDurationInSeconds': 123,
'DisconnectTimeoutInSeconds': 123,
'State': 'STARTING'|'RUNNING'|'STOPPING'|'STOPPED',
'VpcConfig': {
'SubnetIds': [
'string',
]
},
'CreatedTime': datetime(2015, 1, 1),
'FleetErrors': [
{
'ErrorCode': 'IAM_SERVICE_ROLE_MISSING_ENI_DESCRIBE_ACTION'|'IAM_SERVICE_ROLE_MISSING_ENI_CREATE_ACTION'|'IAM_SERVICE_ROLE_MISSING_ENI_DELETE_ACTION'|'NETWORK_INTERFACE_LIMIT_EXCEEDED'|'INTERNAL_SERVICE_ERROR'|'IAM_SERVICE_ROLE_IS_MISSING'|'SUBNET_HAS_INSUFFICIENT_IP_ADDRESSES'|'IAM_SERVICE_ROLE_MISSING_DESCRIBE_SUBNET_ACTION'|'SUBNET_NOT_FOUND'|'IMAGE_NOT_FOUND'|'INVALID_SUBNET_CONFIGURATION',
'ErrorMessage': 'string'
},
],
'EnableDefaultInternetAccess': True|False
}
}
:returns:
(string) --
"""
pass | Updates an existing fleet. All the attributes except the fleet name can be updated in the STOPPED state. When a fleet is in the RUNNING state, only DisplayName and ComputeCapacity can be updated. A fleet cannot be updated in a status of STARTING or STOPPING .
See also: AWS API Documentation
:example: response = client.update_fleet(
ImageName='string',
Name='string',
InstanceType='string',
ComputeCapacity={
'DesiredInstances': 123
},
VpcConfig={
'SubnetIds': [
'string',
]
},
MaxUserDurationInSeconds=123,
DisconnectTimeoutInSeconds=123,
DeleteVpcConfig=True|False,
Description='string',
DisplayName='string',
EnableDefaultInternetAccess=True|False
)
:type ImageName: string
:param ImageName: The image name from which a fleet is created.
:type Name: string
:param Name: [REQUIRED]
The name of the fleet.
:type InstanceType: string
:param InstanceType: The instance type of compute resources for the fleet. Fleet instances are launched from this instance type.
:type ComputeCapacity: dict
:param ComputeCapacity: The parameters for the capacity allocated to the fleet.
DesiredInstances (integer) -- [REQUIRED]The desired number of streaming instances.
:type VpcConfig: dict
:param VpcConfig: The VPC configuration for the fleet.
SubnetIds (list) --The list of subnets to which a network interface is established from the fleet instance.
(string) --
:type MaxUserDurationInSeconds: integer
:param MaxUserDurationInSeconds: The maximum time for which a streaming session can run. The input can be any numeric value in seconds between 600 and 57600.
:type DisconnectTimeoutInSeconds: integer
:param DisconnectTimeoutInSeconds: The time after disconnection when a session is considered to have ended. If a user who got disconnected reconnects within this timeout interval, the user is connected back to their previous session. The input can be any numeric value in seconds between 60 and 57600.
:type DeleteVpcConfig: boolean
:param DeleteVpcConfig: Delete the VPC association for the specified fleet.
:type Description: string
:param Description: The description displayed to end users on the AppStream 2.0 portal.
:type DisplayName: string
:param DisplayName: The name displayed to end users on the AppStream 2.0 portal.
:type EnableDefaultInternetAccess: boolean
:param EnableDefaultInternetAccess: Enables or disables default Internet access for the fleet.
:rtype: dict
:return: {
'Fleet': {
'Arn': 'string',
'Name': 'string',
'DisplayName': 'string',
'Description': 'string',
'ImageName': 'string',
'InstanceType': 'string',
'ComputeCapacityStatus': {
'Desired': 123,
'Running': 123,
'InUse': 123,
'Available': 123
},
'MaxUserDurationInSeconds': 123,
'DisconnectTimeoutInSeconds': 123,
'State': 'STARTING'|'RUNNING'|'STOPPING'|'STOPPED',
'VpcConfig': {
'SubnetIds': [
'string',
]
},
'CreatedTime': datetime(2015, 1, 1),
'FleetErrors': [
{
'ErrorCode': 'IAM_SERVICE_ROLE_MISSING_ENI_DESCRIBE_ACTION'|'IAM_SERVICE_ROLE_MISSING_ENI_CREATE_ACTION'|'IAM_SERVICE_ROLE_MISSING_ENI_DELETE_ACTION'|'NETWORK_INTERFACE_LIMIT_EXCEEDED'|'INTERNAL_SERVICE_ERROR'|'IAM_SERVICE_ROLE_IS_MISSING'|'SUBNET_HAS_INSUFFICIENT_IP_ADDRESSES'|'IAM_SERVICE_ROLE_MISSING_DESCRIBE_SUBNET_ACTION'|'SUBNET_NOT_FOUND'|'IMAGE_NOT_FOUND'|'INVALID_SUBNET_CONFIGURATION',
'ErrorMessage': 'string'
},
],
'EnableDefaultInternetAccess': True|False
}
}
:returns:
(string) -- | entailment |
def create_deployment(applicationName=None, deploymentGroupName=None, revision=None, deploymentConfigName=None, description=None, ignoreApplicationStopFailures=None, targetInstances=None, autoRollbackConfiguration=None, updateOutdatedInstancesOnly=None, fileExistsBehavior=None):
"""
Deploys an application revision through the specified deployment group.
See also: AWS API Documentation
:example: response = client.create_deployment(
applicationName='string',
deploymentGroupName='string',
revision={
'revisionType': 'S3'|'GitHub',
's3Location': {
'bucket': 'string',
'key': 'string',
'bundleType': 'tar'|'tgz'|'zip',
'version': 'string',
'eTag': 'string'
},
'gitHubLocation': {
'repository': 'string',
'commitId': 'string'
}
},
deploymentConfigName='string',
description='string',
ignoreApplicationStopFailures=True|False,
targetInstances={
'tagFilters': [
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
'autoScalingGroups': [
'string',
]
},
autoRollbackConfiguration={
'enabled': True|False,
'events': [
'DEPLOYMENT_FAILURE'|'DEPLOYMENT_STOP_ON_ALARM'|'DEPLOYMENT_STOP_ON_REQUEST',
]
},
updateOutdatedInstancesOnly=True|False,
fileExistsBehavior='DISALLOW'|'OVERWRITE'|'RETAIN'
)
:type applicationName: string
:param applicationName: [REQUIRED]
The name of an AWS CodeDeploy application associated with the applicable IAM user or AWS account.
:type deploymentGroupName: string
:param deploymentGroupName: The name of the deployment group.
:type revision: dict
:param revision: The type and location of the revision to deploy.
revisionType (string) --The type of application revision:
S3: An application revision stored in Amazon S3.
GitHub: An application revision stored in GitHub.
s3Location (dict) --Information about the location of application artifacts stored in Amazon S3.
bucket (string) --The name of the Amazon S3 bucket where the application revision is stored.
key (string) --The name of the Amazon S3 object that represents the bundled artifacts for the application revision.
bundleType (string) --The file type of the application revision. Must be one of the following:
tar: A tar archive file.
tgz: A compressed tar archive file.
zip: A zip archive file.
version (string) --A specific version of the Amazon S3 object that represents the bundled artifacts for the application revision.
If the version is not specified, the system will use the most recent version by default.
eTag (string) --The ETag of the Amazon S3 object that represents the bundled artifacts for the application revision.
If the ETag is not specified as an input parameter, ETag validation of the object will be skipped.
gitHubLocation (dict) --Information about the location of application artifacts stored in GitHub.
repository (string) --The GitHub account and repository pair that stores a reference to the commit that represents the bundled artifacts for the application revision.
Specified as account/repository.
commitId (string) --The SHA1 commit ID of the GitHub commit that represents the bundled artifacts for the application revision.
:type deploymentConfigName: string
:param deploymentConfigName: The name of a deployment configuration associated with the applicable IAM user or AWS account.
If not specified, the value configured in the deployment group will be used as the default. If the deployment group does not have a deployment configuration associated with it, then CodeDeployDefault.OneAtATime will be used by default.
:type description: string
:param description: A comment about the deployment.
:type ignoreApplicationStopFailures: boolean
:param ignoreApplicationStopFailures: If set to true, then if the deployment causes the ApplicationStop deployment lifecycle event to an instance to fail, the deployment to that instance will not be considered to have failed at that point and will continue on to the BeforeInstall deployment lifecycle event.
If set to false or not specified, then if the deployment causes the ApplicationStop deployment lifecycle event to fail to an instance, the deployment to that instance will stop, and the deployment to that instance will be considered to have failed.
:type targetInstances: dict
:param targetInstances: Information about the instances that will belong to the replacement environment in a blue/green deployment.
tagFilters (list) --The tag filter key, type, and value used to identify Amazon EC2 instances in a replacement environment for a blue/green deployment.
(dict) --Information about an EC2 tag filter.
Key (string) --The tag filter key.
Value (string) --The tag filter value.
Type (string) --The tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
autoScalingGroups (list) --The names of one or more Auto Scaling groups to identify a replacement environment for a blue/green deployment.
(string) --
:type autoRollbackConfiguration: dict
:param autoRollbackConfiguration: Configuration information for an automatic rollback that is added when a deployment is created.
enabled (boolean) --Indicates whether a defined automatic rollback configuration is currently enabled.
events (list) --The event type or types that trigger a rollback.
(string) --
:type updateOutdatedInstancesOnly: boolean
:param updateOutdatedInstancesOnly: Indicates whether to deploy to all instances or only to instances that are not running the latest application revision.
:type fileExistsBehavior: string
:param fileExistsBehavior: Information about how AWS CodeDeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment.
The fileExistsBehavior parameter takes any of the following values:
DISALLOW: The deployment fails. This is also the default behavior if no option is specified.
OVERWRITE: The version of the file from the application revision currently being deployed replaces the version already on the instance.
RETAIN: The version of the file already on the instance is kept and used as part of the new deployment.
:rtype: dict
:return: {
'deploymentId': 'string'
}
"""
pass | Deploys an application revision through the specified deployment group.
See also: AWS API Documentation
:example: response = client.create_deployment(
applicationName='string',
deploymentGroupName='string',
revision={
'revisionType': 'S3'|'GitHub',
's3Location': {
'bucket': 'string',
'key': 'string',
'bundleType': 'tar'|'tgz'|'zip',
'version': 'string',
'eTag': 'string'
},
'gitHubLocation': {
'repository': 'string',
'commitId': 'string'
}
},
deploymentConfigName='string',
description='string',
ignoreApplicationStopFailures=True|False,
targetInstances={
'tagFilters': [
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
'autoScalingGroups': [
'string',
]
},
autoRollbackConfiguration={
'enabled': True|False,
'events': [
'DEPLOYMENT_FAILURE'|'DEPLOYMENT_STOP_ON_ALARM'|'DEPLOYMENT_STOP_ON_REQUEST',
]
},
updateOutdatedInstancesOnly=True|False,
fileExistsBehavior='DISALLOW'|'OVERWRITE'|'RETAIN'
)
:type applicationName: string
:param applicationName: [REQUIRED]
The name of an AWS CodeDeploy application associated with the applicable IAM user or AWS account.
:type deploymentGroupName: string
:param deploymentGroupName: The name of the deployment group.
:type revision: dict
:param revision: The type and location of the revision to deploy.
revisionType (string) --The type of application revision:
S3: An application revision stored in Amazon S3.
GitHub: An application revision stored in GitHub.
s3Location (dict) --Information about the location of application artifacts stored in Amazon S3.
bucket (string) --The name of the Amazon S3 bucket where the application revision is stored.
key (string) --The name of the Amazon S3 object that represents the bundled artifacts for the application revision.
bundleType (string) --The file type of the application revision. Must be one of the following:
tar: A tar archive file.
tgz: A compressed tar archive file.
zip: A zip archive file.
version (string) --A specific version of the Amazon S3 object that represents the bundled artifacts for the application revision.
If the version is not specified, the system will use the most recent version by default.
eTag (string) --The ETag of the Amazon S3 object that represents the bundled artifacts for the application revision.
If the ETag is not specified as an input parameter, ETag validation of the object will be skipped.
gitHubLocation (dict) --Information about the location of application artifacts stored in GitHub.
repository (string) --The GitHub account and repository pair that stores a reference to the commit that represents the bundled artifacts for the application revision.
Specified as account/repository.
commitId (string) --The SHA1 commit ID of the GitHub commit that represents the bundled artifacts for the application revision.
:type deploymentConfigName: string
:param deploymentConfigName: The name of a deployment configuration associated with the applicable IAM user or AWS account.
If not specified, the value configured in the deployment group will be used as the default. If the deployment group does not have a deployment configuration associated with it, then CodeDeployDefault.OneAtATime will be used by default.
:type description: string
:param description: A comment about the deployment.
:type ignoreApplicationStopFailures: boolean
:param ignoreApplicationStopFailures: If set to true, then if the deployment causes the ApplicationStop deployment lifecycle event to an instance to fail, the deployment to that instance will not be considered to have failed at that point and will continue on to the BeforeInstall deployment lifecycle event.
If set to false or not specified, then if the deployment causes the ApplicationStop deployment lifecycle event to fail to an instance, the deployment to that instance will stop, and the deployment to that instance will be considered to have failed.
:type targetInstances: dict
:param targetInstances: Information about the instances that will belong to the replacement environment in a blue/green deployment.
tagFilters (list) --The tag filter key, type, and value used to identify Amazon EC2 instances in a replacement environment for a blue/green deployment.
(dict) --Information about an EC2 tag filter.
Key (string) --The tag filter key.
Value (string) --The tag filter value.
Type (string) --The tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
autoScalingGroups (list) --The names of one or more Auto Scaling groups to identify a replacement environment for a blue/green deployment.
(string) --
:type autoRollbackConfiguration: dict
:param autoRollbackConfiguration: Configuration information for an automatic rollback that is added when a deployment is created.
enabled (boolean) --Indicates whether a defined automatic rollback configuration is currently enabled.
events (list) --The event type or types that trigger a rollback.
(string) --
:type updateOutdatedInstancesOnly: boolean
:param updateOutdatedInstancesOnly: Indicates whether to deploy to all instances or only to instances that are not running the latest application revision.
:type fileExistsBehavior: string
:param fileExistsBehavior: Information about how AWS CodeDeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment.
The fileExistsBehavior parameter takes any of the following values:
DISALLOW: The deployment fails. This is also the default behavior if no option is specified.
OVERWRITE: The version of the file from the application revision currently being deployed replaces the version already on the instance.
RETAIN: The version of the file already on the instance is kept and used as part of the new deployment.
:rtype: dict
:return: {
'deploymentId': 'string'
} | entailment |
def create_deployment_group(applicationName=None, deploymentGroupName=None, deploymentConfigName=None, ec2TagFilters=None, onPremisesInstanceTagFilters=None, autoScalingGroups=None, serviceRoleArn=None, triggerConfigurations=None, alarmConfiguration=None, autoRollbackConfiguration=None, deploymentStyle=None, blueGreenDeploymentConfiguration=None, loadBalancerInfo=None):
"""
Creates a deployment group to which application revisions will be deployed.
See also: AWS API Documentation
:example: response = client.create_deployment_group(
applicationName='string',
deploymentGroupName='string',
deploymentConfigName='string',
ec2TagFilters=[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
onPremisesInstanceTagFilters=[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
autoScalingGroups=[
'string',
],
serviceRoleArn='string',
triggerConfigurations=[
{
'triggerName': 'string',
'triggerTargetArn': 'string',
'triggerEvents': [
'DeploymentStart'|'DeploymentSuccess'|'DeploymentFailure'|'DeploymentStop'|'DeploymentRollback'|'DeploymentReady'|'InstanceStart'|'InstanceSuccess'|'InstanceFailure'|'InstanceReady',
]
},
],
alarmConfiguration={
'enabled': True|False,
'ignorePollAlarmFailure': True|False,
'alarms': [
{
'name': 'string'
},
]
},
autoRollbackConfiguration={
'enabled': True|False,
'events': [
'DEPLOYMENT_FAILURE'|'DEPLOYMENT_STOP_ON_ALARM'|'DEPLOYMENT_STOP_ON_REQUEST',
]
},
deploymentStyle={
'deploymentType': 'IN_PLACE'|'BLUE_GREEN',
'deploymentOption': 'WITH_TRAFFIC_CONTROL'|'WITHOUT_TRAFFIC_CONTROL'
},
blueGreenDeploymentConfiguration={
'terminateBlueInstancesOnDeploymentSuccess': {
'action': 'TERMINATE'|'KEEP_ALIVE',
'terminationWaitTimeInMinutes': 123
},
'deploymentReadyOption': {
'actionOnTimeout': 'CONTINUE_DEPLOYMENT'|'STOP_DEPLOYMENT',
'waitTimeInMinutes': 123
},
'greenFleetProvisioningOption': {
'action': 'DISCOVER_EXISTING'|'COPY_AUTO_SCALING_GROUP'
}
},
loadBalancerInfo={
'elbInfoList': [
{
'name': 'string'
},
]
}
)
:type applicationName: string
:param applicationName: [REQUIRED]
The name of an AWS CodeDeploy application associated with the applicable IAM user or AWS account.
:type deploymentGroupName: string
:param deploymentGroupName: [REQUIRED]
The name of a new deployment group for the specified application.
:type deploymentConfigName: string
:param deploymentConfigName: If specified, the deployment configuration name can be either one of the predefined configurations provided with AWS CodeDeploy or a custom deployment configuration that you create by calling the create deployment configuration operation.
CodeDeployDefault.OneAtATime is the default deployment configuration. It is used if a configuration isn't specified for the deployment or the deployment group.
For more information about the predefined deployment configurations in AWS CodeDeploy, see Working with Deployment Groups in AWS CodeDeploy in the AWS CodeDeploy User Guide.
:type ec2TagFilters: list
:param ec2TagFilters: The Amazon EC2 tags on which to filter. The deployment group will include EC2 instances with any of the specified tags.
(dict) --Information about an EC2 tag filter.
Key (string) --The tag filter key.
Value (string) --The tag filter value.
Type (string) --The tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
:type onPremisesInstanceTagFilters: list
:param onPremisesInstanceTagFilters: The on-premises instance tags on which to filter. The deployment group will include on-premises instances with any of the specified tags.
(dict) --Information about an on-premises instance tag filter.
Key (string) --The on-premises instance tag filter key.
Value (string) --The on-premises instance tag filter value.
Type (string) --The on-premises instance tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
:type autoScalingGroups: list
:param autoScalingGroups: A list of associated Auto Scaling groups.
(string) --
:type serviceRoleArn: string
:param serviceRoleArn: [REQUIRED]
A service role ARN that allows AWS CodeDeploy to act on the user's behalf when interacting with AWS services.
:type triggerConfigurations: list
:param triggerConfigurations: Information about triggers to create when the deployment group is created. For examples, see Create a Trigger for an AWS CodeDeploy Event in the AWS CodeDeploy User Guide.
(dict) --Information about notification triggers for the deployment group.
triggerName (string) --The name of the notification trigger.
triggerTargetArn (string) --The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or instance events are sent.
triggerEvents (list) --The event type or types for which notifications are triggered.
(string) --
:type alarmConfiguration: dict
:param alarmConfiguration: Information to add about Amazon CloudWatch alarms when the deployment group is created.
enabled (boolean) --Indicates whether the alarm configuration is enabled.
ignorePollAlarmFailure (boolean) --Indicates whether a deployment should continue if information about the current state of alarms cannot be retrieved from Amazon CloudWatch. The default value is false.
true: The deployment will proceed even if alarm status information can't be retrieved from Amazon CloudWatch.
false: The deployment will stop if alarm status information can't be retrieved from Amazon CloudWatch.
alarms (list) --A list of alarms configured for the deployment group. A maximum of 10 alarms can be added to a deployment group.
(dict) --Information about an alarm.
name (string) --The name of the alarm. Maximum length is 255 characters. Each alarm name can be used only once in a list of alarms.
:type autoRollbackConfiguration: dict
:param autoRollbackConfiguration: Configuration information for an automatic rollback that is added when a deployment group is created.
enabled (boolean) --Indicates whether a defined automatic rollback configuration is currently enabled.
events (list) --The event type or types that trigger a rollback.
(string) --
:type deploymentStyle: dict
:param deploymentStyle: Information about the type of deployment, in-place or blue/green, that you want to run and whether to route deployment traffic behind a load balancer.
deploymentType (string) --Indicates whether to run an in-place deployment or a blue/green deployment.
deploymentOption (string) --Indicates whether to route deployment traffic behind a load balancer.
:type blueGreenDeploymentConfiguration: dict
:param blueGreenDeploymentConfiguration: Information about blue/green deployment options for a deployment group.
terminateBlueInstancesOnDeploymentSuccess (dict) --Information about whether to terminate instances in the original fleet during a blue/green deployment.
action (string) --The action to take on instances in the original environment after a successful blue/green deployment.
TERMINATE: Instances are terminated after a specified wait time.
KEEP_ALIVE: Instances are left running after they are deregistered from the load balancer and removed from the deployment group.
terminationWaitTimeInMinutes (integer) --The number of minutes to wait after a successful blue/green deployment before terminating instances from the original environment.
deploymentReadyOption (dict) --Information about the action to take when newly provisioned instances are ready to receive traffic in a blue/green deployment.
actionOnTimeout (string) --Information about when to reroute traffic from an original environment to a replacement environment in a blue/green deployment.
CONTINUE_DEPLOYMENT: Register new instances with the load balancer immediately after the new application revision is installed on the instances in the replacement environment.
STOP_DEPLOYMENT: Do not register new instances with load balancer unless traffic is rerouted manually. If traffic is not rerouted manually before the end of the specified wait period, the deployment status is changed to Stopped.
waitTimeInMinutes (integer) --The number of minutes to wait before the status of a blue/green deployment changed to Stopped if rerouting is not started manually. Applies only to the STOP_DEPLOYMENT option for actionOnTimeout
greenFleetProvisioningOption (dict) --Information about how instances are provisioned for a replacement environment in a blue/green deployment.
action (string) --The method used to add instances to a replacement environment.
DISCOVER_EXISTING: Use instances that already exist or will be created manually.
COPY_AUTO_SCALING_GROUP: Use settings from a specified Auto Scaling group to define and create instances in a new Auto Scaling group.
:type loadBalancerInfo: dict
:param loadBalancerInfo: Information about the load balancer used in a deployment.
elbInfoList (list) --An array containing information about the load balancer in Elastic Load Balancing to use in a deployment.
(dict) --Information about a load balancer in Elastic Load Balancing to use in a deployment.
name (string) --For blue/green deployments, the name of the load balancer that will be used to route traffic from original instances to replacement instances in a blue/green deployment. For in-place deployments, the name of the load balancer that instances are deregistered from so they are not serving traffic during a deployment, and then re-registered with after the deployment completes.
:rtype: dict
:return: {
'deploymentGroupId': 'string'
}
"""
pass | Creates a deployment group to which application revisions will be deployed.
See also: AWS API Documentation
:example: response = client.create_deployment_group(
applicationName='string',
deploymentGroupName='string',
deploymentConfigName='string',
ec2TagFilters=[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
onPremisesInstanceTagFilters=[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
autoScalingGroups=[
'string',
],
serviceRoleArn='string',
triggerConfigurations=[
{
'triggerName': 'string',
'triggerTargetArn': 'string',
'triggerEvents': [
'DeploymentStart'|'DeploymentSuccess'|'DeploymentFailure'|'DeploymentStop'|'DeploymentRollback'|'DeploymentReady'|'InstanceStart'|'InstanceSuccess'|'InstanceFailure'|'InstanceReady',
]
},
],
alarmConfiguration={
'enabled': True|False,
'ignorePollAlarmFailure': True|False,
'alarms': [
{
'name': 'string'
},
]
},
autoRollbackConfiguration={
'enabled': True|False,
'events': [
'DEPLOYMENT_FAILURE'|'DEPLOYMENT_STOP_ON_ALARM'|'DEPLOYMENT_STOP_ON_REQUEST',
]
},
deploymentStyle={
'deploymentType': 'IN_PLACE'|'BLUE_GREEN',
'deploymentOption': 'WITH_TRAFFIC_CONTROL'|'WITHOUT_TRAFFIC_CONTROL'
},
blueGreenDeploymentConfiguration={
'terminateBlueInstancesOnDeploymentSuccess': {
'action': 'TERMINATE'|'KEEP_ALIVE',
'terminationWaitTimeInMinutes': 123
},
'deploymentReadyOption': {
'actionOnTimeout': 'CONTINUE_DEPLOYMENT'|'STOP_DEPLOYMENT',
'waitTimeInMinutes': 123
},
'greenFleetProvisioningOption': {
'action': 'DISCOVER_EXISTING'|'COPY_AUTO_SCALING_GROUP'
}
},
loadBalancerInfo={
'elbInfoList': [
{
'name': 'string'
},
]
}
)
:type applicationName: string
:param applicationName: [REQUIRED]
The name of an AWS CodeDeploy application associated with the applicable IAM user or AWS account.
:type deploymentGroupName: string
:param deploymentGroupName: [REQUIRED]
The name of a new deployment group for the specified application.
:type deploymentConfigName: string
:param deploymentConfigName: If specified, the deployment configuration name can be either one of the predefined configurations provided with AWS CodeDeploy or a custom deployment configuration that you create by calling the create deployment configuration operation.
CodeDeployDefault.OneAtATime is the default deployment configuration. It is used if a configuration isn't specified for the deployment or the deployment group.
For more information about the predefined deployment configurations in AWS CodeDeploy, see Working with Deployment Groups in AWS CodeDeploy in the AWS CodeDeploy User Guide.
:type ec2TagFilters: list
:param ec2TagFilters: The Amazon EC2 tags on which to filter. The deployment group will include EC2 instances with any of the specified tags.
(dict) --Information about an EC2 tag filter.
Key (string) --The tag filter key.
Value (string) --The tag filter value.
Type (string) --The tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
:type onPremisesInstanceTagFilters: list
:param onPremisesInstanceTagFilters: The on-premises instance tags on which to filter. The deployment group will include on-premises instances with any of the specified tags.
(dict) --Information about an on-premises instance tag filter.
Key (string) --The on-premises instance tag filter key.
Value (string) --The on-premises instance tag filter value.
Type (string) --The on-premises instance tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
:type autoScalingGroups: list
:param autoScalingGroups: A list of associated Auto Scaling groups.
(string) --
:type serviceRoleArn: string
:param serviceRoleArn: [REQUIRED]
A service role ARN that allows AWS CodeDeploy to act on the user's behalf when interacting with AWS services.
:type triggerConfigurations: list
:param triggerConfigurations: Information about triggers to create when the deployment group is created. For examples, see Create a Trigger for an AWS CodeDeploy Event in the AWS CodeDeploy User Guide.
(dict) --Information about notification triggers for the deployment group.
triggerName (string) --The name of the notification trigger.
triggerTargetArn (string) --The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or instance events are sent.
triggerEvents (list) --The event type or types for which notifications are triggered.
(string) --
:type alarmConfiguration: dict
:param alarmConfiguration: Information to add about Amazon CloudWatch alarms when the deployment group is created.
enabled (boolean) --Indicates whether the alarm configuration is enabled.
ignorePollAlarmFailure (boolean) --Indicates whether a deployment should continue if information about the current state of alarms cannot be retrieved from Amazon CloudWatch. The default value is false.
true: The deployment will proceed even if alarm status information can't be retrieved from Amazon CloudWatch.
false: The deployment will stop if alarm status information can't be retrieved from Amazon CloudWatch.
alarms (list) --A list of alarms configured for the deployment group. A maximum of 10 alarms can be added to a deployment group.
(dict) --Information about an alarm.
name (string) --The name of the alarm. Maximum length is 255 characters. Each alarm name can be used only once in a list of alarms.
:type autoRollbackConfiguration: dict
:param autoRollbackConfiguration: Configuration information for an automatic rollback that is added when a deployment group is created.
enabled (boolean) --Indicates whether a defined automatic rollback configuration is currently enabled.
events (list) --The event type or types that trigger a rollback.
(string) --
:type deploymentStyle: dict
:param deploymentStyle: Information about the type of deployment, in-place or blue/green, that you want to run and whether to route deployment traffic behind a load balancer.
deploymentType (string) --Indicates whether to run an in-place deployment or a blue/green deployment.
deploymentOption (string) --Indicates whether to route deployment traffic behind a load balancer.
:type blueGreenDeploymentConfiguration: dict
:param blueGreenDeploymentConfiguration: Information about blue/green deployment options for a deployment group.
terminateBlueInstancesOnDeploymentSuccess (dict) --Information about whether to terminate instances in the original fleet during a blue/green deployment.
action (string) --The action to take on instances in the original environment after a successful blue/green deployment.
TERMINATE: Instances are terminated after a specified wait time.
KEEP_ALIVE: Instances are left running after they are deregistered from the load balancer and removed from the deployment group.
terminationWaitTimeInMinutes (integer) --The number of minutes to wait after a successful blue/green deployment before terminating instances from the original environment.
deploymentReadyOption (dict) --Information about the action to take when newly provisioned instances are ready to receive traffic in a blue/green deployment.
actionOnTimeout (string) --Information about when to reroute traffic from an original environment to a replacement environment in a blue/green deployment.
CONTINUE_DEPLOYMENT: Register new instances with the load balancer immediately after the new application revision is installed on the instances in the replacement environment.
STOP_DEPLOYMENT: Do not register new instances with load balancer unless traffic is rerouted manually. If traffic is not rerouted manually before the end of the specified wait period, the deployment status is changed to Stopped.
waitTimeInMinutes (integer) --The number of minutes to wait before the status of a blue/green deployment changed to Stopped if rerouting is not started manually. Applies only to the STOP_DEPLOYMENT option for actionOnTimeout
greenFleetProvisioningOption (dict) --Information about how instances are provisioned for a replacement environment in a blue/green deployment.
action (string) --The method used to add instances to a replacement environment.
DISCOVER_EXISTING: Use instances that already exist or will be created manually.
COPY_AUTO_SCALING_GROUP: Use settings from a specified Auto Scaling group to define and create instances in a new Auto Scaling group.
:type loadBalancerInfo: dict
:param loadBalancerInfo: Information about the load balancer used in a deployment.
elbInfoList (list) --An array containing information about the load balancer in Elastic Load Balancing to use in a deployment.
(dict) --Information about a load balancer in Elastic Load Balancing to use in a deployment.
name (string) --For blue/green deployments, the name of the load balancer that will be used to route traffic from original instances to replacement instances in a blue/green deployment. For in-place deployments, the name of the load balancer that instances are deregistered from so they are not serving traffic during a deployment, and then re-registered with after the deployment completes.
:rtype: dict
:return: {
'deploymentGroupId': 'string'
} | entailment |
def update_deployment_group(applicationName=None, currentDeploymentGroupName=None, newDeploymentGroupName=None, deploymentConfigName=None, ec2TagFilters=None, onPremisesInstanceTagFilters=None, autoScalingGroups=None, serviceRoleArn=None, triggerConfigurations=None, alarmConfiguration=None, autoRollbackConfiguration=None, deploymentStyle=None, blueGreenDeploymentConfiguration=None, loadBalancerInfo=None):
"""
Changes information about a deployment group.
See also: AWS API Documentation
:example: response = client.update_deployment_group(
applicationName='string',
currentDeploymentGroupName='string',
newDeploymentGroupName='string',
deploymentConfigName='string',
ec2TagFilters=[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
onPremisesInstanceTagFilters=[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
autoScalingGroups=[
'string',
],
serviceRoleArn='string',
triggerConfigurations=[
{
'triggerName': 'string',
'triggerTargetArn': 'string',
'triggerEvents': [
'DeploymentStart'|'DeploymentSuccess'|'DeploymentFailure'|'DeploymentStop'|'DeploymentRollback'|'DeploymentReady'|'InstanceStart'|'InstanceSuccess'|'InstanceFailure'|'InstanceReady',
]
},
],
alarmConfiguration={
'enabled': True|False,
'ignorePollAlarmFailure': True|False,
'alarms': [
{
'name': 'string'
},
]
},
autoRollbackConfiguration={
'enabled': True|False,
'events': [
'DEPLOYMENT_FAILURE'|'DEPLOYMENT_STOP_ON_ALARM'|'DEPLOYMENT_STOP_ON_REQUEST',
]
},
deploymentStyle={
'deploymentType': 'IN_PLACE'|'BLUE_GREEN',
'deploymentOption': 'WITH_TRAFFIC_CONTROL'|'WITHOUT_TRAFFIC_CONTROL'
},
blueGreenDeploymentConfiguration={
'terminateBlueInstancesOnDeploymentSuccess': {
'action': 'TERMINATE'|'KEEP_ALIVE',
'terminationWaitTimeInMinutes': 123
},
'deploymentReadyOption': {
'actionOnTimeout': 'CONTINUE_DEPLOYMENT'|'STOP_DEPLOYMENT',
'waitTimeInMinutes': 123
},
'greenFleetProvisioningOption': {
'action': 'DISCOVER_EXISTING'|'COPY_AUTO_SCALING_GROUP'
}
},
loadBalancerInfo={
'elbInfoList': [
{
'name': 'string'
},
]
}
)
:type applicationName: string
:param applicationName: [REQUIRED]
The application name corresponding to the deployment group to update.
:type currentDeploymentGroupName: string
:param currentDeploymentGroupName: [REQUIRED]
The current name of the deployment group.
:type newDeploymentGroupName: string
:param newDeploymentGroupName: The new name of the deployment group, if you want to change it.
:type deploymentConfigName: string
:param deploymentConfigName: The replacement deployment configuration name to use, if you want to change it.
:type ec2TagFilters: list
:param ec2TagFilters: The replacement set of Amazon EC2 tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.
(dict) --Information about an EC2 tag filter.
Key (string) --The tag filter key.
Value (string) --The tag filter value.
Type (string) --The tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
:type onPremisesInstanceTagFilters: list
:param onPremisesInstanceTagFilters: The replacement set of on-premises instance tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.
(dict) --Information about an on-premises instance tag filter.
Key (string) --The on-premises instance tag filter key.
Value (string) --The on-premises instance tag filter value.
Type (string) --The on-premises instance tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
:type autoScalingGroups: list
:param autoScalingGroups: The replacement list of Auto Scaling groups to be included in the deployment group, if you want to change them. To keep the Auto Scaling groups, enter their names. To remove Auto Scaling groups, do not enter any Auto Scaling group names.
(string) --
:type serviceRoleArn: string
:param serviceRoleArn: A replacement ARN for the service role, if you want to change it.
:type triggerConfigurations: list
:param triggerConfigurations: Information about triggers to change when the deployment group is updated. For examples, see Modify Triggers in an AWS CodeDeploy Deployment Group in the AWS CodeDeploy User Guide.
(dict) --Information about notification triggers for the deployment group.
triggerName (string) --The name of the notification trigger.
triggerTargetArn (string) --The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or instance events are sent.
triggerEvents (list) --The event type or types for which notifications are triggered.
(string) --
:type alarmConfiguration: dict
:param alarmConfiguration: Information to add or change about Amazon CloudWatch alarms when the deployment group is updated.
enabled (boolean) --Indicates whether the alarm configuration is enabled.
ignorePollAlarmFailure (boolean) --Indicates whether a deployment should continue if information about the current state of alarms cannot be retrieved from Amazon CloudWatch. The default value is false.
true: The deployment will proceed even if alarm status information can't be retrieved from Amazon CloudWatch.
false: The deployment will stop if alarm status information can't be retrieved from Amazon CloudWatch.
alarms (list) --A list of alarms configured for the deployment group. A maximum of 10 alarms can be added to a deployment group.
(dict) --Information about an alarm.
name (string) --The name of the alarm. Maximum length is 255 characters. Each alarm name can be used only once in a list of alarms.
:type autoRollbackConfiguration: dict
:param autoRollbackConfiguration: Information for an automatic rollback configuration that is added or changed when a deployment group is updated.
enabled (boolean) --Indicates whether a defined automatic rollback configuration is currently enabled.
events (list) --The event type or types that trigger a rollback.
(string) --
:type deploymentStyle: dict
:param deploymentStyle: Information about the type of deployment, either in-place or blue/green, you want to run and whether to route deployment traffic behind a load balancer.
deploymentType (string) --Indicates whether to run an in-place deployment or a blue/green deployment.
deploymentOption (string) --Indicates whether to route deployment traffic behind a load balancer.
:type blueGreenDeploymentConfiguration: dict
:param blueGreenDeploymentConfiguration: Information about blue/green deployment options for a deployment group.
terminateBlueInstancesOnDeploymentSuccess (dict) --Information about whether to terminate instances in the original fleet during a blue/green deployment.
action (string) --The action to take on instances in the original environment after a successful blue/green deployment.
TERMINATE: Instances are terminated after a specified wait time.
KEEP_ALIVE: Instances are left running after they are deregistered from the load balancer and removed from the deployment group.
terminationWaitTimeInMinutes (integer) --The number of minutes to wait after a successful blue/green deployment before terminating instances from the original environment.
deploymentReadyOption (dict) --Information about the action to take when newly provisioned instances are ready to receive traffic in a blue/green deployment.
actionOnTimeout (string) --Information about when to reroute traffic from an original environment to a replacement environment in a blue/green deployment.
CONTINUE_DEPLOYMENT: Register new instances with the load balancer immediately after the new application revision is installed on the instances in the replacement environment.
STOP_DEPLOYMENT: Do not register new instances with load balancer unless traffic is rerouted manually. If traffic is not rerouted manually before the end of the specified wait period, the deployment status is changed to Stopped.
waitTimeInMinutes (integer) --The number of minutes to wait before the status of a blue/green deployment changed to Stopped if rerouting is not started manually. Applies only to the STOP_DEPLOYMENT option for actionOnTimeout
greenFleetProvisioningOption (dict) --Information about how instances are provisioned for a replacement environment in a blue/green deployment.
action (string) --The method used to add instances to a replacement environment.
DISCOVER_EXISTING: Use instances that already exist or will be created manually.
COPY_AUTO_SCALING_GROUP: Use settings from a specified Auto Scaling group to define and create instances in a new Auto Scaling group.
:type loadBalancerInfo: dict
:param loadBalancerInfo: Information about the load balancer used in a deployment.
elbInfoList (list) --An array containing information about the load balancer in Elastic Load Balancing to use in a deployment.
(dict) --Information about a load balancer in Elastic Load Balancing to use in a deployment.
name (string) --For blue/green deployments, the name of the load balancer that will be used to route traffic from original instances to replacement instances in a blue/green deployment. For in-place deployments, the name of the load balancer that instances are deregistered from so they are not serving traffic during a deployment, and then re-registered with after the deployment completes.
:rtype: dict
:return: {
'hooksNotCleanedUp': [
{
'name': 'string',
'hook': 'string'
},
]
}
"""
pass | Changes information about a deployment group.
See also: AWS API Documentation
:example: response = client.update_deployment_group(
applicationName='string',
currentDeploymentGroupName='string',
newDeploymentGroupName='string',
deploymentConfigName='string',
ec2TagFilters=[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
onPremisesInstanceTagFilters=[
{
'Key': 'string',
'Value': 'string',
'Type': 'KEY_ONLY'|'VALUE_ONLY'|'KEY_AND_VALUE'
},
],
autoScalingGroups=[
'string',
],
serviceRoleArn='string',
triggerConfigurations=[
{
'triggerName': 'string',
'triggerTargetArn': 'string',
'triggerEvents': [
'DeploymentStart'|'DeploymentSuccess'|'DeploymentFailure'|'DeploymentStop'|'DeploymentRollback'|'DeploymentReady'|'InstanceStart'|'InstanceSuccess'|'InstanceFailure'|'InstanceReady',
]
},
],
alarmConfiguration={
'enabled': True|False,
'ignorePollAlarmFailure': True|False,
'alarms': [
{
'name': 'string'
},
]
},
autoRollbackConfiguration={
'enabled': True|False,
'events': [
'DEPLOYMENT_FAILURE'|'DEPLOYMENT_STOP_ON_ALARM'|'DEPLOYMENT_STOP_ON_REQUEST',
]
},
deploymentStyle={
'deploymentType': 'IN_PLACE'|'BLUE_GREEN',
'deploymentOption': 'WITH_TRAFFIC_CONTROL'|'WITHOUT_TRAFFIC_CONTROL'
},
blueGreenDeploymentConfiguration={
'terminateBlueInstancesOnDeploymentSuccess': {
'action': 'TERMINATE'|'KEEP_ALIVE',
'terminationWaitTimeInMinutes': 123
},
'deploymentReadyOption': {
'actionOnTimeout': 'CONTINUE_DEPLOYMENT'|'STOP_DEPLOYMENT',
'waitTimeInMinutes': 123
},
'greenFleetProvisioningOption': {
'action': 'DISCOVER_EXISTING'|'COPY_AUTO_SCALING_GROUP'
}
},
loadBalancerInfo={
'elbInfoList': [
{
'name': 'string'
},
]
}
)
:type applicationName: string
:param applicationName: [REQUIRED]
The application name corresponding to the deployment group to update.
:type currentDeploymentGroupName: string
:param currentDeploymentGroupName: [REQUIRED]
The current name of the deployment group.
:type newDeploymentGroupName: string
:param newDeploymentGroupName: The new name of the deployment group, if you want to change it.
:type deploymentConfigName: string
:param deploymentConfigName: The replacement deployment configuration name to use, if you want to change it.
:type ec2TagFilters: list
:param ec2TagFilters: The replacement set of Amazon EC2 tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.
(dict) --Information about an EC2 tag filter.
Key (string) --The tag filter key.
Value (string) --The tag filter value.
Type (string) --The tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
:type onPremisesInstanceTagFilters: list
:param onPremisesInstanceTagFilters: The replacement set of on-premises instance tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.
(dict) --Information about an on-premises instance tag filter.
Key (string) --The on-premises instance tag filter key.
Value (string) --The on-premises instance tag filter value.
Type (string) --The on-premises instance tag filter type:
KEY_ONLY: Key only.
VALUE_ONLY: Value only.
KEY_AND_VALUE: Key and value.
:type autoScalingGroups: list
:param autoScalingGroups: The replacement list of Auto Scaling groups to be included in the deployment group, if you want to change them. To keep the Auto Scaling groups, enter their names. To remove Auto Scaling groups, do not enter any Auto Scaling group names.
(string) --
:type serviceRoleArn: string
:param serviceRoleArn: A replacement ARN for the service role, if you want to change it.
:type triggerConfigurations: list
:param triggerConfigurations: Information about triggers to change when the deployment group is updated. For examples, see Modify Triggers in an AWS CodeDeploy Deployment Group in the AWS CodeDeploy User Guide.
(dict) --Information about notification triggers for the deployment group.
triggerName (string) --The name of the notification trigger.
triggerTargetArn (string) --The ARN of the Amazon Simple Notification Service topic through which notifications about deployment or instance events are sent.
triggerEvents (list) --The event type or types for which notifications are triggered.
(string) --
:type alarmConfiguration: dict
:param alarmConfiguration: Information to add or change about Amazon CloudWatch alarms when the deployment group is updated.
enabled (boolean) --Indicates whether the alarm configuration is enabled.
ignorePollAlarmFailure (boolean) --Indicates whether a deployment should continue if information about the current state of alarms cannot be retrieved from Amazon CloudWatch. The default value is false.
true: The deployment will proceed even if alarm status information can't be retrieved from Amazon CloudWatch.
false: The deployment will stop if alarm status information can't be retrieved from Amazon CloudWatch.
alarms (list) --A list of alarms configured for the deployment group. A maximum of 10 alarms can be added to a deployment group.
(dict) --Information about an alarm.
name (string) --The name of the alarm. Maximum length is 255 characters. Each alarm name can be used only once in a list of alarms.
:type autoRollbackConfiguration: dict
:param autoRollbackConfiguration: Information for an automatic rollback configuration that is added or changed when a deployment group is updated.
enabled (boolean) --Indicates whether a defined automatic rollback configuration is currently enabled.
events (list) --The event type or types that trigger a rollback.
(string) --
:type deploymentStyle: dict
:param deploymentStyle: Information about the type of deployment, either in-place or blue/green, you want to run and whether to route deployment traffic behind a load balancer.
deploymentType (string) --Indicates whether to run an in-place deployment or a blue/green deployment.
deploymentOption (string) --Indicates whether to route deployment traffic behind a load balancer.
:type blueGreenDeploymentConfiguration: dict
:param blueGreenDeploymentConfiguration: Information about blue/green deployment options for a deployment group.
terminateBlueInstancesOnDeploymentSuccess (dict) --Information about whether to terminate instances in the original fleet during a blue/green deployment.
action (string) --The action to take on instances in the original environment after a successful blue/green deployment.
TERMINATE: Instances are terminated after a specified wait time.
KEEP_ALIVE: Instances are left running after they are deregistered from the load balancer and removed from the deployment group.
terminationWaitTimeInMinutes (integer) --The number of minutes to wait after a successful blue/green deployment before terminating instances from the original environment.
deploymentReadyOption (dict) --Information about the action to take when newly provisioned instances are ready to receive traffic in a blue/green deployment.
actionOnTimeout (string) --Information about when to reroute traffic from an original environment to a replacement environment in a blue/green deployment.
CONTINUE_DEPLOYMENT: Register new instances with the load balancer immediately after the new application revision is installed on the instances in the replacement environment.
STOP_DEPLOYMENT: Do not register new instances with load balancer unless traffic is rerouted manually. If traffic is not rerouted manually before the end of the specified wait period, the deployment status is changed to Stopped.
waitTimeInMinutes (integer) --The number of minutes to wait before the status of a blue/green deployment changed to Stopped if rerouting is not started manually. Applies only to the STOP_DEPLOYMENT option for actionOnTimeout
greenFleetProvisioningOption (dict) --Information about how instances are provisioned for a replacement environment in a blue/green deployment.
action (string) --The method used to add instances to a replacement environment.
DISCOVER_EXISTING: Use instances that already exist or will be created manually.
COPY_AUTO_SCALING_GROUP: Use settings from a specified Auto Scaling group to define and create instances in a new Auto Scaling group.
:type loadBalancerInfo: dict
:param loadBalancerInfo: Information about the load balancer used in a deployment.
elbInfoList (list) --An array containing information about the load balancer in Elastic Load Balancing to use in a deployment.
(dict) --Information about a load balancer in Elastic Load Balancing to use in a deployment.
name (string) --For blue/green deployments, the name of the load balancer that will be used to route traffic from original instances to replacement instances in a blue/green deployment. For in-place deployments, the name of the load balancer that instances are deregistered from so they are not serving traffic during a deployment, and then re-registered with after the deployment completes.
:rtype: dict
:return: {
'hooksNotCleanedUp': [
{
'name': 'string',
'hook': 'string'
},
]
} | entailment |
def create_nfs_file_share(ClientToken=None, NFSFileShareDefaults=None, GatewayARN=None, KMSEncrypted=None, KMSKey=None, Role=None, LocationARN=None, DefaultStorageClass=None, ClientList=None, Squash=None, ReadOnly=None):
"""
Creates a file share on an existing file gateway. In Storage Gateway, a file share is a file system mount point backed by Amazon S3 cloud storage. Storage Gateway exposes file shares using a Network File System (NFS) interface. This operation is only supported in the file gateway architecture.
See also: AWS API Documentation
:example: response = client.create_nfs_file_share(
ClientToken='string',
NFSFileShareDefaults={
'FileMode': 'string',
'DirectoryMode': 'string',
'GroupId': 123,
'OwnerId': 123
},
GatewayARN='string',
KMSEncrypted=True|False,
KMSKey='string',
Role='string',
LocationARN='string',
DefaultStorageClass='string',
ClientList=[
'string',
],
Squash='string',
ReadOnly=True|False
)
:type ClientToken: string
:param ClientToken: [REQUIRED]
A unique string value that you supply that is used by file gateway to ensure idempotent file share creation.
:type NFSFileShareDefaults: dict
:param NFSFileShareDefaults: File share default values. Optional.
FileMode (string) --The Unix file mode in the form 'nnnn'. For example, '0666' represents the default file mode inside the file share. The default value is 0666.
DirectoryMode (string) --The Unix directory mode in the form 'nnnn'. For example, '0666' represents the default access mode for all directories inside the file share. The default value is 0777.
GroupId (integer) --The default group ID for the file share (unless the files have another group ID specified). The default value is nfsnobody.
OwnerId (integer) --The default owner ID for files in the file share (unless the files have another owner ID specified). The default value is nfsnobody.
:type GatewayARN: string
:param GatewayARN: [REQUIRED]
The Amazon Resource Name (ARN) of the file gateway on which you want to create a file share.
:type KMSEncrypted: boolean
:param KMSEncrypted: True to use Amazon S3 server side encryption with your own AWS KMS key, or false to use a key managed by Amazon S3. Optional.
:type KMSKey: string
:param KMSKey: The KMS key used for Amazon S3 server side encryption. This value can only be set when KmsEncrypted is true. Optional.
:type Role: string
:param Role: [REQUIRED]
The ARN of the AWS Identity and Access Management (IAM) role that a file gateway assumes when it accesses the underlying storage.
:type LocationARN: string
:param LocationARN: [REQUIRED]
The ARN of the backed storage used for storing file data.
:type DefaultStorageClass: string
:param DefaultStorageClass: The default storage class for objects put into an Amazon S3 bucket by file gateway. Possible values are S3_STANDARD or S3_STANDARD_IA. If this field is not populated, the default value S3_STANDARD is used. Optional.
:type ClientList: list
:param ClientList: The list of clients that are allowed to access the file gateway. The list must contain either valid IP addresses or valid CIDR blocks.
(string) --
:type Squash: string
:param Squash: Maps a user to anonymous user. Valid options are the following:
'RootSquash' - Only root is mapped to anonymous user.
'NoSquash' - No one is mapped to anonymous user.
'AllSquash' - Everyone is mapped to anonymous user.
:type ReadOnly: boolean
:param ReadOnly: Sets the write status of a file share: 'true' if the write status is read-only, and otherwise 'false'.
:rtype: dict
:return: {
'FileShareARN': 'string'
}
"""
pass | Creates a file share on an existing file gateway. In Storage Gateway, a file share is a file system mount point backed by Amazon S3 cloud storage. Storage Gateway exposes file shares using a Network File System (NFS) interface. This operation is only supported in the file gateway architecture.
See also: AWS API Documentation
:example: response = client.create_nfs_file_share(
ClientToken='string',
NFSFileShareDefaults={
'FileMode': 'string',
'DirectoryMode': 'string',
'GroupId': 123,
'OwnerId': 123
},
GatewayARN='string',
KMSEncrypted=True|False,
KMSKey='string',
Role='string',
LocationARN='string',
DefaultStorageClass='string',
ClientList=[
'string',
],
Squash='string',
ReadOnly=True|False
)
:type ClientToken: string
:param ClientToken: [REQUIRED]
A unique string value that you supply that is used by file gateway to ensure idempotent file share creation.
:type NFSFileShareDefaults: dict
:param NFSFileShareDefaults: File share default values. Optional.
FileMode (string) --The Unix file mode in the form 'nnnn'. For example, '0666' represents the default file mode inside the file share. The default value is 0666.
DirectoryMode (string) --The Unix directory mode in the form 'nnnn'. For example, '0666' represents the default access mode for all directories inside the file share. The default value is 0777.
GroupId (integer) --The default group ID for the file share (unless the files have another group ID specified). The default value is nfsnobody.
OwnerId (integer) --The default owner ID for files in the file share (unless the files have another owner ID specified). The default value is nfsnobody.
:type GatewayARN: string
:param GatewayARN: [REQUIRED]
The Amazon Resource Name (ARN) of the file gateway on which you want to create a file share.
:type KMSEncrypted: boolean
:param KMSEncrypted: True to use Amazon S3 server side encryption with your own AWS KMS key, or false to use a key managed by Amazon S3. Optional.
:type KMSKey: string
:param KMSKey: The KMS key used for Amazon S3 server side encryption. This value can only be set when KmsEncrypted is true. Optional.
:type Role: string
:param Role: [REQUIRED]
The ARN of the AWS Identity and Access Management (IAM) role that a file gateway assumes when it accesses the underlying storage.
:type LocationARN: string
:param LocationARN: [REQUIRED]
The ARN of the backed storage used for storing file data.
:type DefaultStorageClass: string
:param DefaultStorageClass: The default storage class for objects put into an Amazon S3 bucket by file gateway. Possible values are S3_STANDARD or S3_STANDARD_IA. If this field is not populated, the default value S3_STANDARD is used. Optional.
:type ClientList: list
:param ClientList: The list of clients that are allowed to access the file gateway. The list must contain either valid IP addresses or valid CIDR blocks.
(string) --
:type Squash: string
:param Squash: Maps a user to anonymous user. Valid options are the following:
'RootSquash' - Only root is mapped to anonymous user.
'NoSquash' - No one is mapped to anonymous user.
'AllSquash' - Everyone is mapped to anonymous user.
:type ReadOnly: boolean
:param ReadOnly: Sets the write status of a file share: 'true' if the write status is read-only, and otherwise 'false'.
:rtype: dict
:return: {
'FileShareARN': 'string'
} | entailment |
def create_target_group(Name=None, Protocol=None, Port=None, VpcId=None, HealthCheckProtocol=None, HealthCheckPort=None, HealthCheckPath=None, HealthCheckIntervalSeconds=None, HealthCheckTimeoutSeconds=None, HealthyThresholdCount=None, UnhealthyThresholdCount=None, Matcher=None):
"""
Creates a target group.
To register targets with the target group, use RegisterTargets . To update the health check settings for the target group, use ModifyTargetGroup . To monitor the health of targets in the target group, use DescribeTargetHealth .
To route traffic to the targets in a target group, specify the target group in an action using CreateListener or CreateRule .
To delete a target group, use DeleteTargetGroup .
For more information, see Target Groups for Your Application Load Balancers in the Application Load Balancers Guide .
See also: AWS API Documentation
Examples
This example creates a target group that you can use to route traffic to targets using HTTP on port 80. This target group uses the default health check configuration.
Expected Output:
:example: response = client.create_target_group(
Name='string',
Protocol='HTTP'|'HTTPS',
Port=123,
VpcId='string',
HealthCheckProtocol='HTTP'|'HTTPS',
HealthCheckPort='string',
HealthCheckPath='string',
HealthCheckIntervalSeconds=123,
HealthCheckTimeoutSeconds=123,
HealthyThresholdCount=123,
UnhealthyThresholdCount=123,
Matcher={
'HttpCode': 'string'
}
)
:type Name: string
:param Name: [REQUIRED]
The name of the target group.
This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.
:type Protocol: string
:param Protocol: [REQUIRED]
The protocol to use for routing traffic to the targets.
:type Port: integer
:param Port: [REQUIRED]
The port on which the targets receive traffic. This port is used unless you specify a port override when registering the target.
:type VpcId: string
:param VpcId: [REQUIRED]
The identifier of the virtual private cloud (VPC).
:type HealthCheckProtocol: string
:param HealthCheckProtocol: The protocol the load balancer uses when performing health checks on targets. The default is the HTTP protocol.
:type HealthCheckPort: string
:param HealthCheckPort: The port the load balancer uses when performing health checks on targets. The default is traffic-port , which indicates the port on which each target receives traffic from the load balancer.
:type HealthCheckPath: string
:param HealthCheckPath: The ping path that is the destination on the targets for health checks. The default is /.
:type HealthCheckIntervalSeconds: integer
:param HealthCheckIntervalSeconds: The approximate amount of time, in seconds, between health checks of an individual target. The default is 30 seconds.
:type HealthCheckTimeoutSeconds: integer
:param HealthCheckTimeoutSeconds: The amount of time, in seconds, during which no response from a target means a failed health check. The default is 5 seconds.
:type HealthyThresholdCount: integer
:param HealthyThresholdCount: The number of consecutive health checks successes required before considering an unhealthy target healthy. The default is 5.
:type UnhealthyThresholdCount: integer
:param UnhealthyThresholdCount: The number of consecutive health check failures required before considering a target unhealthy. The default is 2.
:type Matcher: dict
:param Matcher: The HTTP codes to use when checking for a successful response from a target. The default is 200.
HttpCode (string) -- [REQUIRED]The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, '200,202') or a range of values (for example, '200-299').
:rtype: dict
:return: {
'TargetGroups': [
{
'TargetGroupArn': 'string',
'TargetGroupName': 'string',
'Protocol': 'HTTP'|'HTTPS',
'Port': 123,
'VpcId': 'string',
'HealthCheckProtocol': 'HTTP'|'HTTPS',
'HealthCheckPort': 'string',
'HealthCheckIntervalSeconds': 123,
'HealthCheckTimeoutSeconds': 123,
'HealthyThresholdCount': 123,
'UnhealthyThresholdCount': 123,
'HealthCheckPath': 'string',
'Matcher': {
'HttpCode': 'string'
},
'LoadBalancerArns': [
'string',
]
},
]
}
:returns:
(string) --
"""
pass | Creates a target group.
To register targets with the target group, use RegisterTargets . To update the health check settings for the target group, use ModifyTargetGroup . To monitor the health of targets in the target group, use DescribeTargetHealth .
To route traffic to the targets in a target group, specify the target group in an action using CreateListener or CreateRule .
To delete a target group, use DeleteTargetGroup .
For more information, see Target Groups for Your Application Load Balancers in the Application Load Balancers Guide .
See also: AWS API Documentation
Examples
This example creates a target group that you can use to route traffic to targets using HTTP on port 80. This target group uses the default health check configuration.
Expected Output:
:example: response = client.create_target_group(
Name='string',
Protocol='HTTP'|'HTTPS',
Port=123,
VpcId='string',
HealthCheckProtocol='HTTP'|'HTTPS',
HealthCheckPort='string',
HealthCheckPath='string',
HealthCheckIntervalSeconds=123,
HealthCheckTimeoutSeconds=123,
HealthyThresholdCount=123,
UnhealthyThresholdCount=123,
Matcher={
'HttpCode': 'string'
}
)
:type Name: string
:param Name: [REQUIRED]
The name of the target group.
This name must be unique per region per account, can have a maximum of 32 characters, must contain only alphanumeric characters or hyphens, and must not begin or end with a hyphen.
:type Protocol: string
:param Protocol: [REQUIRED]
The protocol to use for routing traffic to the targets.
:type Port: integer
:param Port: [REQUIRED]
The port on which the targets receive traffic. This port is used unless you specify a port override when registering the target.
:type VpcId: string
:param VpcId: [REQUIRED]
The identifier of the virtual private cloud (VPC).
:type HealthCheckProtocol: string
:param HealthCheckProtocol: The protocol the load balancer uses when performing health checks on targets. The default is the HTTP protocol.
:type HealthCheckPort: string
:param HealthCheckPort: The port the load balancer uses when performing health checks on targets. The default is traffic-port , which indicates the port on which each target receives traffic from the load balancer.
:type HealthCheckPath: string
:param HealthCheckPath: The ping path that is the destination on the targets for health checks. The default is /.
:type HealthCheckIntervalSeconds: integer
:param HealthCheckIntervalSeconds: The approximate amount of time, in seconds, between health checks of an individual target. The default is 30 seconds.
:type HealthCheckTimeoutSeconds: integer
:param HealthCheckTimeoutSeconds: The amount of time, in seconds, during which no response from a target means a failed health check. The default is 5 seconds.
:type HealthyThresholdCount: integer
:param HealthyThresholdCount: The number of consecutive health checks successes required before considering an unhealthy target healthy. The default is 5.
:type UnhealthyThresholdCount: integer
:param UnhealthyThresholdCount: The number of consecutive health check failures required before considering a target unhealthy. The default is 2.
:type Matcher: dict
:param Matcher: The HTTP codes to use when checking for a successful response from a target. The default is 200.
HttpCode (string) -- [REQUIRED]The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, '200,202') or a range of values (for example, '200-299').
:rtype: dict
:return: {
'TargetGroups': [
{
'TargetGroupArn': 'string',
'TargetGroupName': 'string',
'Protocol': 'HTTP'|'HTTPS',
'Port': 123,
'VpcId': 'string',
'HealthCheckProtocol': 'HTTP'|'HTTPS',
'HealthCheckPort': 'string',
'HealthCheckIntervalSeconds': 123,
'HealthCheckTimeoutSeconds': 123,
'HealthyThresholdCount': 123,
'UnhealthyThresholdCount': 123,
'HealthCheckPath': 'string',
'Matcher': {
'HttpCode': 'string'
},
'LoadBalancerArns': [
'string',
]
},
]
}
:returns:
(string) -- | entailment |
def modify_target_group(TargetGroupArn=None, HealthCheckProtocol=None, HealthCheckPort=None, HealthCheckPath=None, HealthCheckIntervalSeconds=None, HealthCheckTimeoutSeconds=None, HealthyThresholdCount=None, UnhealthyThresholdCount=None, Matcher=None):
"""
Modifies the health checks used when evaluating the health state of the targets in the specified target group.
To monitor the health of the targets, use DescribeTargetHealth .
See also: AWS API Documentation
Examples
This example changes the configuration of the health checks used to evaluate the health of the targets for the specified target group.
Expected Output:
:example: response = client.modify_target_group(
TargetGroupArn='string',
HealthCheckProtocol='HTTP'|'HTTPS',
HealthCheckPort='string',
HealthCheckPath='string',
HealthCheckIntervalSeconds=123,
HealthCheckTimeoutSeconds=123,
HealthyThresholdCount=123,
UnhealthyThresholdCount=123,
Matcher={
'HttpCode': 'string'
}
)
:type TargetGroupArn: string
:param TargetGroupArn: [REQUIRED]
The Amazon Resource Name (ARN) of the target group.
:type HealthCheckProtocol: string
:param HealthCheckProtocol: The protocol to use to connect with the target.
:type HealthCheckPort: string
:param HealthCheckPort: The port to use to connect with the target.
:type HealthCheckPath: string
:param HealthCheckPath: The ping path that is the destination for the health check request.
:type HealthCheckIntervalSeconds: integer
:param HealthCheckIntervalSeconds: The approximate amount of time, in seconds, between health checks of an individual target.
:type HealthCheckTimeoutSeconds: integer
:param HealthCheckTimeoutSeconds: The amount of time, in seconds, during which no response means a failed health check.
:type HealthyThresholdCount: integer
:param HealthyThresholdCount: The number of consecutive health checks successes required before considering an unhealthy target healthy.
:type UnhealthyThresholdCount: integer
:param UnhealthyThresholdCount: The number of consecutive health check failures required before considering the target unhealthy.
:type Matcher: dict
:param Matcher: The HTTP codes to use when checking for a successful response from a target.
HttpCode (string) -- [REQUIRED]The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, '200,202') or a range of values (for example, '200-299').
:rtype: dict
:return: {
'TargetGroups': [
{
'TargetGroupArn': 'string',
'TargetGroupName': 'string',
'Protocol': 'HTTP'|'HTTPS',
'Port': 123,
'VpcId': 'string',
'HealthCheckProtocol': 'HTTP'|'HTTPS',
'HealthCheckPort': 'string',
'HealthCheckIntervalSeconds': 123,
'HealthCheckTimeoutSeconds': 123,
'HealthyThresholdCount': 123,
'UnhealthyThresholdCount': 123,
'HealthCheckPath': 'string',
'Matcher': {
'HttpCode': 'string'
},
'LoadBalancerArns': [
'string',
]
},
]
}
:returns:
(string) --
"""
pass | Modifies the health checks used when evaluating the health state of the targets in the specified target group.
To monitor the health of the targets, use DescribeTargetHealth .
See also: AWS API Documentation
Examples
This example changes the configuration of the health checks used to evaluate the health of the targets for the specified target group.
Expected Output:
:example: response = client.modify_target_group(
TargetGroupArn='string',
HealthCheckProtocol='HTTP'|'HTTPS',
HealthCheckPort='string',
HealthCheckPath='string',
HealthCheckIntervalSeconds=123,
HealthCheckTimeoutSeconds=123,
HealthyThresholdCount=123,
UnhealthyThresholdCount=123,
Matcher={
'HttpCode': 'string'
}
)
:type TargetGroupArn: string
:param TargetGroupArn: [REQUIRED]
The Amazon Resource Name (ARN) of the target group.
:type HealthCheckProtocol: string
:param HealthCheckProtocol: The protocol to use to connect with the target.
:type HealthCheckPort: string
:param HealthCheckPort: The port to use to connect with the target.
:type HealthCheckPath: string
:param HealthCheckPath: The ping path that is the destination for the health check request.
:type HealthCheckIntervalSeconds: integer
:param HealthCheckIntervalSeconds: The approximate amount of time, in seconds, between health checks of an individual target.
:type HealthCheckTimeoutSeconds: integer
:param HealthCheckTimeoutSeconds: The amount of time, in seconds, during which no response means a failed health check.
:type HealthyThresholdCount: integer
:param HealthyThresholdCount: The number of consecutive health checks successes required before considering an unhealthy target healthy.
:type UnhealthyThresholdCount: integer
:param UnhealthyThresholdCount: The number of consecutive health check failures required before considering the target unhealthy.
:type Matcher: dict
:param Matcher: The HTTP codes to use when checking for a successful response from a target.
HttpCode (string) -- [REQUIRED]The HTTP codes. You can specify values between 200 and 499. The default value is 200. You can specify multiple values (for example, '200,202') or a range of values (for example, '200-299').
:rtype: dict
:return: {
'TargetGroups': [
{
'TargetGroupArn': 'string',
'TargetGroupName': 'string',
'Protocol': 'HTTP'|'HTTPS',
'Port': 123,
'VpcId': 'string',
'HealthCheckProtocol': 'HTTP'|'HTTPS',
'HealthCheckPort': 'string',
'HealthCheckIntervalSeconds': 123,
'HealthCheckTimeoutSeconds': 123,
'HealthyThresholdCount': 123,
'UnhealthyThresholdCount': 123,
'HealthCheckPath': 'string',
'Matcher': {
'HttpCode': 'string'
},
'LoadBalancerArns': [
'string',
]
},
]
}
:returns:
(string) -- | entailment |
def create_fleet(Name=None, Description=None, BuildId=None, ServerLaunchPath=None, ServerLaunchParameters=None, LogPaths=None, EC2InstanceType=None, EC2InboundPermissions=None, NewGameSessionProtectionPolicy=None, RuntimeConfiguration=None, ResourceCreationLimitPolicy=None, MetricGroups=None):
"""
Creates a new fleet to run your game servers. A fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances, each of which can run multiple server processes to host game sessions. You configure a fleet to create instances with certain hardware specifications (see Amazon EC2 Instance Types for more information), and deploy a specified game build to each instance. A newly created fleet passes through several statuses; once it reaches the ACTIVE status, it can begin hosting game sessions.
To create a new fleet, you must specify the following: (1) fleet name, (2) build ID of an uploaded game build, (3) an EC2 instance type, and (4) a runtime configuration that describes which server processes to run on each instance in the fleet. (Although the runtime configuration is not a required parameter, the fleet cannot be successfully created without it.) You can also configure the new fleet with the following settings: fleet description, access permissions for inbound traffic, fleet-wide game session protection, and resource creation limit. If you use Amazon CloudWatch for metrics, you can add the new fleet to a metric group, which allows you to view aggregated metrics for a set of fleets. Once you specify a metric group, the new fleet's metrics are included in the metric group's data.
If the CreateFleet call is successful, Amazon GameLift performs the following tasks:
After a fleet is created, use the following actions to change fleet properties and configuration:
See also: AWS API Documentation
:example: response = client.create_fleet(
Name='string',
Description='string',
BuildId='string',
ServerLaunchPath='string',
ServerLaunchParameters='string',
LogPaths=[
'string',
],
EC2InstanceType='t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge',
EC2InboundPermissions=[
{
'FromPort': 123,
'ToPort': 123,
'IpRange': 'string',
'Protocol': 'TCP'|'UDP'
},
],
NewGameSessionProtectionPolicy='NoProtection'|'FullProtection',
RuntimeConfiguration={
'ServerProcesses': [
{
'LaunchPath': 'string',
'Parameters': 'string',
'ConcurrentExecutions': 123
},
],
'MaxConcurrentGameSessionActivations': 123,
'GameSessionActivationTimeoutSeconds': 123
},
ResourceCreationLimitPolicy={
'NewGameSessionsPerCreator': 123,
'PolicyPeriodInMinutes': 123
},
MetricGroups=[
'string',
]
)
:type Name: string
:param Name: [REQUIRED]
Descriptive label that is associated with a fleet. Fleet names do not need to be unique.
:type Description: string
:param Description: Human-readable description of a fleet.
:type BuildId: string
:param BuildId: [REQUIRED]
Unique identifier for a build to be deployed on the new fleet. The build must have been successfully uploaded to Amazon GameLift and be in a READY status. This fleet setting cannot be changed once the fleet is created.
:type ServerLaunchPath: string
:param ServerLaunchPath: This parameter is no longer used. Instead, specify a server launch path using the RuntimeConfiguration parameter. (Requests that specify a server launch path and launch parameters instead of a runtime configuration will continue to work.)
:type ServerLaunchParameters: string
:param ServerLaunchParameters: This parameter is no longer used. Instead, specify server launch parameters in the RuntimeConfiguration parameter. (Requests that specify a server launch path and launch parameters instead of a runtime configuration will continue to work.)
:type LogPaths: list
:param LogPaths: This parameter is no longer used. Instead, to specify where Amazon GameLift should store log files once a server process shuts down, use the Amazon GameLift server API ProcessReady() and specify one or more directory paths in logParameters . See more information in the Server API Reference .
(string) --
:type EC2InstanceType: string
:param EC2InstanceType: [REQUIRED]
Name of an EC2 instance type that is supported in Amazon GameLift. A fleet instance type determines the computing resources of each instance in the fleet, including CPU, memory, storage, and networking capacity. Amazon GameLift supports the following EC2 instance types. See Amazon EC2 Instance Types for detailed descriptions.
:type EC2InboundPermissions: list
:param EC2InboundPermissions: Range of IP addresses and port settings that permit inbound traffic to access server processes running on the fleet. If no inbound permissions are set, including both IP address range and port range, the server processes in the fleet cannot accept connections. You can specify one or more sets of permissions for a fleet.
(dict) --A range of IP addresses and port settings that allow inbound traffic to connect to server processes on Amazon GameLift. Each game session hosted on a fleet is assigned a unique combination of IP address and port number, which must fall into the fleet's allowed ranges. This combination is included in the GameSession object.
FromPort (integer) -- [REQUIRED]Starting value for a range of allowed port numbers.
ToPort (integer) -- [REQUIRED]Ending value for a range of allowed port numbers. Port numbers are end-inclusive. This value must be higher than FromPort .
IpRange (string) -- [REQUIRED]Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: '000.000.000.000/[subnet mask] ' or optionally the shortened version '0.0.0.0/[subnet mask] '.
Protocol (string) -- [REQUIRED]Network communication protocol used by the fleet.
:type NewGameSessionProtectionPolicy: string
:param NewGameSessionProtectionPolicy: Game session protection policy to apply to all instances in this fleet. If this parameter is not set, instances in this fleet default to no protection. You can change a fleet's protection policy using UpdateFleetAttributes, but this change will only affect sessions created after the policy change. You can also set protection for individual instances using UpdateGameSession .
NoProtection The game session can be terminated during a scale-down event.
FullProtection If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.
:type RuntimeConfiguration: dict
:param RuntimeConfiguration: Instructions for launching server processes on each instance in the fleet. The runtime configuration for a fleet has a collection of server process configurations, one for each type of server process to run on an instance. A server process configuration specifies the location of the server executable, launch parameters, and the number of concurrent processes with that configuration to maintain on each instance. A CreateFleet request must include a runtime configuration with at least one server process configuration; otherwise the request will fail with an invalid request exception. (This parameter replaces the parameters ServerLaunchPath and ServerLaunchParameters ; requests that contain values for these parameters instead of a runtime configuration will continue to work.)
ServerProcesses (list) --Collection of server process configurations that describe which server processes to run on each instance in a fleet.
(dict) --A set of instructions for launching server processes on each instance in a fleet. Each instruction set identifies the location of the server executable, optional launch parameters, and the number of server processes with this configuration to maintain concurrently on the instance. Server process configurations make up a fleet's `` RuntimeConfiguration `` .
LaunchPath (string) -- [REQUIRED]Location of the server executable in a game build. All game builds are installed on instances at the root : for Windows instances C:\game , and for Linux instances /local/game . A Windows game build with an executable file located at MyGame\latest\server.exe must have a launch path of 'C:\game\MyGame\latest\server.exe '. A Linux game build with an executable file located at MyGame/latest/server.exe must have a launch path of '/local/game/MyGame/latest/server.exe '.
Parameters (string) --Optional list of parameters to pass to the server executable on launch.
ConcurrentExecutions (integer) -- [REQUIRED]Number of server processes using this configuration to run concurrently on an instance.
MaxConcurrentGameSessionActivations (integer) --Maximum number of game sessions with status ACTIVATING to allow on an instance simultaneously. This setting limits the amount of instance resources that can be used for new game activations at any one time.
GameSessionActivationTimeoutSeconds (integer) --Maximum amount of time (in seconds) that a game session can remain in status ACTIVATING. If the game session is not active before the timeout, activation is terminated and the game session status is changed to TERMINATED.
:type ResourceCreationLimitPolicy: dict
:param ResourceCreationLimitPolicy: Policy that limits the number of game sessions an individual player can create over a span of time for this fleet.
NewGameSessionsPerCreator (integer) --Maximum number of game sessions that an individual can create during the policy period.
PolicyPeriodInMinutes (integer) --Time span used in evaluating the resource creation limit policy.
:type MetricGroups: list
:param MetricGroups: Names of metric groups to add this fleet to. Use an existing metric group name to add this fleet to the group, or use a new name to create a new metric group. Currently, a fleet can only be included in one metric group at a time.
(string) --
:rtype: dict
:return: {
'FleetAttributes': {
'FleetId': 'string',
'FleetArn': 'string',
'Description': 'string',
'Name': 'string',
'CreationTime': datetime(2015, 1, 1),
'TerminationTime': datetime(2015, 1, 1),
'Status': 'NEW'|'DOWNLOADING'|'VALIDATING'|'BUILDING'|'ACTIVATING'|'ACTIVE'|'DELETING'|'ERROR'|'TERMINATED',
'BuildId': 'string',
'ServerLaunchPath': 'string',
'ServerLaunchParameters': 'string',
'LogPaths': [
'string',
],
'NewGameSessionProtectionPolicy': 'NoProtection'|'FullProtection',
'OperatingSystem': 'WINDOWS_2012'|'AMAZON_LINUX',
'ResourceCreationLimitPolicy': {
'NewGameSessionsPerCreator': 123,
'PolicyPeriodInMinutes': 123
},
'MetricGroups': [
'string',
]
}
}
:returns:
UpdateFleetAttributes -- Update fleet metadata, including name and description.
UpdateFleetCapacity -- Increase or decrease the number of instances you want the fleet to maintain.
UpdateFleetPortSettings -- Change the IP address and port ranges that allow access to incoming traffic.
UpdateRuntimeConfiguration -- Change how server processes are launched in the fleet, including launch path, launch parameters, and the number of concurrent processes.
PutScalingPolicy -- Create or update rules that are used to set the fleet's capacity (autoscaling).
"""
pass | Creates a new fleet to run your game servers. A fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances, each of which can run multiple server processes to host game sessions. You configure a fleet to create instances with certain hardware specifications (see Amazon EC2 Instance Types for more information), and deploy a specified game build to each instance. A newly created fleet passes through several statuses; once it reaches the ACTIVE status, it can begin hosting game sessions.
To create a new fleet, you must specify the following: (1) fleet name, (2) build ID of an uploaded game build, (3) an EC2 instance type, and (4) a runtime configuration that describes which server processes to run on each instance in the fleet. (Although the runtime configuration is not a required parameter, the fleet cannot be successfully created without it.) You can also configure the new fleet with the following settings: fleet description, access permissions for inbound traffic, fleet-wide game session protection, and resource creation limit. If you use Amazon CloudWatch for metrics, you can add the new fleet to a metric group, which allows you to view aggregated metrics for a set of fleets. Once you specify a metric group, the new fleet's metrics are included in the metric group's data.
If the CreateFleet call is successful, Amazon GameLift performs the following tasks:
After a fleet is created, use the following actions to change fleet properties and configuration:
See also: AWS API Documentation
:example: response = client.create_fleet(
Name='string',
Description='string',
BuildId='string',
ServerLaunchPath='string',
ServerLaunchParameters='string',
LogPaths=[
'string',
],
EC2InstanceType='t2.micro'|'t2.small'|'t2.medium'|'t2.large'|'c3.large'|'c3.xlarge'|'c3.2xlarge'|'c3.4xlarge'|'c3.8xlarge'|'c4.large'|'c4.xlarge'|'c4.2xlarge'|'c4.4xlarge'|'c4.8xlarge'|'r3.large'|'r3.xlarge'|'r3.2xlarge'|'r3.4xlarge'|'r3.8xlarge'|'m3.medium'|'m3.large'|'m3.xlarge'|'m3.2xlarge'|'m4.large'|'m4.xlarge'|'m4.2xlarge'|'m4.4xlarge'|'m4.10xlarge',
EC2InboundPermissions=[
{
'FromPort': 123,
'ToPort': 123,
'IpRange': 'string',
'Protocol': 'TCP'|'UDP'
},
],
NewGameSessionProtectionPolicy='NoProtection'|'FullProtection',
RuntimeConfiguration={
'ServerProcesses': [
{
'LaunchPath': 'string',
'Parameters': 'string',
'ConcurrentExecutions': 123
},
],
'MaxConcurrentGameSessionActivations': 123,
'GameSessionActivationTimeoutSeconds': 123
},
ResourceCreationLimitPolicy={
'NewGameSessionsPerCreator': 123,
'PolicyPeriodInMinutes': 123
},
MetricGroups=[
'string',
]
)
:type Name: string
:param Name: [REQUIRED]
Descriptive label that is associated with a fleet. Fleet names do not need to be unique.
:type Description: string
:param Description: Human-readable description of a fleet.
:type BuildId: string
:param BuildId: [REQUIRED]
Unique identifier for a build to be deployed on the new fleet. The build must have been successfully uploaded to Amazon GameLift and be in a READY status. This fleet setting cannot be changed once the fleet is created.
:type ServerLaunchPath: string
:param ServerLaunchPath: This parameter is no longer used. Instead, specify a server launch path using the RuntimeConfiguration parameter. (Requests that specify a server launch path and launch parameters instead of a runtime configuration will continue to work.)
:type ServerLaunchParameters: string
:param ServerLaunchParameters: This parameter is no longer used. Instead, specify server launch parameters in the RuntimeConfiguration parameter. (Requests that specify a server launch path and launch parameters instead of a runtime configuration will continue to work.)
:type LogPaths: list
:param LogPaths: This parameter is no longer used. Instead, to specify where Amazon GameLift should store log files once a server process shuts down, use the Amazon GameLift server API ProcessReady() and specify one or more directory paths in logParameters . See more information in the Server API Reference .
(string) --
:type EC2InstanceType: string
:param EC2InstanceType: [REQUIRED]
Name of an EC2 instance type that is supported in Amazon GameLift. A fleet instance type determines the computing resources of each instance in the fleet, including CPU, memory, storage, and networking capacity. Amazon GameLift supports the following EC2 instance types. See Amazon EC2 Instance Types for detailed descriptions.
:type EC2InboundPermissions: list
:param EC2InboundPermissions: Range of IP addresses and port settings that permit inbound traffic to access server processes running on the fleet. If no inbound permissions are set, including both IP address range and port range, the server processes in the fleet cannot accept connections. You can specify one or more sets of permissions for a fleet.
(dict) --A range of IP addresses and port settings that allow inbound traffic to connect to server processes on Amazon GameLift. Each game session hosted on a fleet is assigned a unique combination of IP address and port number, which must fall into the fleet's allowed ranges. This combination is included in the GameSession object.
FromPort (integer) -- [REQUIRED]Starting value for a range of allowed port numbers.
ToPort (integer) -- [REQUIRED]Ending value for a range of allowed port numbers. Port numbers are end-inclusive. This value must be higher than FromPort .
IpRange (string) -- [REQUIRED]Range of allowed IP addresses. This value must be expressed in CIDR notation. Example: '000.000.000.000/[subnet mask] ' or optionally the shortened version '0.0.0.0/[subnet mask] '.
Protocol (string) -- [REQUIRED]Network communication protocol used by the fleet.
:type NewGameSessionProtectionPolicy: string
:param NewGameSessionProtectionPolicy: Game session protection policy to apply to all instances in this fleet. If this parameter is not set, instances in this fleet default to no protection. You can change a fleet's protection policy using UpdateFleetAttributes, but this change will only affect sessions created after the policy change. You can also set protection for individual instances using UpdateGameSession .
NoProtection The game session can be terminated during a scale-down event.
FullProtection If the game session is in an ACTIVE status, it cannot be terminated during a scale-down event.
:type RuntimeConfiguration: dict
:param RuntimeConfiguration: Instructions for launching server processes on each instance in the fleet. The runtime configuration for a fleet has a collection of server process configurations, one for each type of server process to run on an instance. A server process configuration specifies the location of the server executable, launch parameters, and the number of concurrent processes with that configuration to maintain on each instance. A CreateFleet request must include a runtime configuration with at least one server process configuration; otherwise the request will fail with an invalid request exception. (This parameter replaces the parameters ServerLaunchPath and ServerLaunchParameters ; requests that contain values for these parameters instead of a runtime configuration will continue to work.)
ServerProcesses (list) --Collection of server process configurations that describe which server processes to run on each instance in a fleet.
(dict) --A set of instructions for launching server processes on each instance in a fleet. Each instruction set identifies the location of the server executable, optional launch parameters, and the number of server processes with this configuration to maintain concurrently on the instance. Server process configurations make up a fleet's `` RuntimeConfiguration `` .
LaunchPath (string) -- [REQUIRED]Location of the server executable in a game build. All game builds are installed on instances at the root : for Windows instances C:\game , and for Linux instances /local/game . A Windows game build with an executable file located at MyGame\latest\server.exe must have a launch path of 'C:\game\MyGame\latest\server.exe '. A Linux game build with an executable file located at MyGame/latest/server.exe must have a launch path of '/local/game/MyGame/latest/server.exe '.
Parameters (string) --Optional list of parameters to pass to the server executable on launch.
ConcurrentExecutions (integer) -- [REQUIRED]Number of server processes using this configuration to run concurrently on an instance.
MaxConcurrentGameSessionActivations (integer) --Maximum number of game sessions with status ACTIVATING to allow on an instance simultaneously. This setting limits the amount of instance resources that can be used for new game activations at any one time.
GameSessionActivationTimeoutSeconds (integer) --Maximum amount of time (in seconds) that a game session can remain in status ACTIVATING. If the game session is not active before the timeout, activation is terminated and the game session status is changed to TERMINATED.
:type ResourceCreationLimitPolicy: dict
:param ResourceCreationLimitPolicy: Policy that limits the number of game sessions an individual player can create over a span of time for this fleet.
NewGameSessionsPerCreator (integer) --Maximum number of game sessions that an individual can create during the policy period.
PolicyPeriodInMinutes (integer) --Time span used in evaluating the resource creation limit policy.
:type MetricGroups: list
:param MetricGroups: Names of metric groups to add this fleet to. Use an existing metric group name to add this fleet to the group, or use a new name to create a new metric group. Currently, a fleet can only be included in one metric group at a time.
(string) --
:rtype: dict
:return: {
'FleetAttributes': {
'FleetId': 'string',
'FleetArn': 'string',
'Description': 'string',
'Name': 'string',
'CreationTime': datetime(2015, 1, 1),
'TerminationTime': datetime(2015, 1, 1),
'Status': 'NEW'|'DOWNLOADING'|'VALIDATING'|'BUILDING'|'ACTIVATING'|'ACTIVE'|'DELETING'|'ERROR'|'TERMINATED',
'BuildId': 'string',
'ServerLaunchPath': 'string',
'ServerLaunchParameters': 'string',
'LogPaths': [
'string',
],
'NewGameSessionProtectionPolicy': 'NoProtection'|'FullProtection',
'OperatingSystem': 'WINDOWS_2012'|'AMAZON_LINUX',
'ResourceCreationLimitPolicy': {
'NewGameSessionsPerCreator': 123,
'PolicyPeriodInMinutes': 123
},
'MetricGroups': [
'string',
]
}
}
:returns:
UpdateFleetAttributes -- Update fleet metadata, including name and description.
UpdateFleetCapacity -- Increase or decrease the number of instances you want the fleet to maintain.
UpdateFleetPortSettings -- Change the IP address and port ranges that allow access to incoming traffic.
UpdateRuntimeConfiguration -- Change how server processes are launched in the fleet, including launch path, launch parameters, and the number of concurrent processes.
PutScalingPolicy -- Create or update rules that are used to set the fleet's capacity (autoscaling). | entailment |
def send_email(Source=None, Destination=None, Message=None, ReplyToAddresses=None, ReturnPath=None, SourceArn=None, ReturnPathArn=None, Tags=None, ConfigurationSetName=None):
"""
Composes an email message based on input data, and then immediately queues the message for sending.
There are several important points to know about SendEmail :
See also: AWS API Documentation
Examples
The following example sends a formatted email:
Expected Output:
:example: response = client.send_email(
Source='string',
Destination={
'ToAddresses': [
'string',
],
'CcAddresses': [
'string',
],
'BccAddresses': [
'string',
]
},
Message={
'Subject': {
'Data': 'string',
'Charset': 'string'
},
'Body': {
'Text': {
'Data': 'string',
'Charset': 'string'
},
'Html': {
'Data': 'string',
'Charset': 'string'
}
}
},
ReplyToAddresses=[
'string',
],
ReturnPath='string',
SourceArn='string',
ReturnPathArn='string',
Tags=[
{
'Name': 'string',
'Value': 'string'
},
],
ConfigurationSetName='string'
)
:type Source: string
:param Source: [REQUIRED]
The email address that is sending the email. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES. For information about verifying identities, see the Amazon SES Developer Guide .
If you are sending on behalf of another user and have been permitted to do so by a sending authorization policy, then you must also specify the SourceArn parameter. For more information about sending authorization, see the Amazon SES Developer Guide .
In all cases, the email address must be 7-bit ASCII. If the text must contain any other characters, then you must use MIME encoded-word syntax (RFC 2047) instead of a literal string. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?= . For more information, see RFC 2047 .
:type Destination: dict
:param Destination: [REQUIRED]
The destination for this email, composed of To:, CC:, and BCC: fields.
ToAddresses (list) --The To: field(s) of the message.
(string) --
CcAddresses (list) --The CC: field(s) of the message.
(string) --
BccAddresses (list) --The BCC: field(s) of the message.
(string) --
:type Message: dict
:param Message: [REQUIRED]
The message to be sent.
Subject (dict) -- [REQUIRED]The subject of the message: A short summary of the content, which will appear in the recipient's inbox.
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
Body (dict) -- [REQUIRED]The message body.
Text (dict) --The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
Html (dict) --The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
:type ReplyToAddresses: list
:param ReplyToAddresses: The reply-to email address(es) for the message. If the recipient replies to the message, each reply-to address will receive the reply.
(string) --
:type ReturnPath: string
:param ReturnPath: The email address to which bounces and complaints are to be forwarded when feedback forwarding is enabled. If the message cannot be delivered to the recipient, then an error message will be returned from the recipient's ISP; this message will then be forwarded to the email address specified by the ReturnPath parameter. The ReturnPath parameter is never overwritten. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES.
:type SourceArn: string
:param SourceArn: This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter.
For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to send from [email protected] , then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the Source to be [email protected] .
For more information about sending authorization, see the Amazon SES Developer Guide .
:type ReturnPathArn: string
:param ReturnPathArn: This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter.
For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to use [email protected] , then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the ReturnPath to be [email protected] .
For more information about sending authorization, see the Amazon SES Developer Guide .
:type Tags: list
:param Tags: A list of tags, in the form of name/value pairs, to apply to an email that you send using SendEmail . Tags correspond to characteristics of the email that you define, so that you can publish email sending events.
(dict) --Contains the name and value of a tag that you can provide to SendEmail or SendRawEmail to apply to an email.
Message tags, which you use with configuration sets, enable you to publish email sending events. For information about using configuration sets, see the Amazon SES Developer Guide .
Name (string) -- [REQUIRED]The name of the tag. The name must:
Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
Contain less than 256 characters.
Value (string) -- [REQUIRED]The value of the tag. The value must:
Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
Contain less than 256 characters.
:type ConfigurationSetName: string
:param ConfigurationSetName: The name of the configuration set to use when you send an email using SendEmail .
:rtype: dict
:return: {
'MessageId': 'string'
}
:returns:
Source (string) -- [REQUIRED]
The email address that is sending the email. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES. For information about verifying identities, see the Amazon SES Developer Guide .
If you are sending on behalf of another user and have been permitted to do so by a sending authorization policy, then you must also specify the SourceArn parameter. For more information about sending authorization, see the Amazon SES Developer Guide .
In all cases, the email address must be 7-bit ASCII. If the text must contain any other characters, then you must use MIME encoded-word syntax (RFC 2047) instead of a literal string. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?= . For more information, see RFC 2047 .
Destination (dict) -- [REQUIRED]
The destination for this email, composed of To:, CC:, and BCC: fields.
ToAddresses (list) --The To: field(s) of the message.
(string) --
CcAddresses (list) --The CC: field(s) of the message.
(string) --
BccAddresses (list) --The BCC: field(s) of the message.
(string) --
Message (dict) -- [REQUIRED]
The message to be sent.
Subject (dict) -- [REQUIRED]The subject of the message: A short summary of the content, which will appear in the recipient's inbox.
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
Body (dict) -- [REQUIRED]The message body.
Text (dict) --The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
Html (dict) --The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
ReplyToAddresses (list) -- The reply-to email address(es) for the message. If the recipient replies to the message, each reply-to address will receive the reply.
(string) --
ReturnPath (string) -- The email address to which bounces and complaints are to be forwarded when feedback forwarding is enabled. If the message cannot be delivered to the recipient, then an error message will be returned from the recipient's ISP; this message will then be forwarded to the email address specified by the ReturnPath parameter. The ReturnPath parameter is never overwritten. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES.
SourceArn (string) -- This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter.
For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to send from [email protected] , then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the Source to be [email protected] .
For more information about sending authorization, see the Amazon SES Developer Guide .
ReturnPathArn (string) -- This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter.
For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to use [email protected] , then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the ReturnPath to be [email protected] .
For more information about sending authorization, see the Amazon SES Developer Guide .
Tags (list) -- A list of tags, in the form of name/value pairs, to apply to an email that you send using SendEmail . Tags correspond to characteristics of the email that you define, so that you can publish email sending events.
(dict) --Contains the name and value of a tag that you can provide to SendEmail or SendRawEmail to apply to an email.
Message tags, which you use with configuration sets, enable you to publish email sending events. For information about using configuration sets, see the Amazon SES Developer Guide .
Name (string) -- [REQUIRED]The name of the tag. The name must:
Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
Contain less than 256 characters.
Value (string) -- [REQUIRED]The value of the tag. The value must:
Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
Contain less than 256 characters.
ConfigurationSetName (string) -- The name of the configuration set to use when you send an email using SendEmail .
"""
pass | Composes an email message based on input data, and then immediately queues the message for sending.
There are several important points to know about SendEmail :
See also: AWS API Documentation
Examples
The following example sends a formatted email:
Expected Output:
:example: response = client.send_email(
Source='string',
Destination={
'ToAddresses': [
'string',
],
'CcAddresses': [
'string',
],
'BccAddresses': [
'string',
]
},
Message={
'Subject': {
'Data': 'string',
'Charset': 'string'
},
'Body': {
'Text': {
'Data': 'string',
'Charset': 'string'
},
'Html': {
'Data': 'string',
'Charset': 'string'
}
}
},
ReplyToAddresses=[
'string',
],
ReturnPath='string',
SourceArn='string',
ReturnPathArn='string',
Tags=[
{
'Name': 'string',
'Value': 'string'
},
],
ConfigurationSetName='string'
)
:type Source: string
:param Source: [REQUIRED]
The email address that is sending the email. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES. For information about verifying identities, see the Amazon SES Developer Guide .
If you are sending on behalf of another user and have been permitted to do so by a sending authorization policy, then you must also specify the SourceArn parameter. For more information about sending authorization, see the Amazon SES Developer Guide .
In all cases, the email address must be 7-bit ASCII. If the text must contain any other characters, then you must use MIME encoded-word syntax (RFC 2047) instead of a literal string. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?= . For more information, see RFC 2047 .
:type Destination: dict
:param Destination: [REQUIRED]
The destination for this email, composed of To:, CC:, and BCC: fields.
ToAddresses (list) --The To: field(s) of the message.
(string) --
CcAddresses (list) --The CC: field(s) of the message.
(string) --
BccAddresses (list) --The BCC: field(s) of the message.
(string) --
:type Message: dict
:param Message: [REQUIRED]
The message to be sent.
Subject (dict) -- [REQUIRED]The subject of the message: A short summary of the content, which will appear in the recipient's inbox.
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
Body (dict) -- [REQUIRED]The message body.
Text (dict) --The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
Html (dict) --The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
:type ReplyToAddresses: list
:param ReplyToAddresses: The reply-to email address(es) for the message. If the recipient replies to the message, each reply-to address will receive the reply.
(string) --
:type ReturnPath: string
:param ReturnPath: The email address to which bounces and complaints are to be forwarded when feedback forwarding is enabled. If the message cannot be delivered to the recipient, then an error message will be returned from the recipient's ISP; this message will then be forwarded to the email address specified by the ReturnPath parameter. The ReturnPath parameter is never overwritten. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES.
:type SourceArn: string
:param SourceArn: This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter.
For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to send from [email protected] , then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the Source to be [email protected] .
For more information about sending authorization, see the Amazon SES Developer Guide .
:type ReturnPathArn: string
:param ReturnPathArn: This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter.
For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to use [email protected] , then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the ReturnPath to be [email protected] .
For more information about sending authorization, see the Amazon SES Developer Guide .
:type Tags: list
:param Tags: A list of tags, in the form of name/value pairs, to apply to an email that you send using SendEmail . Tags correspond to characteristics of the email that you define, so that you can publish email sending events.
(dict) --Contains the name and value of a tag that you can provide to SendEmail or SendRawEmail to apply to an email.
Message tags, which you use with configuration sets, enable you to publish email sending events. For information about using configuration sets, see the Amazon SES Developer Guide .
Name (string) -- [REQUIRED]The name of the tag. The name must:
Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
Contain less than 256 characters.
Value (string) -- [REQUIRED]The value of the tag. The value must:
Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
Contain less than 256 characters.
:type ConfigurationSetName: string
:param ConfigurationSetName: The name of the configuration set to use when you send an email using SendEmail .
:rtype: dict
:return: {
'MessageId': 'string'
}
:returns:
Source (string) -- [REQUIRED]
The email address that is sending the email. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES. For information about verifying identities, see the Amazon SES Developer Guide .
If you are sending on behalf of another user and have been permitted to do so by a sending authorization policy, then you must also specify the SourceArn parameter. For more information about sending authorization, see the Amazon SES Developer Guide .
In all cases, the email address must be 7-bit ASCII. If the text must contain any other characters, then you must use MIME encoded-word syntax (RFC 2047) instead of a literal string. MIME encoded-word syntax uses the following form: =?charset?encoding?encoded-text?= . For more information, see RFC 2047 .
Destination (dict) -- [REQUIRED]
The destination for this email, composed of To:, CC:, and BCC: fields.
ToAddresses (list) --The To: field(s) of the message.
(string) --
CcAddresses (list) --The CC: field(s) of the message.
(string) --
BccAddresses (list) --The BCC: field(s) of the message.
(string) --
Message (dict) -- [REQUIRED]
The message to be sent.
Subject (dict) -- [REQUIRED]The subject of the message: A short summary of the content, which will appear in the recipient's inbox.
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
Body (dict) -- [REQUIRED]The message body.
Text (dict) --The content of the message, in text format. Use this for text-based email clients, or clients on high-latency networks (such as mobile devices).
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
Html (dict) --The content of the message, in HTML format. Use this for email clients that can process HTML. You can include clickable links, formatted text, and much more in an HTML message.
Data (string) -- [REQUIRED]The textual data of the content.
Charset (string) --The character set of the content.
ReplyToAddresses (list) -- The reply-to email address(es) for the message. If the recipient replies to the message, each reply-to address will receive the reply.
(string) --
ReturnPath (string) -- The email address to which bounces and complaints are to be forwarded when feedback forwarding is enabled. If the message cannot be delivered to the recipient, then an error message will be returned from the recipient's ISP; this message will then be forwarded to the email address specified by the ReturnPath parameter. The ReturnPath parameter is never overwritten. This email address must be either individually verified with Amazon SES, or from a domain that has been verified with Amazon SES.
SourceArn (string) -- This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to send for the email address specified in the Source parameter.
For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to send from [email protected] , then you would specify the SourceArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the Source to be [email protected] .
For more information about sending authorization, see the Amazon SES Developer Guide .
ReturnPathArn (string) -- This parameter is used only for sending authorization. It is the ARN of the identity that is associated with the sending authorization policy that permits you to use the email address specified in the ReturnPath parameter.
For example, if the owner of example.com (which has ARN arn:aws:ses:us-east-1:123456789012:identity/example.com ) attaches a policy to it that authorizes you to use [email protected] , then you would specify the ReturnPathArn to be arn:aws:ses:us-east-1:123456789012:identity/example.com , and the ReturnPath to be [email protected] .
For more information about sending authorization, see the Amazon SES Developer Guide .
Tags (list) -- A list of tags, in the form of name/value pairs, to apply to an email that you send using SendEmail . Tags correspond to characteristics of the email that you define, so that you can publish email sending events.
(dict) --Contains the name and value of a tag that you can provide to SendEmail or SendRawEmail to apply to an email.
Message tags, which you use with configuration sets, enable you to publish email sending events. For information about using configuration sets, see the Amazon SES Developer Guide .
Name (string) -- [REQUIRED]The name of the tag. The name must:
Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
Contain less than 256 characters.
Value (string) -- [REQUIRED]The value of the tag. The value must:
Contain only ASCII letters (a-z, A-Z), numbers (0-9), underscores (_), or dashes (-).
Contain less than 256 characters.
ConfigurationSetName (string) -- The name of the configuration set to use when you send an email using SendEmail . | entailment |
def get_metric_statistics(Namespace=None, MetricName=None, Dimensions=None, StartTime=None, EndTime=None, Period=None, Statistics=None, ExtendedStatistics=None, Unit=None):
"""
Gets statistics for the specified metric.
Amazon CloudWatch retains metric data as follows:
Note that CloudWatch started retaining 5-minute and 1-hour metric data as of 9 July 2016.
The maximum number of data points returned from a single call is 1,440. If you request more than 1,440 data points, Amazon CloudWatch returns an error. To reduce the number of data points, you can narrow the specified time range and make multiple requests across adjacent time ranges, or you can increase the specified period. A period can be as short as one minute (60 seconds). Note that data points are not returned in chronological order.
Amazon CloudWatch aggregates data points based on the length of the period that you specify. For example, if you request statistics with a one-hour period, Amazon CloudWatch aggregates all data points with time stamps that fall within each one-hour period. Therefore, the number of values aggregated by CloudWatch is larger than the number of data points returned.
CloudWatch needs raw data points to calculate percentile statistics. If you publish data using a statistic set instead, you cannot retrieve percentile statistics for this data unless one of the following conditions is true:
For a list of metrics and dimensions supported by AWS services, see the Amazon CloudWatch Metrics and Dimensions Reference in the Amazon CloudWatch User Guide .
See also: AWS API Documentation
:example: response = client.get_metric_statistics(
Namespace='string',
MetricName='string',
Dimensions=[
{
'Name': 'string',
'Value': 'string'
},
],
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
Period=123,
Statistics=[
'SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
],
ExtendedStatistics=[
'string',
],
Unit='Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None'
)
:type Namespace: string
:param Namespace: [REQUIRED]
The namespace of the metric, with or without spaces.
:type MetricName: string
:param MetricName: [REQUIRED]
The name of the metric, with or without spaces.
:type Dimensions: list
:param Dimensions: The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension. CloudWatch treats each unique combination of dimensions as a separate metric. You can't retrieve statistics using combinations of dimensions that were not specially published. You must specify the same dimensions that were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide . For more information on specifying dimensions, see Publishing Metrics in the Amazon CloudWatch User Guide .
(dict) --Expands the identity of a metric.
Name (string) -- [REQUIRED]The name of the dimension.
Value (string) -- [REQUIRED]The value representing the dimension measurement.
:type StartTime: datetime
:param StartTime: [REQUIRED]
The time stamp that determines the first data point to return. Note that start times are evaluated relative to the time that CloudWatch receives the request.
The value specified is inclusive; results include data points with the specified time stamp. The time stamp must be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z).
CloudWatch rounds the specified time stamp as follows:
Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is rounded down to 12:32:00.
Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For example, 12:32:34 is rounded down to 12:30:00.
Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example, 12:32:34 is rounded down to 12:00:00.
:type EndTime: datetime
:param EndTime: [REQUIRED]
The time stamp that determines the last data point to return.
The value specified is exclusive; results will include data points up to the specified time stamp. The time stamp must be in ISO 8601 UTC format (for example, 2016-10-10T23:00:00Z).
:type Period: integer
:param Period: [REQUIRED]
The granularity, in seconds, of the returned data points. A period can be as short as one minute (60 seconds) and must be a multiple of 60. The default value is 60.
If the StartTime parameter specifies a time stamp that is greater than 15 days ago, you must specify the period as follows or no data points in that time range is returned:
Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
:type Statistics: list
:param Statistics: The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistic .
(string) --
:type ExtendedStatistics: list
:param ExtendedStatistics: The percentile statistics. Specify values between p0.0 and p100.
(string) --
:type Unit: string
:param Unit: The unit for a given metric. Metrics may be reported in multiple units. Not supplying a unit results in all units being returned. If the metric only ever reports one unit, specifying a unit has no effect.
:rtype: dict
:return: {
'Label': 'string',
'Datapoints': [
{
'Timestamp': datetime(2015, 1, 1),
'SampleCount': 123.0,
'Average': 123.0,
'Sum': 123.0,
'Minimum': 123.0,
'Maximum': 123.0,
'Unit': 'Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None',
'ExtendedStatistics': {
'string': 123.0
}
},
]
}
:returns:
The SampleCount of the statistic set is 1
The Min and the Max of the statistic set are equal
"""
pass | Gets statistics for the specified metric.
Amazon CloudWatch retains metric data as follows:
Note that CloudWatch started retaining 5-minute and 1-hour metric data as of 9 July 2016.
The maximum number of data points returned from a single call is 1,440. If you request more than 1,440 data points, Amazon CloudWatch returns an error. To reduce the number of data points, you can narrow the specified time range and make multiple requests across adjacent time ranges, or you can increase the specified period. A period can be as short as one minute (60 seconds). Note that data points are not returned in chronological order.
Amazon CloudWatch aggregates data points based on the length of the period that you specify. For example, if you request statistics with a one-hour period, Amazon CloudWatch aggregates all data points with time stamps that fall within each one-hour period. Therefore, the number of values aggregated by CloudWatch is larger than the number of data points returned.
CloudWatch needs raw data points to calculate percentile statistics. If you publish data using a statistic set instead, you cannot retrieve percentile statistics for this data unless one of the following conditions is true:
For a list of metrics and dimensions supported by AWS services, see the Amazon CloudWatch Metrics and Dimensions Reference in the Amazon CloudWatch User Guide .
See also: AWS API Documentation
:example: response = client.get_metric_statistics(
Namespace='string',
MetricName='string',
Dimensions=[
{
'Name': 'string',
'Value': 'string'
},
],
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
Period=123,
Statistics=[
'SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
],
ExtendedStatistics=[
'string',
],
Unit='Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None'
)
:type Namespace: string
:param Namespace: [REQUIRED]
The namespace of the metric, with or without spaces.
:type MetricName: string
:param MetricName: [REQUIRED]
The name of the metric, with or without spaces.
:type Dimensions: list
:param Dimensions: The dimensions. If the metric contains multiple dimensions, you must include a value for each dimension. CloudWatch treats each unique combination of dimensions as a separate metric. You can't retrieve statistics using combinations of dimensions that were not specially published. You must specify the same dimensions that were used when the metrics were created. For an example, see Dimension Combinations in the Amazon CloudWatch User Guide . For more information on specifying dimensions, see Publishing Metrics in the Amazon CloudWatch User Guide .
(dict) --Expands the identity of a metric.
Name (string) -- [REQUIRED]The name of the dimension.
Value (string) -- [REQUIRED]The value representing the dimension measurement.
:type StartTime: datetime
:param StartTime: [REQUIRED]
The time stamp that determines the first data point to return. Note that start times are evaluated relative to the time that CloudWatch receives the request.
The value specified is inclusive; results include data points with the specified time stamp. The time stamp must be in ISO 8601 UTC format (for example, 2016-10-03T23:00:00Z).
CloudWatch rounds the specified time stamp as follows:
Start time less than 15 days ago - Round down to the nearest whole minute. For example, 12:32:34 is rounded down to 12:32:00.
Start time between 15 and 63 days ago - Round down to the nearest 5-minute clock interval. For example, 12:32:34 is rounded down to 12:30:00.
Start time greater than 63 days ago - Round down to the nearest 1-hour clock interval. For example, 12:32:34 is rounded down to 12:00:00.
:type EndTime: datetime
:param EndTime: [REQUIRED]
The time stamp that determines the last data point to return.
The value specified is exclusive; results will include data points up to the specified time stamp. The time stamp must be in ISO 8601 UTC format (for example, 2016-10-10T23:00:00Z).
:type Period: integer
:param Period: [REQUIRED]
The granularity, in seconds, of the returned data points. A period can be as short as one minute (60 seconds) and must be a multiple of 60. The default value is 60.
If the StartTime parameter specifies a time stamp that is greater than 15 days ago, you must specify the period as follows or no data points in that time range is returned:
Start time between 15 and 63 days ago - Use a multiple of 300 seconds (5 minutes).
Start time greater than 63 days ago - Use a multiple of 3600 seconds (1 hour).
:type Statistics: list
:param Statistics: The metric statistics, other than percentile. For percentile statistics, use ExtendedStatistic .
(string) --
:type ExtendedStatistics: list
:param ExtendedStatistics: The percentile statistics. Specify values between p0.0 and p100.
(string) --
:type Unit: string
:param Unit: The unit for a given metric. Metrics may be reported in multiple units. Not supplying a unit results in all units being returned. If the metric only ever reports one unit, specifying a unit has no effect.
:rtype: dict
:return: {
'Label': 'string',
'Datapoints': [
{
'Timestamp': datetime(2015, 1, 1),
'SampleCount': 123.0,
'Average': 123.0,
'Sum': 123.0,
'Minimum': 123.0,
'Maximum': 123.0,
'Unit': 'Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None',
'ExtendedStatistics': {
'string': 123.0
}
},
]
}
:returns:
The SampleCount of the statistic set is 1
The Min and the Max of the statistic set are equal | entailment |
def put_metric_alarm(AlarmName=None, AlarmDescription=None, ActionsEnabled=None, OKActions=None, AlarmActions=None, InsufficientDataActions=None, MetricName=None, Namespace=None, Statistic=None, ExtendedStatistic=None, Dimensions=None, Period=None, Unit=None, EvaluationPeriods=None, Threshold=None, ComparisonOperator=None, TreatMissingData=None, EvaluateLowSampleCountPercentile=None):
"""
Creates or updates an alarm and associates it with the specified metric. Optionally, this operation can associate one or more Amazon SNS resources with the alarm.
When this operation creates an alarm, the alarm state is immediately set to INSUFFICIENT_DATA . The alarm is evaluated and its state is set appropriately. Any actions associated with the state are then executed.
When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.
If you are an AWS Identity and Access Management (IAM) user, you must have Amazon EC2 permissions for some operations:
If you have read/write permissions for Amazon CloudWatch but not for Amazon EC2, you can still create an alarm, but the stop or terminate actions won't be performed. However, if you are later granted the required permissions, the alarm actions that you created earlier will be performed.
If you are using an IAM role (for example, an Amazon EC2 instance profile), you cannot stop or terminate the instance using alarm actions. However, you can still see the alarm state and perform any other actions such as Amazon SNS notifications or Auto Scaling policies.
If you are using temporary security credentials granted using the AWS Security Token Service (AWS STS), you cannot stop or terminate an Amazon EC2 instance using alarm actions.
Note that you must create at least one stop, terminate, or reboot alarm using the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role. After this IAM role is created, you can create stop, terminate, or reboot alarms using a command-line interface or an API.
See also: AWS API Documentation
:example: response = client.put_metric_alarm(
AlarmName='string',
AlarmDescription='string',
ActionsEnabled=True|False,
OKActions=[
'string',
],
AlarmActions=[
'string',
],
InsufficientDataActions=[
'string',
],
MetricName='string',
Namespace='string',
Statistic='SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
ExtendedStatistic='string',
Dimensions=[
{
'Name': 'string',
'Value': 'string'
},
],
Period=123,
Unit='Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None',
EvaluationPeriods=123,
Threshold=123.0,
ComparisonOperator='GreaterThanOrEqualToThreshold'|'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold',
TreatMissingData='string',
EvaluateLowSampleCountPercentile='string'
)
:type AlarmName: string
:param AlarmName: [REQUIRED]
The name for the alarm. This name must be unique within the AWS account.
:type AlarmDescription: string
:param AlarmDescription: The description for the alarm.
:type ActionsEnabled: boolean
:param ActionsEnabled: Indicates whether actions should be executed during any changes to the alarm state.
:type OKActions: list
:param OKActions: The actions to execute when this alarm transitions to an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
:type AlarmActions: list
:param AlarmActions: The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
:type InsufficientDataActions: list
:param InsufficientDataActions: The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
:type MetricName: string
:param MetricName: [REQUIRED]
The name for the metric associated with the alarm.
:type Namespace: string
:param Namespace: [REQUIRED]
The namespace for the metric associated with the alarm.
:type Statistic: string
:param Statistic: The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use ExtendedStatistic .
:type ExtendedStatistic: string
:param ExtendedStatistic: The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
:type Dimensions: list
:param Dimensions: The dimensions for the metric associated with the alarm.
(dict) --Expands the identity of a metric.
Name (string) -- [REQUIRED]The name of the dimension.
Value (string) -- [REQUIRED]The value representing the dimension measurement.
:type Period: integer
:param Period: [REQUIRED]
The period, in seconds, over which the specified statistic is applied.
:type Unit: string
:param Unit: The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can also specify a unit when you create a custom metric. Units help provide conceptual meaning to your data. Metric data points that specify a unit of measure, such as Percent, are aggregated separately.
If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the Amazon CloudWatch alarm can get stuck in the INSUFFICIENT DATA state.
:type EvaluationPeriods: integer
:param EvaluationPeriods: [REQUIRED]
The number of periods over which data is compared to the specified threshold.
:type Threshold: float
:param Threshold: [REQUIRED]
The value against which the specified statistic is compared.
:type ComparisonOperator: string
:param ComparisonOperator: [REQUIRED]
The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.
:type TreatMissingData: string
:param TreatMissingData: Sets how this alarm is to handle missing data points. If TreatMissingData is omitted, the default behavior of missing is used. For more information, see Configuring How CloudWatch Alarms Treats Missing Data .
Valid Values: breaching | notBreaching | ignore | missing
:type EvaluateLowSampleCountPercentile: string
:param EvaluateLowSampleCountPercentile: Used only for alarms based on percentiles. If you specify ignore , the alarm state will not change during periods with too few data points to be statistically significant. If you specify evaluate or omit this parameter, the alarm will always be evaluated and possibly change state no matter how many data points are available. For more information, see Percentile-Based CloudWatch Alarms and Low Data Samples .
Valid Values: evaluate | ignore
:returns:
AlarmName (string) -- [REQUIRED]
The name for the alarm. This name must be unique within the AWS account.
AlarmDescription (string) -- The description for the alarm.
ActionsEnabled (boolean) -- Indicates whether actions should be executed during any changes to the alarm state.
OKActions (list) -- The actions to execute when this alarm transitions to an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
AlarmActions (list) -- The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
InsufficientDataActions (list) -- The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
MetricName (string) -- [REQUIRED]
The name for the metric associated with the alarm.
Namespace (string) -- [REQUIRED]
The namespace for the metric associated with the alarm.
Statistic (string) -- The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use ExtendedStatistic .
ExtendedStatistic (string) -- The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
Dimensions (list) -- The dimensions for the metric associated with the alarm.
(dict) --Expands the identity of a metric.
Name (string) -- [REQUIRED]The name of the dimension.
Value (string) -- [REQUIRED]The value representing the dimension measurement.
Period (integer) -- [REQUIRED]
The period, in seconds, over which the specified statistic is applied.
Unit (string) -- The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can also specify a unit when you create a custom metric. Units help provide conceptual meaning to your data. Metric data points that specify a unit of measure, such as Percent, are aggregated separately.
If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the Amazon CloudWatch alarm can get stuck in the INSUFFICIENT DATA state.
EvaluationPeriods (integer) -- [REQUIRED]
The number of periods over which data is compared to the specified threshold.
Threshold (float) -- [REQUIRED]
The value against which the specified statistic is compared.
ComparisonOperator (string) -- [REQUIRED]
The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.
TreatMissingData (string) -- Sets how this alarm is to handle missing data points. If TreatMissingData is omitted, the default behavior of missing is used. For more information, see Configuring How CloudWatch Alarms Treats Missing Data .
Valid Values: breaching | notBreaching | ignore | missing
EvaluateLowSampleCountPercentile (string) -- Used only for alarms based on percentiles. If you specify ignore , the alarm state will not change during periods with too few data points to be statistically significant. If you specify evaluate or omit this parameter, the alarm will always be evaluated and possibly change state no matter how many data points are available. For more information, see Percentile-Based CloudWatch Alarms and Low Data Samples .
Valid Values: evaluate | ignore
"""
pass | Creates or updates an alarm and associates it with the specified metric. Optionally, this operation can associate one or more Amazon SNS resources with the alarm.
When this operation creates an alarm, the alarm state is immediately set to INSUFFICIENT_DATA . The alarm is evaluated and its state is set appropriately. Any actions associated with the state are then executed.
When you update an existing alarm, its state is left unchanged, but the update completely overwrites the previous configuration of the alarm.
If you are an AWS Identity and Access Management (IAM) user, you must have Amazon EC2 permissions for some operations:
If you have read/write permissions for Amazon CloudWatch but not for Amazon EC2, you can still create an alarm, but the stop or terminate actions won't be performed. However, if you are later granted the required permissions, the alarm actions that you created earlier will be performed.
If you are using an IAM role (for example, an Amazon EC2 instance profile), you cannot stop or terminate the instance using alarm actions. However, you can still see the alarm state and perform any other actions such as Amazon SNS notifications or Auto Scaling policies.
If you are using temporary security credentials granted using the AWS Security Token Service (AWS STS), you cannot stop or terminate an Amazon EC2 instance using alarm actions.
Note that you must create at least one stop, terminate, or reboot alarm using the Amazon EC2 or CloudWatch console to create the EC2ActionsAccess IAM role. After this IAM role is created, you can create stop, terminate, or reboot alarms using a command-line interface or an API.
See also: AWS API Documentation
:example: response = client.put_metric_alarm(
AlarmName='string',
AlarmDescription='string',
ActionsEnabled=True|False,
OKActions=[
'string',
],
AlarmActions=[
'string',
],
InsufficientDataActions=[
'string',
],
MetricName='string',
Namespace='string',
Statistic='SampleCount'|'Average'|'Sum'|'Minimum'|'Maximum',
ExtendedStatistic='string',
Dimensions=[
{
'Name': 'string',
'Value': 'string'
},
],
Period=123,
Unit='Seconds'|'Microseconds'|'Milliseconds'|'Bytes'|'Kilobytes'|'Megabytes'|'Gigabytes'|'Terabytes'|'Bits'|'Kilobits'|'Megabits'|'Gigabits'|'Terabits'|'Percent'|'Count'|'Bytes/Second'|'Kilobytes/Second'|'Megabytes/Second'|'Gigabytes/Second'|'Terabytes/Second'|'Bits/Second'|'Kilobits/Second'|'Megabits/Second'|'Gigabits/Second'|'Terabits/Second'|'Count/Second'|'None',
EvaluationPeriods=123,
Threshold=123.0,
ComparisonOperator='GreaterThanOrEqualToThreshold'|'GreaterThanThreshold'|'LessThanThreshold'|'LessThanOrEqualToThreshold',
TreatMissingData='string',
EvaluateLowSampleCountPercentile='string'
)
:type AlarmName: string
:param AlarmName: [REQUIRED]
The name for the alarm. This name must be unique within the AWS account.
:type AlarmDescription: string
:param AlarmDescription: The description for the alarm.
:type ActionsEnabled: boolean
:param ActionsEnabled: Indicates whether actions should be executed during any changes to the alarm state.
:type OKActions: list
:param OKActions: The actions to execute when this alarm transitions to an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
:type AlarmActions: list
:param AlarmActions: The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
:type InsufficientDataActions: list
:param InsufficientDataActions: The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
:type MetricName: string
:param MetricName: [REQUIRED]
The name for the metric associated with the alarm.
:type Namespace: string
:param Namespace: [REQUIRED]
The namespace for the metric associated with the alarm.
:type Statistic: string
:param Statistic: The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use ExtendedStatistic .
:type ExtendedStatistic: string
:param ExtendedStatistic: The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
:type Dimensions: list
:param Dimensions: The dimensions for the metric associated with the alarm.
(dict) --Expands the identity of a metric.
Name (string) -- [REQUIRED]The name of the dimension.
Value (string) -- [REQUIRED]The value representing the dimension measurement.
:type Period: integer
:param Period: [REQUIRED]
The period, in seconds, over which the specified statistic is applied.
:type Unit: string
:param Unit: The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can also specify a unit when you create a custom metric. Units help provide conceptual meaning to your data. Metric data points that specify a unit of measure, such as Percent, are aggregated separately.
If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the Amazon CloudWatch alarm can get stuck in the INSUFFICIENT DATA state.
:type EvaluationPeriods: integer
:param EvaluationPeriods: [REQUIRED]
The number of periods over which data is compared to the specified threshold.
:type Threshold: float
:param Threshold: [REQUIRED]
The value against which the specified statistic is compared.
:type ComparisonOperator: string
:param ComparisonOperator: [REQUIRED]
The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.
:type TreatMissingData: string
:param TreatMissingData: Sets how this alarm is to handle missing data points. If TreatMissingData is omitted, the default behavior of missing is used. For more information, see Configuring How CloudWatch Alarms Treats Missing Data .
Valid Values: breaching | notBreaching | ignore | missing
:type EvaluateLowSampleCountPercentile: string
:param EvaluateLowSampleCountPercentile: Used only for alarms based on percentiles. If you specify ignore , the alarm state will not change during periods with too few data points to be statistically significant. If you specify evaluate or omit this parameter, the alarm will always be evaluated and possibly change state no matter how many data points are available. For more information, see Percentile-Based CloudWatch Alarms and Low Data Samples .
Valid Values: evaluate | ignore
:returns:
AlarmName (string) -- [REQUIRED]
The name for the alarm. This name must be unique within the AWS account.
AlarmDescription (string) -- The description for the alarm.
ActionsEnabled (boolean) -- Indicates whether actions should be executed during any changes to the alarm state.
OKActions (list) -- The actions to execute when this alarm transitions to an OK state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
AlarmActions (list) -- The actions to execute when this alarm transitions to the ALARM state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
InsufficientDataActions (list) -- The actions to execute when this alarm transitions to the INSUFFICIENT_DATA state from any other state. Each action is specified as an Amazon Resource Name (ARN).
Valid Values: arn:aws:automate:region :ec2:stop | arn:aws:automate:region :ec2:terminate | arn:aws:automate:region :ec2:recover
Valid Values (for use with IAM roles): arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Stop/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Terminate/1.0 | arn:aws:swf:us-east-1:{customer-account }:action/actions/AWS_EC2.InstanceId.Reboot/1.0
(string) --
MetricName (string) -- [REQUIRED]
The name for the metric associated with the alarm.
Namespace (string) -- [REQUIRED]
The namespace for the metric associated with the alarm.
Statistic (string) -- The statistic for the metric associated with the alarm, other than percentile. For percentile statistics, use ExtendedStatistic .
ExtendedStatistic (string) -- The percentile statistic for the metric associated with the alarm. Specify a value between p0.0 and p100.
Dimensions (list) -- The dimensions for the metric associated with the alarm.
(dict) --Expands the identity of a metric.
Name (string) -- [REQUIRED]The name of the dimension.
Value (string) -- [REQUIRED]The value representing the dimension measurement.
Period (integer) -- [REQUIRED]
The period, in seconds, over which the specified statistic is applied.
Unit (string) -- The unit of measure for the statistic. For example, the units for the Amazon EC2 NetworkIn metric are Bytes because NetworkIn tracks the number of bytes that an instance receives on all network interfaces. You can also specify a unit when you create a custom metric. Units help provide conceptual meaning to your data. Metric data points that specify a unit of measure, such as Percent, are aggregated separately.
If you specify a unit, you must use a unit that is appropriate for the metric. Otherwise, the Amazon CloudWatch alarm can get stuck in the INSUFFICIENT DATA state.
EvaluationPeriods (integer) -- [REQUIRED]
The number of periods over which data is compared to the specified threshold.
Threshold (float) -- [REQUIRED]
The value against which the specified statistic is compared.
ComparisonOperator (string) -- [REQUIRED]
The arithmetic operation to use when comparing the specified statistic and threshold. The specified statistic value is used as the first operand.
TreatMissingData (string) -- Sets how this alarm is to handle missing data points. If TreatMissingData is omitted, the default behavior of missing is used. For more information, see Configuring How CloudWatch Alarms Treats Missing Data .
Valid Values: breaching | notBreaching | ignore | missing
EvaluateLowSampleCountPercentile (string) -- Used only for alarms based on percentiles. If you specify ignore , the alarm state will not change during periods with too few data points to be statistically significant. If you specify evaluate or omit this parameter, the alarm will always be evaluated and possibly change state no matter how many data points are available. For more information, see Percentile-Based CloudWatch Alarms and Low Data Samples .
Valid Values: evaluate | ignore | entailment |
def create_auto_scaling_group(AutoScalingGroupName=None, LaunchConfigurationName=None, InstanceId=None, MinSize=None, MaxSize=None, DesiredCapacity=None, DefaultCooldown=None, AvailabilityZones=None, LoadBalancerNames=None, TargetGroupARNs=None, HealthCheckType=None, HealthCheckGracePeriod=None, PlacementGroup=None, VPCZoneIdentifier=None, TerminationPolicies=None, NewInstancesProtectedFromScaleIn=None, Tags=None):
"""
Creates an Auto Scaling group with the specified name and attributes.
If you exceed your maximum limit of Auto Scaling groups, which by default is 20 per region, the call fails. For information about viewing and updating this limit, see DescribeAccountLimits .
For more information, see Auto Scaling Groups in the Auto Scaling User Guide .
See also: AWS API Documentation
Examples
This example creates an Auto Scaling group.
Expected Output:
This example creates an Auto Scaling group and attaches the specified Classic Load Balancer.
Expected Output:
This example creates an Auto Scaling group and attaches the specified target group.
Expected Output:
:example: response = client.create_auto_scaling_group(
AutoScalingGroupName='string',
LaunchConfigurationName='string',
InstanceId='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123,
DefaultCooldown=123,
AvailabilityZones=[
'string',
],
LoadBalancerNames=[
'string',
],
TargetGroupARNs=[
'string',
],
HealthCheckType='string',
HealthCheckGracePeriod=123,
PlacementGroup='string',
VPCZoneIdentifier='string',
TerminationPolicies=[
'string',
],
NewInstancesProtectedFromScaleIn=True|False,
Tags=[
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the group. This name must be unique within the scope of your AWS account.
:type LaunchConfigurationName: string
:param LaunchConfigurationName: The name of the launch configuration. Alternatively, specify an EC2 instance instead of a launch configuration.
:type InstanceId: string
:param InstanceId: The ID of the instance used to create a launch configuration for the group. Alternatively, specify a launch configuration instead of an EC2 instance.
When you specify an ID of an instance, Auto Scaling creates a new launch configuration and associates it with the group. This launch configuration derives its attributes from the specified instance, with the exception of the block device mapping.
For more information, see Create an Auto Scaling Group Using an EC2 Instance in the Auto Scaling User Guide .
:type MinSize: integer
:param MinSize: [REQUIRED]
The minimum size of the group.
:type MaxSize: integer
:param MaxSize: [REQUIRED]
The maximum size of the group.
:type DesiredCapacity: integer
:param DesiredCapacity: The number of EC2 instances that should be running in the group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity, the default is the minimum size of the group.
:type DefaultCooldown: integer
:param DefaultCooldown: The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default is 300.
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide .
:type AvailabilityZones: list
:param AvailabilityZones: One or more Availability Zones for the group. This parameter is optional if you specify one or more subnets.
(string) --
:type LoadBalancerNames: list
:param LoadBalancerNames: One or more Classic Load Balancers. To specify an Application Load Balancer, use TargetGroupARNs instead.
For more information, see Using a Load Balancer With an Auto Scaling Group in the Auto Scaling User Guide .
(string) --
:type TargetGroupARNs: list
:param TargetGroupARNs: The Amazon Resource Names (ARN) of the target groups.
(string) --
:type HealthCheckType: string
:param HealthCheckType: The service to use for the health checks. The valid values are EC2 and ELB .
By default, health checks use Amazon EC2 instance status checks to determine the health of an instance. For more information, see Health Checks in the Auto Scaling User Guide .
:type HealthCheckGracePeriod: integer
:param HealthCheckGracePeriod: The amount of time, in seconds, that Auto Scaling waits before checking the health status of an EC2 instance that has come into service. During this time, any health check failures for the instance are ignored. The default is 0.
This parameter is required if you are adding an ELB health check.
For more information, see Health Checks in the Auto Scaling User Guide .
:type PlacementGroup: string
:param PlacementGroup: The name of the placement group into which you'll launch your instances, if any. For more information, see Placement Groups in the Amazon Elastic Compute Cloud User Guide .
:type VPCZoneIdentifier: string
:param VPCZoneIdentifier: A comma-separated list of subnet identifiers for your virtual private cloud (VPC).
If you specify subnets and Availability Zones with this call, ensure that the subnets' Availability Zones match the Availability Zones specified.
For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
:type TerminationPolicies: list
:param TerminationPolicies: One or more termination policies used to select the instance to terminate. These policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Auto Scaling User Guide .
(string) --
:type NewInstancesProtectedFromScaleIn: boolean
:param NewInstancesProtectedFromScaleIn: Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in.
:type Tags: list
:param Tags: One or more tags.
For more information, see Tagging Auto Scaling Groups and Instances in the Auto Scaling User Guide .
(dict) --Describes a tag for an Auto Scaling group.
ResourceId (string) --The name of the group.
ResourceType (string) --The type of resource. The only supported value is auto-scaling-group .
Key (string) -- [REQUIRED]The tag key.
Value (string) --The tag value.
PropagateAtLaunch (boolean) --Determines whether the tag is added to new instances as they are launched in the group.
:return: response = client.create_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
LaunchConfigurationName='my-launch-config',
MaxSize=3,
MinSize=1,
VPCZoneIdentifier='subnet-4176792c',
)
print(response)
"""
pass | Creates an Auto Scaling group with the specified name and attributes.
If you exceed your maximum limit of Auto Scaling groups, which by default is 20 per region, the call fails. For information about viewing and updating this limit, see DescribeAccountLimits .
For more information, see Auto Scaling Groups in the Auto Scaling User Guide .
See also: AWS API Documentation
Examples
This example creates an Auto Scaling group.
Expected Output:
This example creates an Auto Scaling group and attaches the specified Classic Load Balancer.
Expected Output:
This example creates an Auto Scaling group and attaches the specified target group.
Expected Output:
:example: response = client.create_auto_scaling_group(
AutoScalingGroupName='string',
LaunchConfigurationName='string',
InstanceId='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123,
DefaultCooldown=123,
AvailabilityZones=[
'string',
],
LoadBalancerNames=[
'string',
],
TargetGroupARNs=[
'string',
],
HealthCheckType='string',
HealthCheckGracePeriod=123,
PlacementGroup='string',
VPCZoneIdentifier='string',
TerminationPolicies=[
'string',
],
NewInstancesProtectedFromScaleIn=True|False,
Tags=[
{
'ResourceId': 'string',
'ResourceType': 'string',
'Key': 'string',
'Value': 'string',
'PropagateAtLaunch': True|False
},
]
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the group. This name must be unique within the scope of your AWS account.
:type LaunchConfigurationName: string
:param LaunchConfigurationName: The name of the launch configuration. Alternatively, specify an EC2 instance instead of a launch configuration.
:type InstanceId: string
:param InstanceId: The ID of the instance used to create a launch configuration for the group. Alternatively, specify a launch configuration instead of an EC2 instance.
When you specify an ID of an instance, Auto Scaling creates a new launch configuration and associates it with the group. This launch configuration derives its attributes from the specified instance, with the exception of the block device mapping.
For more information, see Create an Auto Scaling Group Using an EC2 Instance in the Auto Scaling User Guide .
:type MinSize: integer
:param MinSize: [REQUIRED]
The minimum size of the group.
:type MaxSize: integer
:param MaxSize: [REQUIRED]
The maximum size of the group.
:type DesiredCapacity: integer
:param DesiredCapacity: The number of EC2 instances that should be running in the group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity, the default is the minimum size of the group.
:type DefaultCooldown: integer
:param DefaultCooldown: The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default is 300.
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide .
:type AvailabilityZones: list
:param AvailabilityZones: One or more Availability Zones for the group. This parameter is optional if you specify one or more subnets.
(string) --
:type LoadBalancerNames: list
:param LoadBalancerNames: One or more Classic Load Balancers. To specify an Application Load Balancer, use TargetGroupARNs instead.
For more information, see Using a Load Balancer With an Auto Scaling Group in the Auto Scaling User Guide .
(string) --
:type TargetGroupARNs: list
:param TargetGroupARNs: The Amazon Resource Names (ARN) of the target groups.
(string) --
:type HealthCheckType: string
:param HealthCheckType: The service to use for the health checks. The valid values are EC2 and ELB .
By default, health checks use Amazon EC2 instance status checks to determine the health of an instance. For more information, see Health Checks in the Auto Scaling User Guide .
:type HealthCheckGracePeriod: integer
:param HealthCheckGracePeriod: The amount of time, in seconds, that Auto Scaling waits before checking the health status of an EC2 instance that has come into service. During this time, any health check failures for the instance are ignored. The default is 0.
This parameter is required if you are adding an ELB health check.
For more information, see Health Checks in the Auto Scaling User Guide .
:type PlacementGroup: string
:param PlacementGroup: The name of the placement group into which you'll launch your instances, if any. For more information, see Placement Groups in the Amazon Elastic Compute Cloud User Guide .
:type VPCZoneIdentifier: string
:param VPCZoneIdentifier: A comma-separated list of subnet identifiers for your virtual private cloud (VPC).
If you specify subnets and Availability Zones with this call, ensure that the subnets' Availability Zones match the Availability Zones specified.
For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
:type TerminationPolicies: list
:param TerminationPolicies: One or more termination policies used to select the instance to terminate. These policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Auto Scaling User Guide .
(string) --
:type NewInstancesProtectedFromScaleIn: boolean
:param NewInstancesProtectedFromScaleIn: Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in.
:type Tags: list
:param Tags: One or more tags.
For more information, see Tagging Auto Scaling Groups and Instances in the Auto Scaling User Guide .
(dict) --Describes a tag for an Auto Scaling group.
ResourceId (string) --The name of the group.
ResourceType (string) --The type of resource. The only supported value is auto-scaling-group .
Key (string) -- [REQUIRED]The tag key.
Value (string) --The tag value.
PropagateAtLaunch (boolean) --Determines whether the tag is added to new instances as they are launched in the group.
:return: response = client.create_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
LaunchConfigurationName='my-launch-config',
MaxSize=3,
MinSize=1,
VPCZoneIdentifier='subnet-4176792c',
)
print(response) | entailment |
def create_launch_configuration(LaunchConfigurationName=None, ImageId=None, KeyName=None, SecurityGroups=None, ClassicLinkVPCId=None, ClassicLinkVPCSecurityGroups=None, UserData=None, InstanceId=None, InstanceType=None, KernelId=None, RamdiskId=None, BlockDeviceMappings=None, InstanceMonitoring=None, SpotPrice=None, IamInstanceProfile=None, EbsOptimized=None, AssociatePublicIpAddress=None, PlacementTenancy=None):
"""
Creates a launch configuration.
If you exceed your maximum limit of launch configurations, which by default is 100 per region, the call fails. For information about viewing and updating this limit, see DescribeAccountLimits .
For more information, see Launch Configurations in the Auto Scaling User Guide .
See also: AWS API Documentation
Examples
This example creates a launch configuration.
Expected Output:
:example: response = client.create_launch_configuration(
LaunchConfigurationName='string',
ImageId='string',
KeyName='string',
SecurityGroups=[
'string',
],
ClassicLinkVPCId='string',
ClassicLinkVPCSecurityGroups=[
'string',
],
UserData='string',
InstanceId='string',
InstanceType='string',
KernelId='string',
RamdiskId='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'VolumeType': 'string',
'DeleteOnTermination': True|False,
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': True|False
},
],
InstanceMonitoring={
'Enabled': True|False
},
SpotPrice='string',
IamInstanceProfile='string',
EbsOptimized=True|False,
AssociatePublicIpAddress=True|False,
PlacementTenancy='string'
)
:type LaunchConfigurationName: string
:param LaunchConfigurationName: [REQUIRED]
The name of the launch configuration. This name must be unique within the scope of your AWS account.
:type ImageId: string
:param ImageId: The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances.
If you do not specify InstanceId , you must specify ImageId .
For more information, see Finding an AMI in the Amazon Elastic Compute Cloud User Guide .
:type KeyName: string
:param KeyName: The name of the key pair. For more information, see Amazon EC2 Key Pairs in the Amazon Elastic Compute Cloud User Guide .
:type SecurityGroups: list
:param SecurityGroups: One or more security groups with which to associate the instances.
If your instances are launched in EC2-Classic, you can either specify security group names or the security group IDs. For more information about security groups for EC2-Classic, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide .
If your instances are launched into a VPC, specify security group IDs. For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
(string) --
:type ClassicLinkVPCId: string
:param ClassicLinkVPCId: The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. This parameter is supported only if you are launching EC2-Classic instances. For more information, see ClassicLink in the Amazon Elastic Compute Cloud User Guide .
:type ClassicLinkVPCSecurityGroups: list
:param ClassicLinkVPCSecurityGroups: The IDs of one or more security groups for the specified ClassicLink-enabled VPC. This parameter is required if you specify a ClassicLink-enabled VPC, and is not supported otherwise. For more information, see ClassicLink in the Amazon Elastic Compute Cloud User Guide .
(string) --
:type UserData: string
:param UserData: The user data to make available to the launched EC2 instances. For more information, see Instance Metadata and User Data in the Amazon Elastic Compute Cloud User Guide .
This value will be base64 encoded automatically. Do not base64 encode this value prior to performing the operation.
:type InstanceId: string
:param InstanceId: The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, with the exception of the block device mapping.
If you do not specify InstanceId , you must specify both ImageId and InstanceType .
To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request.
For more information, see Create a Launch Configuration Using an EC2 Instance in the Auto Scaling User Guide .
:type InstanceType: string
:param InstanceType: The instance type of the EC2 instance.
If you do not specify InstanceId , you must specify InstanceType .
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
:type KernelId: string
:param KernelId: The ID of the kernel associated with the AMI.
:type RamdiskId: string
:param RamdiskId: The ID of the RAM disk associated with the AMI.
:type BlockDeviceMappings: list
:param BlockDeviceMappings: One or more mappings that specify how block devices are exposed to the instance. For more information, see Block Device Mapping in the Amazon Elastic Compute Cloud User Guide .
(dict) --Describes a block device mapping.
VirtualName (string) --The name of the virtual device (for example, ephemeral0 ).
DeviceName (string) -- [REQUIRED]The device name exposed to the EC2 instance (for example, /dev/sdh or xvdh ).
Ebs (dict) --The information about the Amazon EBS volume.
SnapshotId (string) --The ID of the snapshot.
VolumeSize (integer) --The volume size, in GiB. For standard volumes, specify a value from 1 to 1,024. For io1 volumes, specify a value from 4 to 16,384. For gp2 volumes, specify a value from 1 to 16,384. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.
Default: If you create a volume from a snapshot and you don't specify a volume size, the default is the snapshot size.
VolumeType (string) --The volume type. For more information, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .
Valid values: standard | io1 | gp2
Default: standard
DeleteOnTermination (boolean) --Indicates whether the volume is deleted on instance termination.
Default: true
Iops (integer) --The number of I/O operations per second (IOPS) to provision for the volume.
Constraint: Required when the volume type is io1 .
Encrypted (boolean) --Indicates whether the volume should be encrypted. Encrypted EBS volumes must be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are automatically encrypted. There is no way to create an encrypted volume from an unencrypted snapshot or an unencrypted volume from an encrypted snapshot. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
NoDevice (boolean) --Suppresses a device mapping.
If this parameter is true for the root device, the instance might fail the EC2 health check. Auto Scaling launches a replacement instance if the instance fails the health check.
:type InstanceMonitoring: dict
:param InstanceMonitoring: Enables detailed monitoring (true ) or basic monitoring (false ) for the Auto Scaling instances. The default is true .
Enabled (boolean) --If true , detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
:type SpotPrice: string
:param SpotPrice: The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot market price. For more information, see Launching Spot Instances in Your Auto Scaling Group in the Auto Scaling User Guide .
:type IamInstanceProfile: string
:param IamInstanceProfile: The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.
EC2 instances launched with an IAM role will automatically have AWS security credentials available. You can use IAM roles with Auto Scaling to automatically enable applications running on your EC2 instances to securely access other AWS resources. For more information, see Launch Auto Scaling Instances with an IAM Role in the Auto Scaling User Guide .
:type EbsOptimized: boolean
:param EbsOptimized: Indicates whether the instance is optimized for Amazon EBS I/O. By default, the instance is not optimized for EBS I/O. The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional usage charges apply. For more information, see Amazon EBS-Optimized Instances in the Amazon Elastic Compute Cloud User Guide .
:type AssociatePublicIpAddress: boolean
:param AssociatePublicIpAddress: Used for groups that launch instances into a virtual private cloud (VPC). Specifies whether to assign a public IP address to each instance. For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
If you specify this parameter, be sure to specify at least one subnet when you create your group.
Default: If the instance is launched into a default subnet, the default is true . If the instance is launched into a nondefault subnet, the default is false . For more information, see Supported Platforms in the Amazon Elastic Compute Cloud User Guide .
:type PlacementTenancy: string
:param PlacementTenancy: The tenancy of the instance. An instance with a tenancy of dedicated runs on single-tenant hardware and can only be launched into a VPC.
You must set the value of this parameter to dedicated if want to launch Dedicated Instances into a shared tenancy VPC (VPC with instance placement tenancy attribute set to default ).
If you specify this parameter, be sure to specify at least one subnet when you create your group.
For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
Valid values: default | dedicated
:return: response = client.create_launch_configuration(
IamInstanceProfile='my-iam-role',
ImageId='ami-12345678',
InstanceType='m3.medium',
LaunchConfigurationName='my-launch-config',
SecurityGroups=[
'sg-eb2af88e',
],
)
print(response)
"""
pass | Creates a launch configuration.
If you exceed your maximum limit of launch configurations, which by default is 100 per region, the call fails. For information about viewing and updating this limit, see DescribeAccountLimits .
For more information, see Launch Configurations in the Auto Scaling User Guide .
See also: AWS API Documentation
Examples
This example creates a launch configuration.
Expected Output:
:example: response = client.create_launch_configuration(
LaunchConfigurationName='string',
ImageId='string',
KeyName='string',
SecurityGroups=[
'string',
],
ClassicLinkVPCId='string',
ClassicLinkVPCSecurityGroups=[
'string',
],
UserData='string',
InstanceId='string',
InstanceType='string',
KernelId='string',
RamdiskId='string',
BlockDeviceMappings=[
{
'VirtualName': 'string',
'DeviceName': 'string',
'Ebs': {
'SnapshotId': 'string',
'VolumeSize': 123,
'VolumeType': 'string',
'DeleteOnTermination': True|False,
'Iops': 123,
'Encrypted': True|False
},
'NoDevice': True|False
},
],
InstanceMonitoring={
'Enabled': True|False
},
SpotPrice='string',
IamInstanceProfile='string',
EbsOptimized=True|False,
AssociatePublicIpAddress=True|False,
PlacementTenancy='string'
)
:type LaunchConfigurationName: string
:param LaunchConfigurationName: [REQUIRED]
The name of the launch configuration. This name must be unique within the scope of your AWS account.
:type ImageId: string
:param ImageId: The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances.
If you do not specify InstanceId , you must specify ImageId .
For more information, see Finding an AMI in the Amazon Elastic Compute Cloud User Guide .
:type KeyName: string
:param KeyName: The name of the key pair. For more information, see Amazon EC2 Key Pairs in the Amazon Elastic Compute Cloud User Guide .
:type SecurityGroups: list
:param SecurityGroups: One or more security groups with which to associate the instances.
If your instances are launched in EC2-Classic, you can either specify security group names or the security group IDs. For more information about security groups for EC2-Classic, see Amazon EC2 Security Groups in the Amazon Elastic Compute Cloud User Guide .
If your instances are launched into a VPC, specify security group IDs. For more information, see Security Groups for Your VPC in the Amazon Virtual Private Cloud User Guide .
(string) --
:type ClassicLinkVPCId: string
:param ClassicLinkVPCId: The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. This parameter is supported only if you are launching EC2-Classic instances. For more information, see ClassicLink in the Amazon Elastic Compute Cloud User Guide .
:type ClassicLinkVPCSecurityGroups: list
:param ClassicLinkVPCSecurityGroups: The IDs of one or more security groups for the specified ClassicLink-enabled VPC. This parameter is required if you specify a ClassicLink-enabled VPC, and is not supported otherwise. For more information, see ClassicLink in the Amazon Elastic Compute Cloud User Guide .
(string) --
:type UserData: string
:param UserData: The user data to make available to the launched EC2 instances. For more information, see Instance Metadata and User Data in the Amazon Elastic Compute Cloud User Guide .
This value will be base64 encoded automatically. Do not base64 encode this value prior to performing the operation.
:type InstanceId: string
:param InstanceId: The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, with the exception of the block device mapping.
If you do not specify InstanceId , you must specify both ImageId and InstanceType .
To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request.
For more information, see Create a Launch Configuration Using an EC2 Instance in the Auto Scaling User Guide .
:type InstanceType: string
:param InstanceType: The instance type of the EC2 instance.
If you do not specify InstanceId , you must specify InstanceType .
For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.
:type KernelId: string
:param KernelId: The ID of the kernel associated with the AMI.
:type RamdiskId: string
:param RamdiskId: The ID of the RAM disk associated with the AMI.
:type BlockDeviceMappings: list
:param BlockDeviceMappings: One or more mappings that specify how block devices are exposed to the instance. For more information, see Block Device Mapping in the Amazon Elastic Compute Cloud User Guide .
(dict) --Describes a block device mapping.
VirtualName (string) --The name of the virtual device (for example, ephemeral0 ).
DeviceName (string) -- [REQUIRED]The device name exposed to the EC2 instance (for example, /dev/sdh or xvdh ).
Ebs (dict) --The information about the Amazon EBS volume.
SnapshotId (string) --The ID of the snapshot.
VolumeSize (integer) --The volume size, in GiB. For standard volumes, specify a value from 1 to 1,024. For io1 volumes, specify a value from 4 to 16,384. For gp2 volumes, specify a value from 1 to 16,384. If you specify a snapshot, the volume size must be equal to or larger than the snapshot size.
Default: If you create a volume from a snapshot and you don't specify a volume size, the default is the snapshot size.
VolumeType (string) --The volume type. For more information, see Amazon EBS Volume Types in the Amazon Elastic Compute Cloud User Guide .
Valid values: standard | io1 | gp2
Default: standard
DeleteOnTermination (boolean) --Indicates whether the volume is deleted on instance termination.
Default: true
Iops (integer) --The number of I/O operations per second (IOPS) to provision for the volume.
Constraint: Required when the volume type is io1 .
Encrypted (boolean) --Indicates whether the volume should be encrypted. Encrypted EBS volumes must be attached to instances that support Amazon EBS encryption. Volumes that are created from encrypted snapshots are automatically encrypted. There is no way to create an encrypted volume from an unencrypted snapshot or an unencrypted volume from an encrypted snapshot. For more information, see Amazon EBS Encryption in the Amazon Elastic Compute Cloud User Guide .
NoDevice (boolean) --Suppresses a device mapping.
If this parameter is true for the root device, the instance might fail the EC2 health check. Auto Scaling launches a replacement instance if the instance fails the health check.
:type InstanceMonitoring: dict
:param InstanceMonitoring: Enables detailed monitoring (true ) or basic monitoring (false ) for the Auto Scaling instances. The default is true .
Enabled (boolean) --If true , detailed monitoring is enabled. Otherwise, basic monitoring is enabled.
:type SpotPrice: string
:param SpotPrice: The maximum hourly price to be paid for any Spot Instance launched to fulfill the request. Spot Instances are launched when the price you specify exceeds the current Spot market price. For more information, see Launching Spot Instances in Your Auto Scaling Group in the Auto Scaling User Guide .
:type IamInstanceProfile: string
:param IamInstanceProfile: The name or the Amazon Resource Name (ARN) of the instance profile associated with the IAM role for the instance.
EC2 instances launched with an IAM role will automatically have AWS security credentials available. You can use IAM roles with Auto Scaling to automatically enable applications running on your EC2 instances to securely access other AWS resources. For more information, see Launch Auto Scaling Instances with an IAM Role in the Auto Scaling User Guide .
:type EbsOptimized: boolean
:param EbsOptimized: Indicates whether the instance is optimized for Amazon EBS I/O. By default, the instance is not optimized for EBS I/O. The optimization provides dedicated throughput to Amazon EBS and an optimized configuration stack to provide optimal I/O performance. This optimization is not available with all instance types. Additional usage charges apply. For more information, see Amazon EBS-Optimized Instances in the Amazon Elastic Compute Cloud User Guide .
:type AssociatePublicIpAddress: boolean
:param AssociatePublicIpAddress: Used for groups that launch instances into a virtual private cloud (VPC). Specifies whether to assign a public IP address to each instance. For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
If you specify this parameter, be sure to specify at least one subnet when you create your group.
Default: If the instance is launched into a default subnet, the default is true . If the instance is launched into a nondefault subnet, the default is false . For more information, see Supported Platforms in the Amazon Elastic Compute Cloud User Guide .
:type PlacementTenancy: string
:param PlacementTenancy: The tenancy of the instance. An instance with a tenancy of dedicated runs on single-tenant hardware and can only be launched into a VPC.
You must set the value of this parameter to dedicated if want to launch Dedicated Instances into a shared tenancy VPC (VPC with instance placement tenancy attribute set to default ).
If you specify this parameter, be sure to specify at least one subnet when you create your group.
For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
Valid values: default | dedicated
:return: response = client.create_launch_configuration(
IamInstanceProfile='my-iam-role',
ImageId='ami-12345678',
InstanceType='m3.medium',
LaunchConfigurationName='my-launch-config',
SecurityGroups=[
'sg-eb2af88e',
],
)
print(response) | entailment |
def put_scaling_policy(AutoScalingGroupName=None, PolicyName=None, PolicyType=None, AdjustmentType=None, MinAdjustmentStep=None, MinAdjustmentMagnitude=None, ScalingAdjustment=None, Cooldown=None, MetricAggregationType=None, StepAdjustments=None, EstimatedInstanceWarmup=None):
"""
Creates or updates a policy for an Auto Scaling group. To update an existing policy, use the existing policy name and set the parameters you want to change. Any existing parameter not changed in an update to an existing policy is not changed in this update request.
If you exceed your maximum limit of step adjustments, which by default is 20 per region, the call fails. For information about updating this limit, see AWS Service Limits in the Amazon Web Services General Reference .
See also: AWS API Documentation
Examples
This example adds the specified policy to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_scaling_policy(
AutoScalingGroupName='string',
PolicyName='string',
PolicyType='string',
AdjustmentType='string',
MinAdjustmentStep=123,
MinAdjustmentMagnitude=123,
ScalingAdjustment=123,
Cooldown=123,
MetricAggregationType='string',
StepAdjustments=[
{
'MetricIntervalLowerBound': 123.0,
'MetricIntervalUpperBound': 123.0,
'ScalingAdjustment': 123
},
],
EstimatedInstanceWarmup=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name or ARN of the group.
:type PolicyName: string
:param PolicyName: [REQUIRED]
The name of the policy.
:type PolicyType: string
:param PolicyType: The policy type. Valid values are SimpleScaling and StepScaling . If the policy type is null, the value is treated as SimpleScaling .
:type AdjustmentType: string
:param AdjustmentType: [REQUIRED]
The adjustment type. Valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .
For more information, see Dynamic Scaling in the Auto Scaling User Guide .
:type MinAdjustmentStep: integer
:param MinAdjustmentStep: Available for backward compatibility. Use MinAdjustmentMagnitude instead.
:type MinAdjustmentMagnitude: integer
:param MinAdjustmentMagnitude: The minimum number of instances to scale. If the value of AdjustmentType is PercentChangeInCapacity , the scaling policy changes the DesiredCapacity of the Auto Scaling group by at least this many instances. Otherwise, the error is ValidationError .
:type ScalingAdjustment: integer
:param ScalingAdjustment: The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
This parameter is required if the policy type is SimpleScaling and not supported otherwise.
:type Cooldown: integer
:param Cooldown: The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. If this parameter is not specified, the default cooldown period for the group applies.
This parameter is not supported unless the policy type is SimpleScaling .
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide .
:type MetricAggregationType: string
:param MetricAggregationType: The aggregation type for the CloudWatch metrics. Valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average .
This parameter is not supported if the policy type is SimpleScaling .
:type StepAdjustments: list
:param StepAdjustments: A set of adjustments that enable you to scale based on the size of the alarm breach.
This parameter is required if the policy type is StepScaling and not supported otherwise.
(dict) --Describes an adjustment based on the difference between the value of the aggregated CloudWatch metric and the breach threshold that you've defined for the alarm.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
If you want the adjustment to be triggered when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
If you want the adjustment to be triggered when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
The ranges of your step adjustments can't overlap or have a gap.
At most one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
At most one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
The upper and lower bound can't be null in the same step adjustment.
MetricIntervalLowerBound (float) --The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound (float) --The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment (integer) -- [REQUIRED]The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
:type EstimatedInstanceWarmup: integer
:param EstimatedInstanceWarmup: The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. The default is to use the value specified for the default cooldown period for the group.
This parameter is not supported if the policy type is SimpleScaling .
:rtype: dict
:return: {
'PolicyARN': 'string'
}
"""
pass | Creates or updates a policy for an Auto Scaling group. To update an existing policy, use the existing policy name and set the parameters you want to change. Any existing parameter not changed in an update to an existing policy is not changed in this update request.
If you exceed your maximum limit of step adjustments, which by default is 20 per region, the call fails. For information about updating this limit, see AWS Service Limits in the Amazon Web Services General Reference .
See also: AWS API Documentation
Examples
This example adds the specified policy to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_scaling_policy(
AutoScalingGroupName='string',
PolicyName='string',
PolicyType='string',
AdjustmentType='string',
MinAdjustmentStep=123,
MinAdjustmentMagnitude=123,
ScalingAdjustment=123,
Cooldown=123,
MetricAggregationType='string',
StepAdjustments=[
{
'MetricIntervalLowerBound': 123.0,
'MetricIntervalUpperBound': 123.0,
'ScalingAdjustment': 123
},
],
EstimatedInstanceWarmup=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name or ARN of the group.
:type PolicyName: string
:param PolicyName: [REQUIRED]
The name of the policy.
:type PolicyType: string
:param PolicyType: The policy type. Valid values are SimpleScaling and StepScaling . If the policy type is null, the value is treated as SimpleScaling .
:type AdjustmentType: string
:param AdjustmentType: [REQUIRED]
The adjustment type. Valid values are ChangeInCapacity , ExactCapacity , and PercentChangeInCapacity .
For more information, see Dynamic Scaling in the Auto Scaling User Guide .
:type MinAdjustmentStep: integer
:param MinAdjustmentStep: Available for backward compatibility. Use MinAdjustmentMagnitude instead.
:type MinAdjustmentMagnitude: integer
:param MinAdjustmentMagnitude: The minimum number of instances to scale. If the value of AdjustmentType is PercentChangeInCapacity , the scaling policy changes the DesiredCapacity of the Auto Scaling group by at least this many instances. Otherwise, the error is ValidationError .
:type ScalingAdjustment: integer
:param ScalingAdjustment: The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
This parameter is required if the policy type is SimpleScaling and not supported otherwise.
:type Cooldown: integer
:param Cooldown: The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. If this parameter is not specified, the default cooldown period for the group applies.
This parameter is not supported unless the policy type is SimpleScaling .
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide .
:type MetricAggregationType: string
:param MetricAggregationType: The aggregation type for the CloudWatch metrics. Valid values are Minimum , Maximum , and Average . If the aggregation type is null, the value is treated as Average .
This parameter is not supported if the policy type is SimpleScaling .
:type StepAdjustments: list
:param StepAdjustments: A set of adjustments that enable you to scale based on the size of the alarm breach.
This parameter is required if the policy type is StepScaling and not supported otherwise.
(dict) --Describes an adjustment based on the difference between the value of the aggregated CloudWatch metric and the breach threshold that you've defined for the alarm.
For the following examples, suppose that you have an alarm with a breach threshold of 50:
If you want the adjustment to be triggered when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.
If you want the adjustment to be triggered when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.
There are a few rules for the step adjustments for your step policy:
The ranges of your step adjustments can't overlap or have a gap.
At most one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.
At most one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.
The upper and lower bound can't be null in the same step adjustment.
MetricIntervalLowerBound (float) --The lower bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the lower bound is inclusive (the metric must be greater than or equal to the threshold plus the lower bound). Otherwise, it is exclusive (the metric must be greater than the threshold plus the lower bound). A null value indicates negative infinity.
MetricIntervalUpperBound (float) --The upper bound for the difference between the alarm threshold and the CloudWatch metric. If the metric value is above the breach threshold, the upper bound is exclusive (the metric must be less than the threshold plus the upper bound). Otherwise, it is inclusive (the metric must be less than or equal to the threshold plus the upper bound). A null value indicates positive infinity.
The upper bound must be greater than the lower bound.
ScalingAdjustment (integer) -- [REQUIRED]The amount by which to scale, based on the specified adjustment type. A positive value adds to the current capacity while a negative number removes from the current capacity.
:type EstimatedInstanceWarmup: integer
:param EstimatedInstanceWarmup: The estimated time, in seconds, until a newly launched instance can contribute to the CloudWatch metrics. The default is to use the value specified for the default cooldown period for the group.
This parameter is not supported if the policy type is SimpleScaling .
:rtype: dict
:return: {
'PolicyARN': 'string'
} | entailment |
def put_scheduled_update_group_action(AutoScalingGroupName=None, ScheduledActionName=None, Time=None, StartTime=None, EndTime=None, Recurrence=None, MinSize=None, MaxSize=None, DesiredCapacity=None):
"""
Creates or updates a scheduled scaling action for an Auto Scaling group. When updating a scheduled scaling action, if you leave a parameter unspecified, the corresponding value remains unchanged.
For more information, see Scheduled Scaling in the Auto Scaling User Guide .
See also: AWS API Documentation
Examples
This example adds the specified scheduled action to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_scheduled_update_group_action(
AutoScalingGroupName='string',
ScheduledActionName='string',
Time=datetime(2015, 1, 1),
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
Recurrence='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name or Amazon Resource Name (ARN) of the Auto Scaling group.
:type ScheduledActionName: string
:param ScheduledActionName: [REQUIRED]
The name of this scaling action.
:type Time: datetime
:param Time: This parameter is deprecated.
:type StartTime: datetime
:param StartTime: The time for this action to start, in 'YYYY-MM-DDThh:mm:ssZ' format in UTC/GMT only (for example, 2014-06-01T00:00:00Z ).
If you specify Recurrence and StartTime , Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.
If you try to schedule your action in the past, Auto Scaling returns an error message.
:type EndTime: datetime
:param EndTime: The time for the recurring schedule to end. Auto Scaling does not perform the action after this time.
:type Recurrence: string
:param Recurrence: The recurring schedule for this action, in Unix cron syntax format. For more information, see Cron in Wikipedia.
:type MinSize: integer
:param MinSize: The minimum size for the Auto Scaling group.
:type MaxSize: integer
:param MaxSize: The maximum size for the Auto Scaling group.
:type DesiredCapacity: integer
:param DesiredCapacity: The number of EC2 instances that should be running in the group.
:return: response = client.put_scheduled_update_group_action(
AutoScalingGroupName='my-auto-scaling-group',
DesiredCapacity=4,
EndTime=datetime(2014, 5, 12, 8, 0, 0, 0, 132, 0),
MaxSize=6,
MinSize=2,
ScheduledActionName='my-scheduled-action',
StartTime=datetime(2014, 5, 12, 8, 0, 0, 0, 132, 0),
)
print(response)
"""
pass | Creates or updates a scheduled scaling action for an Auto Scaling group. When updating a scheduled scaling action, if you leave a parameter unspecified, the corresponding value remains unchanged.
For more information, see Scheduled Scaling in the Auto Scaling User Guide .
See also: AWS API Documentation
Examples
This example adds the specified scheduled action to the specified Auto Scaling group.
Expected Output:
:example: response = client.put_scheduled_update_group_action(
AutoScalingGroupName='string',
ScheduledActionName='string',
Time=datetime(2015, 1, 1),
StartTime=datetime(2015, 1, 1),
EndTime=datetime(2015, 1, 1),
Recurrence='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name or Amazon Resource Name (ARN) of the Auto Scaling group.
:type ScheduledActionName: string
:param ScheduledActionName: [REQUIRED]
The name of this scaling action.
:type Time: datetime
:param Time: This parameter is deprecated.
:type StartTime: datetime
:param StartTime: The time for this action to start, in 'YYYY-MM-DDThh:mm:ssZ' format in UTC/GMT only (for example, 2014-06-01T00:00:00Z ).
If you specify Recurrence and StartTime , Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.
If you try to schedule your action in the past, Auto Scaling returns an error message.
:type EndTime: datetime
:param EndTime: The time for the recurring schedule to end. Auto Scaling does not perform the action after this time.
:type Recurrence: string
:param Recurrence: The recurring schedule for this action, in Unix cron syntax format. For more information, see Cron in Wikipedia.
:type MinSize: integer
:param MinSize: The minimum size for the Auto Scaling group.
:type MaxSize: integer
:param MaxSize: The maximum size for the Auto Scaling group.
:type DesiredCapacity: integer
:param DesiredCapacity: The number of EC2 instances that should be running in the group.
:return: response = client.put_scheduled_update_group_action(
AutoScalingGroupName='my-auto-scaling-group',
DesiredCapacity=4,
EndTime=datetime(2014, 5, 12, 8, 0, 0, 0, 132, 0),
MaxSize=6,
MinSize=2,
ScheduledActionName='my-scheduled-action',
StartTime=datetime(2014, 5, 12, 8, 0, 0, 0, 132, 0),
)
print(response) | entailment |
def update_auto_scaling_group(AutoScalingGroupName=None, LaunchConfigurationName=None, MinSize=None, MaxSize=None, DesiredCapacity=None, DefaultCooldown=None, AvailabilityZones=None, HealthCheckType=None, HealthCheckGracePeriod=None, PlacementGroup=None, VPCZoneIdentifier=None, TerminationPolicies=None, NewInstancesProtectedFromScaleIn=None):
"""
Updates the configuration for the specified Auto Scaling group.
The new settings take effect on any scaling activities after this call returns. Scaling activities that are currently in progress aren't affected.
To update an Auto Scaling group with a launch configuration with InstanceMonitoring set to false , you must first disable the collection of group metrics. Otherwise, you will get an error. If you have previously enabled the collection of group metrics, you can disable it using DisableMetricsCollection .
Note the following:
See also: AWS API Documentation
Examples
This example updates the launch configuration of the specified Auto Scaling group.
Expected Output:
This example updates the minimum size and maximum size of the specified Auto Scaling group.
Expected Output:
This example enables instance protection for the specified Auto Scaling group.
Expected Output:
:example: response = client.update_auto_scaling_group(
AutoScalingGroupName='string',
LaunchConfigurationName='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123,
DefaultCooldown=123,
AvailabilityZones=[
'string',
],
HealthCheckType='string',
HealthCheckGracePeriod=123,
PlacementGroup='string',
VPCZoneIdentifier='string',
TerminationPolicies=[
'string',
],
NewInstancesProtectedFromScaleIn=True|False
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LaunchConfigurationName: string
:param LaunchConfigurationName: The name of the launch configuration.
:type MinSize: integer
:param MinSize: The minimum size of the Auto Scaling group.
:type MaxSize: integer
:param MaxSize: The maximum size of the Auto Scaling group.
:type DesiredCapacity: integer
:param DesiredCapacity: The number of EC2 instances that should be running in the Auto Scaling group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
:type DefaultCooldown: integer
:param DefaultCooldown: The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default is 300.
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide .
:type AvailabilityZones: list
:param AvailabilityZones: One or more Availability Zones for the group.
(string) --
:type HealthCheckType: string
:param HealthCheckType: The service to use for the health checks. The valid values are EC2 and ELB .
:type HealthCheckGracePeriod: integer
:param HealthCheckGracePeriod: The amount of time, in seconds, that Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default is 0.
For more information, see Health Checks in the Auto Scaling User Guide .
:type PlacementGroup: string
:param PlacementGroup: The name of the placement group into which you'll launch your instances, if any. For more information, see Placement Groups in the Amazon Elastic Compute Cloud User Guide .
:type VPCZoneIdentifier: string
:param VPCZoneIdentifier: The ID of the subnet, if you are launching into a VPC. You can specify several subnets in a comma-separated list.
When you specify VPCZoneIdentifier with AvailabilityZones , ensure that the subnets' Availability Zones match the values you specify for AvailabilityZones .
For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
:type TerminationPolicies: list
:param TerminationPolicies: A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Auto Scaling User Guide .
(string) --
:type NewInstancesProtectedFromScaleIn: boolean
:param NewInstancesProtectedFromScaleIn: Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in.
:return: response = client.update_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
LaunchConfigurationName='new-launch-config',
)
print(response)
:returns:
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LaunchConfigurationName (string) -- The name of the launch configuration.
MinSize (integer) -- The minimum size of the Auto Scaling group.
MaxSize (integer) -- The maximum size of the Auto Scaling group.
DesiredCapacity (integer) -- The number of EC2 instances that should be running in the Auto Scaling group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
DefaultCooldown (integer) -- The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default is 300.
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide .
AvailabilityZones (list) -- One or more Availability Zones for the group.
(string) --
HealthCheckType (string) -- The service to use for the health checks. The valid values are EC2 and ELB .
HealthCheckGracePeriod (integer) -- The amount of time, in seconds, that Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default is 0.
For more information, see Health Checks in the Auto Scaling User Guide .
PlacementGroup (string) -- The name of the placement group into which you'll launch your instances, if any. For more information, see Placement Groups in the Amazon Elastic Compute Cloud User Guide .
VPCZoneIdentifier (string) -- The ID of the subnet, if you are launching into a VPC. You can specify several subnets in a comma-separated list.
When you specify VPCZoneIdentifier with AvailabilityZones , ensure that the subnets' Availability Zones match the values you specify for AvailabilityZones .
For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
TerminationPolicies (list) -- A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Auto Scaling User Guide .
(string) --
NewInstancesProtectedFromScaleIn (boolean) -- Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in.
"""
pass | Updates the configuration for the specified Auto Scaling group.
The new settings take effect on any scaling activities after this call returns. Scaling activities that are currently in progress aren't affected.
To update an Auto Scaling group with a launch configuration with InstanceMonitoring set to false , you must first disable the collection of group metrics. Otherwise, you will get an error. If you have previously enabled the collection of group metrics, you can disable it using DisableMetricsCollection .
Note the following:
See also: AWS API Documentation
Examples
This example updates the launch configuration of the specified Auto Scaling group.
Expected Output:
This example updates the minimum size and maximum size of the specified Auto Scaling group.
Expected Output:
This example enables instance protection for the specified Auto Scaling group.
Expected Output:
:example: response = client.update_auto_scaling_group(
AutoScalingGroupName='string',
LaunchConfigurationName='string',
MinSize=123,
MaxSize=123,
DesiredCapacity=123,
DefaultCooldown=123,
AvailabilityZones=[
'string',
],
HealthCheckType='string',
HealthCheckGracePeriod=123,
PlacementGroup='string',
VPCZoneIdentifier='string',
TerminationPolicies=[
'string',
],
NewInstancesProtectedFromScaleIn=True|False
)
:type AutoScalingGroupName: string
:param AutoScalingGroupName: [REQUIRED]
The name of the Auto Scaling group.
:type LaunchConfigurationName: string
:param LaunchConfigurationName: The name of the launch configuration.
:type MinSize: integer
:param MinSize: The minimum size of the Auto Scaling group.
:type MaxSize: integer
:param MaxSize: The maximum size of the Auto Scaling group.
:type DesiredCapacity: integer
:param DesiredCapacity: The number of EC2 instances that should be running in the Auto Scaling group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
:type DefaultCooldown: integer
:param DefaultCooldown: The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default is 300.
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide .
:type AvailabilityZones: list
:param AvailabilityZones: One or more Availability Zones for the group.
(string) --
:type HealthCheckType: string
:param HealthCheckType: The service to use for the health checks. The valid values are EC2 and ELB .
:type HealthCheckGracePeriod: integer
:param HealthCheckGracePeriod: The amount of time, in seconds, that Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default is 0.
For more information, see Health Checks in the Auto Scaling User Guide .
:type PlacementGroup: string
:param PlacementGroup: The name of the placement group into which you'll launch your instances, if any. For more information, see Placement Groups in the Amazon Elastic Compute Cloud User Guide .
:type VPCZoneIdentifier: string
:param VPCZoneIdentifier: The ID of the subnet, if you are launching into a VPC. You can specify several subnets in a comma-separated list.
When you specify VPCZoneIdentifier with AvailabilityZones , ensure that the subnets' Availability Zones match the values you specify for AvailabilityZones .
For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
:type TerminationPolicies: list
:param TerminationPolicies: A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Auto Scaling User Guide .
(string) --
:type NewInstancesProtectedFromScaleIn: boolean
:param NewInstancesProtectedFromScaleIn: Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in.
:return: response = client.update_auto_scaling_group(
AutoScalingGroupName='my-auto-scaling-group',
LaunchConfigurationName='new-launch-config',
)
print(response)
:returns:
AutoScalingGroupName (string) -- [REQUIRED]
The name of the Auto Scaling group.
LaunchConfigurationName (string) -- The name of the launch configuration.
MinSize (integer) -- The minimum size of the Auto Scaling group.
MaxSize (integer) -- The maximum size of the Auto Scaling group.
DesiredCapacity (integer) -- The number of EC2 instances that should be running in the Auto Scaling group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.
DefaultCooldown (integer) -- The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default is 300.
For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide .
AvailabilityZones (list) -- One or more Availability Zones for the group.
(string) --
HealthCheckType (string) -- The service to use for the health checks. The valid values are EC2 and ELB .
HealthCheckGracePeriod (integer) -- The amount of time, in seconds, that Auto Scaling waits before checking the health status of an EC2 instance that has come into service. The default is 0.
For more information, see Health Checks in the Auto Scaling User Guide .
PlacementGroup (string) -- The name of the placement group into which you'll launch your instances, if any. For more information, see Placement Groups in the Amazon Elastic Compute Cloud User Guide .
VPCZoneIdentifier (string) -- The ID of the subnet, if you are launching into a VPC. You can specify several subnets in a comma-separated list.
When you specify VPCZoneIdentifier with AvailabilityZones , ensure that the subnets' Availability Zones match the values you specify for AvailabilityZones .
For more information, see Launching Auto Scaling Instances in a VPC in the Auto Scaling User Guide .
TerminationPolicies (list) -- A standalone termination policy or a list of termination policies used to select the instance to terminate. The policies are executed in the order that they are listed.
For more information, see Controlling Which Instances Auto Scaling Terminates During Scale In in the Auto Scaling User Guide .
(string) --
NewInstancesProtectedFromScaleIn (boolean) -- Indicates whether newly launched instances are protected from termination by Auto Scaling when scaling in. | entailment |
def search(cursor=None, expr=None, facet=None, filterQuery=None, highlight=None, partial=None, query=None, queryOptions=None, queryParser=None, returnFields=None, size=None, sort=None, start=None, stats=None):
"""
Retrieves a list of documents that match the specified search criteria. How you specify the search criteria depends on which query parser you use. Amazon CloudSearch supports four query parsers:
For more information, see Searching Your Data in the Amazon CloudSearch Developer Guide .
The endpoint for submitting Search requests is domain-specific. You submit search requests to a domain's search endpoint. To get the search endpoint for your domain, use the Amazon CloudSearch configuration service DescribeDomains action. A domain's endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console.
See also: AWS API Documentation
:example: response = client.search(
cursor='string',
expr='string',
facet='string',
filterQuery='string',
highlight='string',
partial=True|False,
query='string',
queryOptions='string',
queryParser='simple'|'structured'|'lucene'|'dismax',
returnFields='string',
size=123,
sort='string',
start=123,
stats='string'
)
:type cursor: string
:param cursor: Retrieves a cursor value you can use to page through large result sets. Use the size parameter to control the number of hits to include in each response. You can specify either the cursor or start parameter in a request; they are mutually exclusive. To get the first cursor, set the cursor value to initial . In subsequent requests, specify the cursor value returned in the hits section of the response.
For more information, see Paginating Results in the Amazon CloudSearch Developer Guide .
:type expr: string
:param expr: Defines one or more numeric expressions that can be used to sort results or specify search or filter criteria. You can also specify expressions as return fields.
You specify the expressions in JSON using the form {'EXPRESSIONNAME':'EXPRESSION'} . You can define and use multiple expressions in a search request. For example:
{'expression1':'_score*rating', 'expression2':'(1/rank)*year'}
For information about the variables, operators, and functions you can use in expressions, see Writing Expressions in the Amazon CloudSearch Developer Guide .
:type facet: string
:param facet: Specifies one or more fields for which to get facet information, and options that control how the facet information is returned. Each specified field must be facet-enabled in the domain configuration. The fields and options are specified in JSON using the form {'FIELD':{'OPTION':VALUE,'OPTION:'STRING'},'FIELD':{'OPTION':VALUE,'OPTION':'STRING'}} .
You can specify the following faceting options:
buckets specifies an array of the facet values or ranges to count. Ranges are specified using the same syntax that you use to search for a range of values. For more information, see Searching for a Range of Values in the Amazon CloudSearch Developer Guide . Buckets are returned in the order they are specified in the request. The sort and size options are not valid if you specify buckets .
size specifies the maximum number of facets to include in the results. By default, Amazon CloudSearch returns counts for the top 10. The size parameter is only valid when you specify the sort option; it cannot be used in conjunction with buckets .
sort specifies how you want to sort the facets in the results: bucket or count . Specify bucket to sort alphabetically or numerically by facet value (in ascending order). Specify count to sort by the facet counts computed for each facet value (in descending order). To retrieve facet counts for particular values or ranges of values, use the buckets option instead of sort .
If no facet options are specified, facet counts are computed for all field values, the facets are sorted by facet count, and the top 10 facets are returned in the results.
To count particular buckets of values, use the buckets option. For example, the following request uses the buckets option to calculate and return facet counts by decade.
{'year':{'buckets':['[1970,1979]','[1980,1989]','[1990,1999]','[2000,2009]','[2010,}']}}
To sort facets by facet count, use the count option. For example, the following request sets the sort option to count to sort the facet values by facet count, with the facet values that have the most matching documents listed first. Setting the size option to 3 returns only the top three facet values.
{'year':{'sort':'count','size':3}}
To sort the facets by value, use the bucket option. For example, the following request sets the sort option to bucket to sort the facet values numerically by year, with earliest year listed first.
{'year':{'sort':'bucket'}}
For more information, see Getting and Using Facet Information in the Amazon CloudSearch Developer Guide .
:type filterQuery: string
:param filterQuery: Specifies a structured query that filters the results of a search without affecting how the results are scored and sorted. You use filterQuery in conjunction with the query parameter to filter the documents that match the constraints specified in the query parameter. Specifying a filter controls only which matching documents are included in the results, it has no effect on how they are scored and sorted. The filterQuery parameter supports the full structured query syntax.
For more information about using filters, see Filtering Matching Documents in the Amazon CloudSearch Developer Guide .
:type highlight: string
:param highlight: Retrieves highlights for matches in the specified text or text-array fields. Each specified field must be highlight enabled in the domain configuration. The fields and options are specified in JSON using the form {'FIELD':{'OPTION':VALUE,'OPTION:'STRING'},'FIELD':{'OPTION':VALUE,'OPTION':'STRING'}} .
You can specify the following highlight options:
format : specifies the format of the data in the text field: text or html . When data is returned as HTML, all non-alphanumeric characters are encoded. The default is html .
max_phrases : specifies the maximum number of occurrences of the search term(s) you want to highlight. By default, the first occurrence is highlighted.
pre_tag : specifies the string to prepend to an occurrence of a search term. The default for HTML highlights is lt;emgt; . The default for text highlights is * .
post_tag : specifies the string to append to an occurrence of a search term. The default for HTML highlights is lt;/emgt; . The default for text highlights is * .
If no highlight options are specified for a field, the returned field text is treated as HTML and the first match is highlighted with emphasis tags: lt;emsearch-termlt;/emgt; .
For example, the following request retrieves highlights for the actors and title fields.
{ 'actors': {}, 'title': {'format': 'text','max_phrases': 2,'pre_tag': '**','post_tag': '** '} }
:type partial: boolean
:param partial: Enables partial results to be returned if one or more index partitions are unavailable. When your search index is partitioned across multiple search instances, by default Amazon CloudSearch only returns results if every partition can be queried. This means that the failure of a single search instance can result in 5xx (internal server) errors. When you enable partial results, Amazon CloudSearch returns whatever results are available and includes the percentage of documents searched in the search results (percent-searched). This enables you to more gracefully degrade your users' search experience. For example, rather than displaying no results, you could display the partial results and a message indicating that the results might be incomplete due to a temporary system outage.
:type query: string
:param query: [REQUIRED]
Specifies the search criteria for the request. How you specify the search criteria depends on the query parser used for the request and the parser options specified in the queryOptions parameter. By default, the simple query parser is used to process requests. To use the structured , lucene , or dismax query parser, you must also specify the queryParser parameter.
For more information about specifying search criteria, see Searching Your Data in the Amazon CloudSearch Developer Guide .
:type queryOptions: string
:param queryOptions: Configures options for the query parser specified in the queryParser parameter. You specify the options in JSON using the following form {'OPTION1':'VALUE1','OPTION2':VALUE2'...'OPTIONN':'VALUEN'}.
The options you can configure vary according to which parser you use:
defaultOperator : The default operator used to combine individual terms in the search string. For example: defaultOperator: 'or' . For the dismax parser, you specify a percentage that represents the percentage of terms in the search string (rounded down) that must match, rather than a default operator. A value of 0% is the equivalent to OR, and a value of 100% is equivalent to AND. The percentage must be specified as a value in the range 0-100 followed by the percent (%) symbol. For example, defaultOperator: 50% . Valid values: and , or , a percentage in the range 0%-100% (dismax ). Default: and (simple , structured , lucene ) or 100 (dismax ). Valid for: simple , structured , lucene , and dismax .
fields : An array of the fields to search when no fields are specified in a search. If no fields are specified in a search and this option is not specified, all text and text-array fields are searched. You can specify a weight for each field to control the relative importance of each field when Amazon CloudSearch calculates relevance scores. To specify a field weight, append a caret (^ ) symbol and the weight to the field name. For example, to boost the importance of the title field over the description field you could specify: 'fields':['title^5','description'] . Valid values: The name of any configured field and an optional numeric value greater than zero. Default: All text and text-array fields. Valid for: simple , structured , lucene , and dismax .
operators : An array of the operators or special characters you want to disable for the simple query parser. If you disable the and , or , or not operators, the corresponding operators (+ , | , - ) have no special meaning and are dropped from the search string. Similarly, disabling prefix disables the wildcard operator (* ) and disabling phrase disables the ability to search for phrases by enclosing phrases in double quotes. Disabling precedence disables the ability to control order of precedence using parentheses. Disabling near disables the ability to use the ~ operator to perform a sloppy phrase search. Disabling the fuzzy operator disables the ability to use the ~ operator to perform a fuzzy search. escape disables the ability to use a backslash (\ ) to escape special characters within the search string. Disabling whitespace is an advanced option that prevents the parser from tokenizing on whitespace, which can be useful for Vietnamese. (It prevents Vietnamese words from being split incorrectly.) For example, you could disable all operators other than the phrase operator to support just simple term and phrase queries: 'operators':['and','not','or', 'prefix'] . Valid values: and , escape , fuzzy , near , not , or , phrase , precedence , prefix , whitespace . Default: All operators and special characters are enabled. Valid for: simple .
phraseFields : An array of the text or text-array fields you want to use for phrase searches. When the terms in the search string appear in close proximity within a field, the field scores higher. You can specify a weight for each field to boost that score. The phraseSlop option controls how much the matches can deviate from the search string and still be boosted. To specify a field weight, append a caret (^ ) symbol and the weight to the field name. For example, to boost phrase matches in the title field over the abstract field, you could specify: 'phraseFields':['title^3', 'plot'] Valid values: The name of any text or text-array field and an optional numeric value greater than zero. Default: No fields. If you don't specify any fields with phraseFields , proximity scoring is disabled even if phraseSlop is specified. Valid for: dismax .
phraseSlop : An integer value that specifies how much matches can deviate from the search phrase and still be boosted according to the weights specified in the phraseFields option; for example, phraseSlop: 2 . You must also specify phraseFields to enable proximity scoring. Valid values: positive integers. Default: 0. Valid for: dismax .
explicitPhraseSlop : An integer value that specifies how much a match can deviate from the search phrase when the phrase is enclosed in double quotes in the search string. (Phrases that exceed this proximity distance are not considered a match.) For example, to specify a slop of three for dismax phrase queries, you would specify 'explicitPhraseSlop':3 . Valid values: positive integers. Default: 0. Valid for: dismax .
tieBreaker : When a term in the search string is found in a document's field, a score is calculated for that field based on how common the word is in that field compared to other documents. If the term occurs in multiple fields within a document, by default only the highest scoring field contributes to the document's overall score. You can specify a tieBreaker value to enable the matches in lower-scoring fields to contribute to the document's score. That way, if two documents have the same max field score for a particular term, the score for the document that has matches in more fields will be higher. The formula for calculating the score with a tieBreaker is (max field score) + (tieBreaker) * (sum of the scores for the rest of the matching fields) . Set tieBreaker to 0 to disregard all but the highest scoring field (pure max): 'tieBreaker':0 . Set to 1 to sum the scores from all fields (pure sum): 'tieBreaker':1 . Valid values: 0.0 to 1.0. Default: 0.0. Valid for: dismax .
:type queryParser: string
:param queryParser: Specifies which query parser to use to process the request. If queryParser is not specified, Amazon CloudSearch uses the simple query parser.
Amazon CloudSearch supports four query parsers:
simple : perform simple searches of text and text-array fields. By default, the simple query parser searches all text and text-array fields. You can specify which fields to search by with the queryOptions parameter. If you prefix a search term with a plus sign (+) documents must contain the term to be considered a match. (This is the default, unless you configure the default operator with the queryOptions parameter.) You can use the - (NOT), | (OR), and * (wildcard) operators to exclude particular terms, find results that match any of the specified terms, or search for a prefix. To search for a phrase rather than individual terms, enclose the phrase in double quotes. For more information, see Searching for Text in the Amazon CloudSearch Developer Guide .
structured : perform advanced searches by combining multiple expressions to define the search criteria. You can also search within particular fields, search for values and ranges of values, and use advanced options such as term boosting, matchall , and near . For more information, see Constructing Compound Queries in the Amazon CloudSearch Developer Guide .
lucene : search using the Apache Lucene query parser syntax. For more information, see Apache Lucene Query Parser Syntax .
dismax : search using the simplified subset of the Apache Lucene query parser syntax defined by the DisMax query parser. For more information, see DisMax Query Parser Syntax .
:type returnFields: string
:param returnFields: Specifies the field and expression values to include in the response. Multiple fields or expressions are specified as a comma-separated list. By default, a search response includes all return enabled fields (_all_fields ). To return only the document IDs for the matching documents, specify _no_fields . To retrieve the relevance score calculated for each document, specify _score .
:type size: integer
:param size: Specifies the maximum number of search hits to include in the response.
:type sort: string
:param sort: Specifies the fields or custom expressions to use to sort the search results. Multiple fields or expressions are specified as a comma-separated list. You must specify the sort direction (asc or desc ) for each field; for example, year desc,title asc . To use a field to sort results, the field must be sort-enabled in the domain configuration. Array type fields cannot be used for sorting. If no sort parameter is specified, results are sorted by their default relevance scores in descending order: _score desc . You can also sort by document ID (_id asc ) and version (_version desc ).
For more information, see Sorting Results in the Amazon CloudSearch Developer Guide .
:type start: integer
:param start: Specifies the offset of the first search hit you want to return. Note that the result set is zero-based; the first result is at index 0. You can specify either the start or cursor parameter in a request, they are mutually exclusive.
For more information, see Paginating Results in the Amazon CloudSearch Developer Guide .
:type stats: string
:param stats: Specifies one or more fields for which to get statistics information. Each specified field must be facet-enabled in the domain configuration. The fields are specified in JSON using the form:
{'FIELD-A':{},'FIELD-B':{}}
There are currently no options supported for statistics.
:rtype: dict
:return: {
'status': {
'timems': 123,
'rid': 'string'
},
'hits': {
'found': 123,
'start': 123,
'cursor': 'string',
'hit': [
{
'id': 'string',
'fields': {
'string': [
'string',
]
},
'exprs': {
'string': 'string'
},
'highlights': {
'string': 'string'
}
},
]
},
'facets': {
'string': {
'buckets': [
{
'value': 'string',
'count': 123
},
]
}
},
'stats': {
'string': {
'min': 'string',
'max': 'string',
'count': 123,
'missing': 123,
'sum': 123.0,
'sumOfSquares': 123.0,
'mean': 'string',
'stddev': 123.0
}
}
}
:returns:
cursor (string) -- Retrieves a cursor value you can use to page through large result sets. Use the size parameter to control the number of hits to include in each response. You can specify either the cursor or start parameter in a request; they are mutually exclusive. To get the first cursor, set the cursor value to initial . In subsequent requests, specify the cursor value returned in the hits section of the response.
For more information, see Paginating Results in the Amazon CloudSearch Developer Guide .
expr (string) -- Defines one or more numeric expressions that can be used to sort results or specify search or filter criteria. You can also specify expressions as return fields.
You specify the expressions in JSON using the form {"EXPRESSIONNAME":"EXPRESSION"} . You can define and use multiple expressions in a search request. For example:
{"expression1":"_score*rating", "expression2":"(1/rank)*year"}
For information about the variables, operators, and functions you can use in expressions, see Writing Expressions in the Amazon CloudSearch Developer Guide .
facet (string) -- Specifies one or more fields for which to get facet information, and options that control how the facet information is returned. Each specified field must be facet-enabled in the domain configuration. The fields and options are specified in JSON using the form {"FIELD":{"OPTION":VALUE,"OPTION:"STRING"},"FIELD":{"OPTION":VALUE,"OPTION":"STRING"}} .
You can specify the following faceting options:
buckets specifies an array of the facet values or ranges to count. Ranges are specified using the same syntax that you use to search for a range of values. For more information, see Searching for a Range of Values in the Amazon CloudSearch Developer Guide . Buckets are returned in the order they are specified in the request. The sort and size options are not valid if you specify buckets .
size specifies the maximum number of facets to include in the results. By default, Amazon CloudSearch returns counts for the top 10. The size parameter is only valid when you specify the sort option; it cannot be used in conjunction with buckets .
sort specifies how you want to sort the facets in the results: bucket or count . Specify bucket to sort alphabetically or numerically by facet value (in ascending order). Specify count to sort by the facet counts computed for each facet value (in descending order). To retrieve facet counts for particular values or ranges of values, use the buckets option instead of sort .
If no facet options are specified, facet counts are computed for all field values, the facets are sorted by facet count, and the top 10 facets are returned in the results.
To count particular buckets of values, use the buckets option. For example, the following request uses the buckets option to calculate and return facet counts by decade.
{"year":{"buckets":["[1970,1979]","[1980,1989]","[1990,1999]","[2000,2009]","[2010,}"]}}
To sort facets by facet count, use the count option. For example, the following request sets the sort option to count to sort the facet values by facet count, with the facet values that have the most matching documents listed first. Setting the size option to 3 returns only the top three facet values.
{"year":{"sort":"count","size":3}}
To sort the facets by value, use the bucket option. For example, the following request sets the sort option to bucket to sort the facet values numerically by year, with earliest year listed first.
{"year":{"sort":"bucket"}}
For more information, see Getting and Using Facet Information in the Amazon CloudSearch Developer Guide .
filterQuery (string) -- Specifies a structured query that filters the results of a search without affecting how the results are scored and sorted. You use filterQuery in conjunction with the query parameter to filter the documents that match the constraints specified in the query parameter. Specifying a filter controls only which matching documents are included in the results, it has no effect on how they are scored and sorted. The filterQuery parameter supports the full structured query syntax.
For more information about using filters, see Filtering Matching Documents in the Amazon CloudSearch Developer Guide .
highlight (string) -- Retrieves highlights for matches in the specified text or text-array fields. Each specified field must be highlight enabled in the domain configuration. The fields and options are specified in JSON using the form {"FIELD":{"OPTION":VALUE,"OPTION:"STRING"},"FIELD":{"OPTION":VALUE,"OPTION":"STRING"}} .
You can specify the following highlight options:
format : specifies the format of the data in the text field: text or html . When data is returned as HTML, all non-alphanumeric characters are encoded. The default is html .
max_phrases : specifies the maximum number of occurrences of the search term(s) you want to highlight. By default, the first occurrence is highlighted.
pre_tag : specifies the string to prepend to an occurrence of a search term. The default for HTML highlights is lt;emgt; . The default for text highlights is * .
post_tag : specifies the string to append to an occurrence of a search term. The default for HTML highlights is lt;/emgt; . The default for text highlights is * .
If no highlight options are specified for a field, the returned field text is treated as HTML and the first match is highlighted with emphasis tags: lt;emsearch-termlt;/emgt; .
For example, the following request retrieves highlights for the actors and title fields.
{ "actors": {}, "title": {"format": "text","max_phrases": 2,"pre_tag": "**","post_tag": "** "} }
partial (boolean) -- Enables partial results to be returned if one or more index partitions are unavailable. When your search index is partitioned across multiple search instances, by default Amazon CloudSearch only returns results if every partition can be queried. This means that the failure of a single search instance can result in 5xx (internal server) errors. When you enable partial results, Amazon CloudSearch returns whatever results are available and includes the percentage of documents searched in the search results (percent-searched). This enables you to more gracefully degrade your users' search experience. For example, rather than displaying no results, you could display the partial results and a message indicating that the results might be incomplete due to a temporary system outage.
query (string) -- [REQUIRED]
Specifies the search criteria for the request. How you specify the search criteria depends on the query parser used for the request and the parser options specified in the queryOptions parameter. By default, the simple query parser is used to process requests. To use the structured , lucene , or dismax query parser, you must also specify the queryParser parameter.
For more information about specifying search criteria, see Searching Your Data in the Amazon CloudSearch Developer Guide .
queryOptions (string) -- Configures options for the query parser specified in the queryParser parameter. You specify the options in JSON using the following form {"OPTION1":"VALUE1","OPTION2":VALUE2"..."OPTIONN":"VALUEN"}.
The options you can configure vary according to which parser you use:
defaultOperator : The default operator used to combine individual terms in the search string. For example: defaultOperator: 'or' . For the dismax parser, you specify a percentage that represents the percentage of terms in the search string (rounded down) that must match, rather than a default operator. A value of 0% is the equivalent to OR, and a value of 100% is equivalent to AND. The percentage must be specified as a value in the range 0-100 followed by the percent (%) symbol. For example, defaultOperator: 50% . Valid values: and , or , a percentage in the range 0%-100% (dismax ). Default: and (simple , structured , lucene ) or 100 (dismax ). Valid for: simple , structured , lucene , and dismax .
fields : An array of the fields to search when no fields are specified in a search. If no fields are specified in a search and this option is not specified, all text and text-array fields are searched. You can specify a weight for each field to control the relative importance of each field when Amazon CloudSearch calculates relevance scores. To specify a field weight, append a caret (^ ) symbol and the weight to the field name. For example, to boost the importance of the title field over the description field you could specify: "fields":["title^5","description"] . Valid values: The name of any configured field and an optional numeric value greater than zero. Default: All text and text-array fields. Valid for: simple , structured , lucene , and dismax .
operators : An array of the operators or special characters you want to disable for the simple query parser. If you disable the and , or , or not operators, the corresponding operators (+ , | , - ) have no special meaning and are dropped from the search string. Similarly, disabling prefix disables the wildcard operator (* ) and disabling phrase disables the ability to search for phrases by enclosing phrases in double quotes. Disabling precedence disables the ability to control order of precedence using parentheses. Disabling near disables the ability to use the ~ operator to perform a sloppy phrase search. Disabling the fuzzy operator disables the ability to use the ~ operator to perform a fuzzy search. escape disables the ability to use a backslash (\ ) to escape special characters within the search string. Disabling whitespace is an advanced option that prevents the parser from tokenizing on whitespace, which can be useful for Vietnamese. (It prevents Vietnamese words from being split incorrectly.) For example, you could disable all operators other than the phrase operator to support just simple term and phrase queries: "operators":["and","not","or", "prefix"] . Valid values: and , escape , fuzzy , near , not , or , phrase , precedence , prefix , whitespace . Default: All operators and special characters are enabled. Valid for: simple .
phraseFields : An array of the text or text-array fields you want to use for phrase searches. When the terms in the search string appear in close proximity within a field, the field scores higher. You can specify a weight for each field to boost that score. The phraseSlop option controls how much the matches can deviate from the search string and still be boosted. To specify a field weight, append a caret (^ ) symbol and the weight to the field name. For example, to boost phrase matches in the title field over the abstract field, you could specify: "phraseFields":["title^3", "plot"] Valid values: The name of any text or text-array field and an optional numeric value greater than zero. Default: No fields. If you don't specify any fields with phraseFields , proximity scoring is disabled even if phraseSlop is specified. Valid for: dismax .
phraseSlop : An integer value that specifies how much matches can deviate from the search phrase and still be boosted according to the weights specified in the phraseFields option; for example, phraseSlop: 2 . You must also specify phraseFields to enable proximity scoring. Valid values: positive integers. Default: 0. Valid for: dismax .
explicitPhraseSlop : An integer value that specifies how much a match can deviate from the search phrase when the phrase is enclosed in double quotes in the search string. (Phrases that exceed this proximity distance are not considered a match.) For example, to specify a slop of three for dismax phrase queries, you would specify "explicitPhraseSlop":3 . Valid values: positive integers. Default: 0. Valid for: dismax .
tieBreaker : When a term in the search string is found in a document's field, a score is calculated for that field based on how common the word is in that field compared to other documents. If the term occurs in multiple fields within a document, by default only the highest scoring field contributes to the document's overall score. You can specify a tieBreaker value to enable the matches in lower-scoring fields to contribute to the document's score. That way, if two documents have the same max field score for a particular term, the score for the document that has matches in more fields will be higher. The formula for calculating the score with a tieBreaker is (max field score) + (tieBreaker) * (sum of the scores for the rest of the matching fields) . Set tieBreaker to 0 to disregard all but the highest scoring field (pure max): "tieBreaker":0 . Set to 1 to sum the scores from all fields (pure sum): "tieBreaker":1 . Valid values: 0.0 to 1.0. Default: 0.0. Valid for: dismax .
queryParser (string) -- Specifies which query parser to use to process the request. If queryParser is not specified, Amazon CloudSearch uses the simple query parser.
Amazon CloudSearch supports four query parsers:
simple : perform simple searches of text and text-array fields. By default, the simple query parser searches all text and text-array fields. You can specify which fields to search by with the queryOptions parameter. If you prefix a search term with a plus sign (+) documents must contain the term to be considered a match. (This is the default, unless you configure the default operator with the queryOptions parameter.) You can use the - (NOT), | (OR), and * (wildcard) operators to exclude particular terms, find results that match any of the specified terms, or search for a prefix. To search for a phrase rather than individual terms, enclose the phrase in double quotes. For more information, see Searching for Text in the Amazon CloudSearch Developer Guide .
structured : perform advanced searches by combining multiple expressions to define the search criteria. You can also search within particular fields, search for values and ranges of values, and use advanced options such as term boosting, matchall , and near . For more information, see Constructing Compound Queries in the Amazon CloudSearch Developer Guide .
lucene : search using the Apache Lucene query parser syntax. For more information, see Apache Lucene Query Parser Syntax .
dismax : search using the simplified subset of the Apache Lucene query parser syntax defined by the DisMax query parser. For more information, see DisMax Query Parser Syntax .
returnFields (string) -- Specifies the field and expression values to include in the response. Multiple fields or expressions are specified as a comma-separated list. By default, a search response includes all return enabled fields (_all_fields ). To return only the document IDs for the matching documents, specify _no_fields . To retrieve the relevance score calculated for each document, specify _score .
size (integer) -- Specifies the maximum number of search hits to include in the response.
sort (string) -- Specifies the fields or custom expressions to use to sort the search results. Multiple fields or expressions are specified as a comma-separated list. You must specify the sort direction (asc or desc ) for each field; for example, year desc,title asc . To use a field to sort results, the field must be sort-enabled in the domain configuration. Array type fields cannot be used for sorting. If no sort parameter is specified, results are sorted by their default relevance scores in descending order: _score desc . You can also sort by document ID (_id asc ) and version (_version desc ).
For more information, see Sorting Results in the Amazon CloudSearch Developer Guide .
start (integer) -- Specifies the offset of the first search hit you want to return. Note that the result set is zero-based; the first result is at index 0. You can specify either the start or cursor parameter in a request, they are mutually exclusive.
For more information, see Paginating Results in the Amazon CloudSearch Developer Guide .
stats (string) -- Specifies one or more fields for which to get statistics information. Each specified field must be facet-enabled in the domain configuration. The fields are specified in JSON using the form:
{"FIELD-A":{},"FIELD-B":{}}
There are currently no options supported for statistics.
"""
pass | Retrieves a list of documents that match the specified search criteria. How you specify the search criteria depends on which query parser you use. Amazon CloudSearch supports four query parsers:
For more information, see Searching Your Data in the Amazon CloudSearch Developer Guide .
The endpoint for submitting Search requests is domain-specific. You submit search requests to a domain's search endpoint. To get the search endpoint for your domain, use the Amazon CloudSearch configuration service DescribeDomains action. A domain's endpoints are also displayed on the domain dashboard in the Amazon CloudSearch console.
See also: AWS API Documentation
:example: response = client.search(
cursor='string',
expr='string',
facet='string',
filterQuery='string',
highlight='string',
partial=True|False,
query='string',
queryOptions='string',
queryParser='simple'|'structured'|'lucene'|'dismax',
returnFields='string',
size=123,
sort='string',
start=123,
stats='string'
)
:type cursor: string
:param cursor: Retrieves a cursor value you can use to page through large result sets. Use the size parameter to control the number of hits to include in each response. You can specify either the cursor or start parameter in a request; they are mutually exclusive. To get the first cursor, set the cursor value to initial . In subsequent requests, specify the cursor value returned in the hits section of the response.
For more information, see Paginating Results in the Amazon CloudSearch Developer Guide .
:type expr: string
:param expr: Defines one or more numeric expressions that can be used to sort results or specify search or filter criteria. You can also specify expressions as return fields.
You specify the expressions in JSON using the form {'EXPRESSIONNAME':'EXPRESSION'} . You can define and use multiple expressions in a search request. For example:
{'expression1':'_score*rating', 'expression2':'(1/rank)*year'}
For information about the variables, operators, and functions you can use in expressions, see Writing Expressions in the Amazon CloudSearch Developer Guide .
:type facet: string
:param facet: Specifies one or more fields for which to get facet information, and options that control how the facet information is returned. Each specified field must be facet-enabled in the domain configuration. The fields and options are specified in JSON using the form {'FIELD':{'OPTION':VALUE,'OPTION:'STRING'},'FIELD':{'OPTION':VALUE,'OPTION':'STRING'}} .
You can specify the following faceting options:
buckets specifies an array of the facet values or ranges to count. Ranges are specified using the same syntax that you use to search for a range of values. For more information, see Searching for a Range of Values in the Amazon CloudSearch Developer Guide . Buckets are returned in the order they are specified in the request. The sort and size options are not valid if you specify buckets .
size specifies the maximum number of facets to include in the results. By default, Amazon CloudSearch returns counts for the top 10. The size parameter is only valid when you specify the sort option; it cannot be used in conjunction with buckets .
sort specifies how you want to sort the facets in the results: bucket or count . Specify bucket to sort alphabetically or numerically by facet value (in ascending order). Specify count to sort by the facet counts computed for each facet value (in descending order). To retrieve facet counts for particular values or ranges of values, use the buckets option instead of sort .
If no facet options are specified, facet counts are computed for all field values, the facets are sorted by facet count, and the top 10 facets are returned in the results.
To count particular buckets of values, use the buckets option. For example, the following request uses the buckets option to calculate and return facet counts by decade.
{'year':{'buckets':['[1970,1979]','[1980,1989]','[1990,1999]','[2000,2009]','[2010,}']}}
To sort facets by facet count, use the count option. For example, the following request sets the sort option to count to sort the facet values by facet count, with the facet values that have the most matching documents listed first. Setting the size option to 3 returns only the top three facet values.
{'year':{'sort':'count','size':3}}
To sort the facets by value, use the bucket option. For example, the following request sets the sort option to bucket to sort the facet values numerically by year, with earliest year listed first.
{'year':{'sort':'bucket'}}
For more information, see Getting and Using Facet Information in the Amazon CloudSearch Developer Guide .
:type filterQuery: string
:param filterQuery: Specifies a structured query that filters the results of a search without affecting how the results are scored and sorted. You use filterQuery in conjunction with the query parameter to filter the documents that match the constraints specified in the query parameter. Specifying a filter controls only which matching documents are included in the results, it has no effect on how they are scored and sorted. The filterQuery parameter supports the full structured query syntax.
For more information about using filters, see Filtering Matching Documents in the Amazon CloudSearch Developer Guide .
:type highlight: string
:param highlight: Retrieves highlights for matches in the specified text or text-array fields. Each specified field must be highlight enabled in the domain configuration. The fields and options are specified in JSON using the form {'FIELD':{'OPTION':VALUE,'OPTION:'STRING'},'FIELD':{'OPTION':VALUE,'OPTION':'STRING'}} .
You can specify the following highlight options:
format : specifies the format of the data in the text field: text or html . When data is returned as HTML, all non-alphanumeric characters are encoded. The default is html .
max_phrases : specifies the maximum number of occurrences of the search term(s) you want to highlight. By default, the first occurrence is highlighted.
pre_tag : specifies the string to prepend to an occurrence of a search term. The default for HTML highlights is lt;emgt; . The default for text highlights is * .
post_tag : specifies the string to append to an occurrence of a search term. The default for HTML highlights is lt;/emgt; . The default for text highlights is * .
If no highlight options are specified for a field, the returned field text is treated as HTML and the first match is highlighted with emphasis tags: lt;emsearch-termlt;/emgt; .
For example, the following request retrieves highlights for the actors and title fields.
{ 'actors': {}, 'title': {'format': 'text','max_phrases': 2,'pre_tag': '**','post_tag': '** '} }
:type partial: boolean
:param partial: Enables partial results to be returned if one or more index partitions are unavailable. When your search index is partitioned across multiple search instances, by default Amazon CloudSearch only returns results if every partition can be queried. This means that the failure of a single search instance can result in 5xx (internal server) errors. When you enable partial results, Amazon CloudSearch returns whatever results are available and includes the percentage of documents searched in the search results (percent-searched). This enables you to more gracefully degrade your users' search experience. For example, rather than displaying no results, you could display the partial results and a message indicating that the results might be incomplete due to a temporary system outage.
:type query: string
:param query: [REQUIRED]
Specifies the search criteria for the request. How you specify the search criteria depends on the query parser used for the request and the parser options specified in the queryOptions parameter. By default, the simple query parser is used to process requests. To use the structured , lucene , or dismax query parser, you must also specify the queryParser parameter.
For more information about specifying search criteria, see Searching Your Data in the Amazon CloudSearch Developer Guide .
:type queryOptions: string
:param queryOptions: Configures options for the query parser specified in the queryParser parameter. You specify the options in JSON using the following form {'OPTION1':'VALUE1','OPTION2':VALUE2'...'OPTIONN':'VALUEN'}.
The options you can configure vary according to which parser you use:
defaultOperator : The default operator used to combine individual terms in the search string. For example: defaultOperator: 'or' . For the dismax parser, you specify a percentage that represents the percentage of terms in the search string (rounded down) that must match, rather than a default operator. A value of 0% is the equivalent to OR, and a value of 100% is equivalent to AND. The percentage must be specified as a value in the range 0-100 followed by the percent (%) symbol. For example, defaultOperator: 50% . Valid values: and , or , a percentage in the range 0%-100% (dismax ). Default: and (simple , structured , lucene ) or 100 (dismax ). Valid for: simple , structured , lucene , and dismax .
fields : An array of the fields to search when no fields are specified in a search. If no fields are specified in a search and this option is not specified, all text and text-array fields are searched. You can specify a weight for each field to control the relative importance of each field when Amazon CloudSearch calculates relevance scores. To specify a field weight, append a caret (^ ) symbol and the weight to the field name. For example, to boost the importance of the title field over the description field you could specify: 'fields':['title^5','description'] . Valid values: The name of any configured field and an optional numeric value greater than zero. Default: All text and text-array fields. Valid for: simple , structured , lucene , and dismax .
operators : An array of the operators or special characters you want to disable for the simple query parser. If you disable the and , or , or not operators, the corresponding operators (+ , | , - ) have no special meaning and are dropped from the search string. Similarly, disabling prefix disables the wildcard operator (* ) and disabling phrase disables the ability to search for phrases by enclosing phrases in double quotes. Disabling precedence disables the ability to control order of precedence using parentheses. Disabling near disables the ability to use the ~ operator to perform a sloppy phrase search. Disabling the fuzzy operator disables the ability to use the ~ operator to perform a fuzzy search. escape disables the ability to use a backslash (\ ) to escape special characters within the search string. Disabling whitespace is an advanced option that prevents the parser from tokenizing on whitespace, which can be useful for Vietnamese. (It prevents Vietnamese words from being split incorrectly.) For example, you could disable all operators other than the phrase operator to support just simple term and phrase queries: 'operators':['and','not','or', 'prefix'] . Valid values: and , escape , fuzzy , near , not , or , phrase , precedence , prefix , whitespace . Default: All operators and special characters are enabled. Valid for: simple .
phraseFields : An array of the text or text-array fields you want to use for phrase searches. When the terms in the search string appear in close proximity within a field, the field scores higher. You can specify a weight for each field to boost that score. The phraseSlop option controls how much the matches can deviate from the search string and still be boosted. To specify a field weight, append a caret (^ ) symbol and the weight to the field name. For example, to boost phrase matches in the title field over the abstract field, you could specify: 'phraseFields':['title^3', 'plot'] Valid values: The name of any text or text-array field and an optional numeric value greater than zero. Default: No fields. If you don't specify any fields with phraseFields , proximity scoring is disabled even if phraseSlop is specified. Valid for: dismax .
phraseSlop : An integer value that specifies how much matches can deviate from the search phrase and still be boosted according to the weights specified in the phraseFields option; for example, phraseSlop: 2 . You must also specify phraseFields to enable proximity scoring. Valid values: positive integers. Default: 0. Valid for: dismax .
explicitPhraseSlop : An integer value that specifies how much a match can deviate from the search phrase when the phrase is enclosed in double quotes in the search string. (Phrases that exceed this proximity distance are not considered a match.) For example, to specify a slop of three for dismax phrase queries, you would specify 'explicitPhraseSlop':3 . Valid values: positive integers. Default: 0. Valid for: dismax .
tieBreaker : When a term in the search string is found in a document's field, a score is calculated for that field based on how common the word is in that field compared to other documents. If the term occurs in multiple fields within a document, by default only the highest scoring field contributes to the document's overall score. You can specify a tieBreaker value to enable the matches in lower-scoring fields to contribute to the document's score. That way, if two documents have the same max field score for a particular term, the score for the document that has matches in more fields will be higher. The formula for calculating the score with a tieBreaker is (max field score) + (tieBreaker) * (sum of the scores for the rest of the matching fields) . Set tieBreaker to 0 to disregard all but the highest scoring field (pure max): 'tieBreaker':0 . Set to 1 to sum the scores from all fields (pure sum): 'tieBreaker':1 . Valid values: 0.0 to 1.0. Default: 0.0. Valid for: dismax .
:type queryParser: string
:param queryParser: Specifies which query parser to use to process the request. If queryParser is not specified, Amazon CloudSearch uses the simple query parser.
Amazon CloudSearch supports four query parsers:
simple : perform simple searches of text and text-array fields. By default, the simple query parser searches all text and text-array fields. You can specify which fields to search by with the queryOptions parameter. If you prefix a search term with a plus sign (+) documents must contain the term to be considered a match. (This is the default, unless you configure the default operator with the queryOptions parameter.) You can use the - (NOT), | (OR), and * (wildcard) operators to exclude particular terms, find results that match any of the specified terms, or search for a prefix. To search for a phrase rather than individual terms, enclose the phrase in double quotes. For more information, see Searching for Text in the Amazon CloudSearch Developer Guide .
structured : perform advanced searches by combining multiple expressions to define the search criteria. You can also search within particular fields, search for values and ranges of values, and use advanced options such as term boosting, matchall , and near . For more information, see Constructing Compound Queries in the Amazon CloudSearch Developer Guide .
lucene : search using the Apache Lucene query parser syntax. For more information, see Apache Lucene Query Parser Syntax .
dismax : search using the simplified subset of the Apache Lucene query parser syntax defined by the DisMax query parser. For more information, see DisMax Query Parser Syntax .
:type returnFields: string
:param returnFields: Specifies the field and expression values to include in the response. Multiple fields or expressions are specified as a comma-separated list. By default, a search response includes all return enabled fields (_all_fields ). To return only the document IDs for the matching documents, specify _no_fields . To retrieve the relevance score calculated for each document, specify _score .
:type size: integer
:param size: Specifies the maximum number of search hits to include in the response.
:type sort: string
:param sort: Specifies the fields or custom expressions to use to sort the search results. Multiple fields or expressions are specified as a comma-separated list. You must specify the sort direction (asc or desc ) for each field; for example, year desc,title asc . To use a field to sort results, the field must be sort-enabled in the domain configuration. Array type fields cannot be used for sorting. If no sort parameter is specified, results are sorted by their default relevance scores in descending order: _score desc . You can also sort by document ID (_id asc ) and version (_version desc ).
For more information, see Sorting Results in the Amazon CloudSearch Developer Guide .
:type start: integer
:param start: Specifies the offset of the first search hit you want to return. Note that the result set is zero-based; the first result is at index 0. You can specify either the start or cursor parameter in a request, they are mutually exclusive.
For more information, see Paginating Results in the Amazon CloudSearch Developer Guide .
:type stats: string
:param stats: Specifies one or more fields for which to get statistics information. Each specified field must be facet-enabled in the domain configuration. The fields are specified in JSON using the form:
{'FIELD-A':{},'FIELD-B':{}}
There are currently no options supported for statistics.
:rtype: dict
:return: {
'status': {
'timems': 123,
'rid': 'string'
},
'hits': {
'found': 123,
'start': 123,
'cursor': 'string',
'hit': [
{
'id': 'string',
'fields': {
'string': [
'string',
]
},
'exprs': {
'string': 'string'
},
'highlights': {
'string': 'string'
}
},
]
},
'facets': {
'string': {
'buckets': [
{
'value': 'string',
'count': 123
},
]
}
},
'stats': {
'string': {
'min': 'string',
'max': 'string',
'count': 123,
'missing': 123,
'sum': 123.0,
'sumOfSquares': 123.0,
'mean': 'string',
'stddev': 123.0
}
}
}
:returns:
cursor (string) -- Retrieves a cursor value you can use to page through large result sets. Use the size parameter to control the number of hits to include in each response. You can specify either the cursor or start parameter in a request; they are mutually exclusive. To get the first cursor, set the cursor value to initial . In subsequent requests, specify the cursor value returned in the hits section of the response.
For more information, see Paginating Results in the Amazon CloudSearch Developer Guide .
expr (string) -- Defines one or more numeric expressions that can be used to sort results or specify search or filter criteria. You can also specify expressions as return fields.
You specify the expressions in JSON using the form {"EXPRESSIONNAME":"EXPRESSION"} . You can define and use multiple expressions in a search request. For example:
{"expression1":"_score*rating", "expression2":"(1/rank)*year"}
For information about the variables, operators, and functions you can use in expressions, see Writing Expressions in the Amazon CloudSearch Developer Guide .
facet (string) -- Specifies one or more fields for which to get facet information, and options that control how the facet information is returned. Each specified field must be facet-enabled in the domain configuration. The fields and options are specified in JSON using the form {"FIELD":{"OPTION":VALUE,"OPTION:"STRING"},"FIELD":{"OPTION":VALUE,"OPTION":"STRING"}} .
You can specify the following faceting options:
buckets specifies an array of the facet values or ranges to count. Ranges are specified using the same syntax that you use to search for a range of values. For more information, see Searching for a Range of Values in the Amazon CloudSearch Developer Guide . Buckets are returned in the order they are specified in the request. The sort and size options are not valid if you specify buckets .
size specifies the maximum number of facets to include in the results. By default, Amazon CloudSearch returns counts for the top 10. The size parameter is only valid when you specify the sort option; it cannot be used in conjunction with buckets .
sort specifies how you want to sort the facets in the results: bucket or count . Specify bucket to sort alphabetically or numerically by facet value (in ascending order). Specify count to sort by the facet counts computed for each facet value (in descending order). To retrieve facet counts for particular values or ranges of values, use the buckets option instead of sort .
If no facet options are specified, facet counts are computed for all field values, the facets are sorted by facet count, and the top 10 facets are returned in the results.
To count particular buckets of values, use the buckets option. For example, the following request uses the buckets option to calculate and return facet counts by decade.
{"year":{"buckets":["[1970,1979]","[1980,1989]","[1990,1999]","[2000,2009]","[2010,}"]}}
To sort facets by facet count, use the count option. For example, the following request sets the sort option to count to sort the facet values by facet count, with the facet values that have the most matching documents listed first. Setting the size option to 3 returns only the top three facet values.
{"year":{"sort":"count","size":3}}
To sort the facets by value, use the bucket option. For example, the following request sets the sort option to bucket to sort the facet values numerically by year, with earliest year listed first.
{"year":{"sort":"bucket"}}
For more information, see Getting and Using Facet Information in the Amazon CloudSearch Developer Guide .
filterQuery (string) -- Specifies a structured query that filters the results of a search without affecting how the results are scored and sorted. You use filterQuery in conjunction with the query parameter to filter the documents that match the constraints specified in the query parameter. Specifying a filter controls only which matching documents are included in the results, it has no effect on how they are scored and sorted. The filterQuery parameter supports the full structured query syntax.
For more information about using filters, see Filtering Matching Documents in the Amazon CloudSearch Developer Guide .
highlight (string) -- Retrieves highlights for matches in the specified text or text-array fields. Each specified field must be highlight enabled in the domain configuration. The fields and options are specified in JSON using the form {"FIELD":{"OPTION":VALUE,"OPTION:"STRING"},"FIELD":{"OPTION":VALUE,"OPTION":"STRING"}} .
You can specify the following highlight options:
format : specifies the format of the data in the text field: text or html . When data is returned as HTML, all non-alphanumeric characters are encoded. The default is html .
max_phrases : specifies the maximum number of occurrences of the search term(s) you want to highlight. By default, the first occurrence is highlighted.
pre_tag : specifies the string to prepend to an occurrence of a search term. The default for HTML highlights is lt;emgt; . The default for text highlights is * .
post_tag : specifies the string to append to an occurrence of a search term. The default for HTML highlights is lt;/emgt; . The default for text highlights is * .
If no highlight options are specified for a field, the returned field text is treated as HTML and the first match is highlighted with emphasis tags: lt;emsearch-termlt;/emgt; .
For example, the following request retrieves highlights for the actors and title fields.
{ "actors": {}, "title": {"format": "text","max_phrases": 2,"pre_tag": "**","post_tag": "** "} }
partial (boolean) -- Enables partial results to be returned if one or more index partitions are unavailable. When your search index is partitioned across multiple search instances, by default Amazon CloudSearch only returns results if every partition can be queried. This means that the failure of a single search instance can result in 5xx (internal server) errors. When you enable partial results, Amazon CloudSearch returns whatever results are available and includes the percentage of documents searched in the search results (percent-searched). This enables you to more gracefully degrade your users' search experience. For example, rather than displaying no results, you could display the partial results and a message indicating that the results might be incomplete due to a temporary system outage.
query (string) -- [REQUIRED]
Specifies the search criteria for the request. How you specify the search criteria depends on the query parser used for the request and the parser options specified in the queryOptions parameter. By default, the simple query parser is used to process requests. To use the structured , lucene , or dismax query parser, you must also specify the queryParser parameter.
For more information about specifying search criteria, see Searching Your Data in the Amazon CloudSearch Developer Guide .
queryOptions (string) -- Configures options for the query parser specified in the queryParser parameter. You specify the options in JSON using the following form {"OPTION1":"VALUE1","OPTION2":VALUE2"..."OPTIONN":"VALUEN"}.
The options you can configure vary according to which parser you use:
defaultOperator : The default operator used to combine individual terms in the search string. For example: defaultOperator: 'or' . For the dismax parser, you specify a percentage that represents the percentage of terms in the search string (rounded down) that must match, rather than a default operator. A value of 0% is the equivalent to OR, and a value of 100% is equivalent to AND. The percentage must be specified as a value in the range 0-100 followed by the percent (%) symbol. For example, defaultOperator: 50% . Valid values: and , or , a percentage in the range 0%-100% (dismax ). Default: and (simple , structured , lucene ) or 100 (dismax ). Valid for: simple , structured , lucene , and dismax .
fields : An array of the fields to search when no fields are specified in a search. If no fields are specified in a search and this option is not specified, all text and text-array fields are searched. You can specify a weight for each field to control the relative importance of each field when Amazon CloudSearch calculates relevance scores. To specify a field weight, append a caret (^ ) symbol and the weight to the field name. For example, to boost the importance of the title field over the description field you could specify: "fields":["title^5","description"] . Valid values: The name of any configured field and an optional numeric value greater than zero. Default: All text and text-array fields. Valid for: simple , structured , lucene , and dismax .
operators : An array of the operators or special characters you want to disable for the simple query parser. If you disable the and , or , or not operators, the corresponding operators (+ , | , - ) have no special meaning and are dropped from the search string. Similarly, disabling prefix disables the wildcard operator (* ) and disabling phrase disables the ability to search for phrases by enclosing phrases in double quotes. Disabling precedence disables the ability to control order of precedence using parentheses. Disabling near disables the ability to use the ~ operator to perform a sloppy phrase search. Disabling the fuzzy operator disables the ability to use the ~ operator to perform a fuzzy search. escape disables the ability to use a backslash (\ ) to escape special characters within the search string. Disabling whitespace is an advanced option that prevents the parser from tokenizing on whitespace, which can be useful for Vietnamese. (It prevents Vietnamese words from being split incorrectly.) For example, you could disable all operators other than the phrase operator to support just simple term and phrase queries: "operators":["and","not","or", "prefix"] . Valid values: and , escape , fuzzy , near , not , or , phrase , precedence , prefix , whitespace . Default: All operators and special characters are enabled. Valid for: simple .
phraseFields : An array of the text or text-array fields you want to use for phrase searches. When the terms in the search string appear in close proximity within a field, the field scores higher. You can specify a weight for each field to boost that score. The phraseSlop option controls how much the matches can deviate from the search string and still be boosted. To specify a field weight, append a caret (^ ) symbol and the weight to the field name. For example, to boost phrase matches in the title field over the abstract field, you could specify: "phraseFields":["title^3", "plot"] Valid values: The name of any text or text-array field and an optional numeric value greater than zero. Default: No fields. If you don't specify any fields with phraseFields , proximity scoring is disabled even if phraseSlop is specified. Valid for: dismax .
phraseSlop : An integer value that specifies how much matches can deviate from the search phrase and still be boosted according to the weights specified in the phraseFields option; for example, phraseSlop: 2 . You must also specify phraseFields to enable proximity scoring. Valid values: positive integers. Default: 0. Valid for: dismax .
explicitPhraseSlop : An integer value that specifies how much a match can deviate from the search phrase when the phrase is enclosed in double quotes in the search string. (Phrases that exceed this proximity distance are not considered a match.) For example, to specify a slop of three for dismax phrase queries, you would specify "explicitPhraseSlop":3 . Valid values: positive integers. Default: 0. Valid for: dismax .
tieBreaker : When a term in the search string is found in a document's field, a score is calculated for that field based on how common the word is in that field compared to other documents. If the term occurs in multiple fields within a document, by default only the highest scoring field contributes to the document's overall score. You can specify a tieBreaker value to enable the matches in lower-scoring fields to contribute to the document's score. That way, if two documents have the same max field score for a particular term, the score for the document that has matches in more fields will be higher. The formula for calculating the score with a tieBreaker is (max field score) + (tieBreaker) * (sum of the scores for the rest of the matching fields) . Set tieBreaker to 0 to disregard all but the highest scoring field (pure max): "tieBreaker":0 . Set to 1 to sum the scores from all fields (pure sum): "tieBreaker":1 . Valid values: 0.0 to 1.0. Default: 0.0. Valid for: dismax .
queryParser (string) -- Specifies which query parser to use to process the request. If queryParser is not specified, Amazon CloudSearch uses the simple query parser.
Amazon CloudSearch supports four query parsers:
simple : perform simple searches of text and text-array fields. By default, the simple query parser searches all text and text-array fields. You can specify which fields to search by with the queryOptions parameter. If you prefix a search term with a plus sign (+) documents must contain the term to be considered a match. (This is the default, unless you configure the default operator with the queryOptions parameter.) You can use the - (NOT), | (OR), and * (wildcard) operators to exclude particular terms, find results that match any of the specified terms, or search for a prefix. To search for a phrase rather than individual terms, enclose the phrase in double quotes. For more information, see Searching for Text in the Amazon CloudSearch Developer Guide .
structured : perform advanced searches by combining multiple expressions to define the search criteria. You can also search within particular fields, search for values and ranges of values, and use advanced options such as term boosting, matchall , and near . For more information, see Constructing Compound Queries in the Amazon CloudSearch Developer Guide .
lucene : search using the Apache Lucene query parser syntax. For more information, see Apache Lucene Query Parser Syntax .
dismax : search using the simplified subset of the Apache Lucene query parser syntax defined by the DisMax query parser. For more information, see DisMax Query Parser Syntax .
returnFields (string) -- Specifies the field and expression values to include in the response. Multiple fields or expressions are specified as a comma-separated list. By default, a search response includes all return enabled fields (_all_fields ). To return only the document IDs for the matching documents, specify _no_fields . To retrieve the relevance score calculated for each document, specify _score .
size (integer) -- Specifies the maximum number of search hits to include in the response.
sort (string) -- Specifies the fields or custom expressions to use to sort the search results. Multiple fields or expressions are specified as a comma-separated list. You must specify the sort direction (asc or desc ) for each field; for example, year desc,title asc . To use a field to sort results, the field must be sort-enabled in the domain configuration. Array type fields cannot be used for sorting. If no sort parameter is specified, results are sorted by their default relevance scores in descending order: _score desc . You can also sort by document ID (_id asc ) and version (_version desc ).
For more information, see Sorting Results in the Amazon CloudSearch Developer Guide .
start (integer) -- Specifies the offset of the first search hit you want to return. Note that the result set is zero-based; the first result is at index 0. You can specify either the start or cursor parameter in a request, they are mutually exclusive.
For more information, see Paginating Results in the Amazon CloudSearch Developer Guide .
stats (string) -- Specifies one or more fields for which to get statistics information. Each specified field must be facet-enabled in the domain configuration. The fields are specified in JSON using the form:
{"FIELD-A":{},"FIELD-B":{}}
There are currently no options supported for statistics. | entailment |
def clone_stack(SourceStackId=None, Name=None, Region=None, VpcId=None, Attributes=None, ServiceRoleArn=None, DefaultInstanceProfileArn=None, DefaultOs=None, HostnameTheme=None, DefaultAvailabilityZone=None, DefaultSubnetId=None, CustomJson=None, ConfigurationManager=None, ChefConfiguration=None, UseCustomCookbooks=None, UseOpsworksSecurityGroups=None, CustomCookbooksSource=None, DefaultSshKeyName=None, ClonePermissions=None, CloneAppIds=None, DefaultRootDeviceType=None, AgentVersion=None):
"""
Creates a clone of a specified stack. For more information, see Clone a Stack . By default, all parameters are set to the values used by the parent stack.
See also: AWS API Documentation
:example: response = client.clone_stack(
SourceStackId='string',
Name='string',
Region='string',
VpcId='string',
Attributes={
'string': 'string'
},
ServiceRoleArn='string',
DefaultInstanceProfileArn='string',
DefaultOs='string',
HostnameTheme='string',
DefaultAvailabilityZone='string',
DefaultSubnetId='string',
CustomJson='string',
ConfigurationManager={
'Name': 'string',
'Version': 'string'
},
ChefConfiguration={
'ManageBerkshelf': True|False,
'BerkshelfVersion': 'string'
},
UseCustomCookbooks=True|False,
UseOpsworksSecurityGroups=True|False,
CustomCookbooksSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
DefaultSshKeyName='string',
ClonePermissions=True|False,
CloneAppIds=[
'string',
],
DefaultRootDeviceType='ebs'|'instance-store',
AgentVersion='string'
)
:type SourceStackId: string
:param SourceStackId: [REQUIRED]
The source stack ID.
:type Name: string
:param Name: The cloned stack name.
:type Region: string
:param Region: The cloned stack AWS region, such as 'ap-northeast-2'. For more information about AWS regions, see Regions and Endpoints .
:type VpcId: string
:param VpcId: The ID of the VPC that the cloned stack is to be launched into. It must be in the specified region. All instances are launched into this VPC, and you cannot change the ID later.
If your account supports EC2 Classic, the default value is no VPC.
If your account does not support EC2 Classic, the default value is the default VPC for the specified region.
If the VPC ID corresponds to a default VPC and you have specified either the DefaultAvailabilityZone or the DefaultSubnetId parameter only, AWS OpsWorks Stacks infers the value of the other parameter. If you specify neither parameter, AWS OpsWorks Stacks sets these parameters to the first valid Availability Zone for the specified region and the corresponding default VPC subnet ID, respectively.
If you specify a nondefault VPC ID, note the following:
It must belong to a VPC in your account that is in the specified region.
You must specify a value for DefaultSubnetId .
For more information on how to use AWS OpsWorks Stacks with a VPC, see Running a Stack in a VPC . For more information on default VPC and EC2 Classic, see Supported Platforms .
:type Attributes: dict
:param Attributes: A list of stack attributes and values as key/value pairs to be added to the cloned stack.
(string) --
(string) --
:type ServiceRoleArn: string
:param ServiceRoleArn: [REQUIRED]
The stack AWS Identity and Access Management (IAM) role, which allows AWS OpsWorks Stacks to work with AWS resources on your behalf. You must set this parameter to the Amazon Resource Name (ARN) for an existing IAM role. If you create a stack by using the AWS OpsWorks Stacks console, it creates the role for you. You can obtain an existing stack's IAM ARN programmatically by calling DescribePermissions . For more information about IAM ARNs, see Using Identifiers .
Note
You must set this parameter to a valid service role ARN or the action will fail; there is no default value. You can specify the source stack's service role ARN, if you prefer, but you must do so explicitly.
:type DefaultInstanceProfileArn: string
:param DefaultInstanceProfileArn: The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type DefaultOs: string
:param DefaultOs: The stack's operating system, which must be set to one of the following.
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
A custom AMI: Custom . You specify the custom AMI you want to use when you create instances. For more information on how to use custom AMIs with OpsWorks, see Using Custom AMIs .
The default option is the parent stack's operating system. For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
Note
You can specify a different Linux operating system for the cloned stack, but you cannot change from Linux to Windows or Windows to Linux.
:type HostnameTheme: string
:param HostnameTheme: The stack's host name theme, with spaces are replaced by underscores. The theme is used to generate host names for the stack's instances. By default, HostnameTheme is set to Layer_Dependent , which creates host names by appending integers to the layer's short name. The other themes are:
Baked_Goods
Clouds
Europe_Cities
Fruits
Greek_Deities
Legendary_creatures_from_Japan
Planets_and_Moons
Roman_Deities
Scottish_Islands
US_Cities
Wild_Cats
To obtain a generated host name, call GetHostNameSuggestion , which returns a host name based on the current theme.
:type DefaultAvailabilityZone: string
:param DefaultAvailabilityZone: The cloned stack's default Availability Zone, which must be in the specified region. For more information, see Regions and Endpoints . If you also specify a value for DefaultSubnetId , the subnet must be in the same zone. For more information, see the VpcId parameter description.
:type DefaultSubnetId: string
:param DefaultSubnetId: The stack's default VPC subnet ID. This parameter is required if you specify a value for the VpcId parameter. All instances are launched into this subnet unless you specify otherwise when you create the instance. If you also specify a value for DefaultAvailabilityZone , the subnet must be in that zone. For information on default values and when this parameter is required, see the VpcId parameter description.
:type CustomJson: string
:param CustomJson: A string that contains user-defined, custom JSON. It is used to override the corresponding default stack configuration JSON values. The string should be in the following format:
'{\'key1\': \'value1\', \'key2\': \'value2\',...}'
For more information on custom JSON, see Use Custom JSON to Modify the Stack Configuration Attributes
:type ConfigurationManager: dict
:param ConfigurationManager: The configuration manager. When you clone a stack we recommend that you use the configuration manager to specify the Chef version: 12, 11.10, or 11.4 for Linux stacks, or 12.2 for Windows stacks. The default value for Linux stacks is currently 12.
Name (string) --The name. This parameter must be set to 'Chef'.
Version (string) --The Chef version. This parameter must be set to 12, 11.10, or 11.4 for Linux stacks, and to 12.2 for Windows stacks. The default value for Linux stacks is 11.4.
:type ChefConfiguration: dict
:param ChefConfiguration: A ChefConfiguration object that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .
ManageBerkshelf (boolean) --Whether to enable Berkshelf.
BerkshelfVersion (string) --The Berkshelf version.
:type UseCustomCookbooks: boolean
:param UseCustomCookbooks: Whether to use custom cookbooks.
:type UseOpsworksSecurityGroups: boolean
:param UseOpsworksSecurityGroups: Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.
AWS OpsWorks Stacks provides a standard set of built-in security groups, one for each layer, which are associated with layers by default. With UseOpsworksSecurityGroups you can instead provide your own custom security groups. UseOpsworksSecurityGroups has the following settings:
True - AWS OpsWorks Stacks automatically associates the appropriate built-in security group with each layer (default setting). You can associate additional security groups with a layer after you create it but you cannot delete the built-in security group.
False - AWS OpsWorks Stacks does not associate built-in security groups with layers. You must create appropriate Amazon Elastic Compute Cloud (Amazon EC2) security groups and associate a security group with each layer that you create. However, you can still manually associate a built-in security group with a layer on creation; custom security groups are required only for those layers that need custom settings.
For more information, see Create a New Stack .
:type CustomCookbooksSource: dict
:param CustomCookbooksSource: Contains the information required to retrieve an app or cookbook from a repository. For more information, see Creating Apps or Custom Recipes and Cookbooks .
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type DefaultSshKeyName: string
:param DefaultSshKeyName: A default Amazon EC2 key pair name. The default value is none. If you specify a key pair name, AWS OpsWorks installs the public key on the instance and you can use the private key with an SSH client to log in to the instance. For more information, see Using SSH to Communicate with an Instance and Managing SSH Access . You can override this setting by specifying a different key pair, or no key pair, when you create an instance .
:type ClonePermissions: boolean
:param ClonePermissions: Whether to clone the source stack's permissions.
:type CloneAppIds: list
:param CloneAppIds: A list of source stack app IDs to be included in the cloned stack.
(string) --
:type DefaultRootDeviceType: string
:param DefaultRootDeviceType: The default root device type. This value is used by default for all instances in the cloned stack, but you can override it when you create an instance. For more information, see Storage for the Root Device .
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
Auto-update - Set this parameter to LATEST . AWS OpsWorks Stacks automatically installs new agent versions on the stack's instances as soon as they are available.
Fixed version - Set this parameter to your preferred agent version. To update the agent version, you must edit the stack configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the stack's instances.
The default setting is LATEST . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.
Note
You can also specify an agent version when you create or update an instance, which overrides the stack's default setting.
:rtype: dict
:return: {
'StackId': 'string'
}
"""
pass | Creates a clone of a specified stack. For more information, see Clone a Stack . By default, all parameters are set to the values used by the parent stack.
See also: AWS API Documentation
:example: response = client.clone_stack(
SourceStackId='string',
Name='string',
Region='string',
VpcId='string',
Attributes={
'string': 'string'
},
ServiceRoleArn='string',
DefaultInstanceProfileArn='string',
DefaultOs='string',
HostnameTheme='string',
DefaultAvailabilityZone='string',
DefaultSubnetId='string',
CustomJson='string',
ConfigurationManager={
'Name': 'string',
'Version': 'string'
},
ChefConfiguration={
'ManageBerkshelf': True|False,
'BerkshelfVersion': 'string'
},
UseCustomCookbooks=True|False,
UseOpsworksSecurityGroups=True|False,
CustomCookbooksSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
DefaultSshKeyName='string',
ClonePermissions=True|False,
CloneAppIds=[
'string',
],
DefaultRootDeviceType='ebs'|'instance-store',
AgentVersion='string'
)
:type SourceStackId: string
:param SourceStackId: [REQUIRED]
The source stack ID.
:type Name: string
:param Name: The cloned stack name.
:type Region: string
:param Region: The cloned stack AWS region, such as 'ap-northeast-2'. For more information about AWS regions, see Regions and Endpoints .
:type VpcId: string
:param VpcId: The ID of the VPC that the cloned stack is to be launched into. It must be in the specified region. All instances are launched into this VPC, and you cannot change the ID later.
If your account supports EC2 Classic, the default value is no VPC.
If your account does not support EC2 Classic, the default value is the default VPC for the specified region.
If the VPC ID corresponds to a default VPC and you have specified either the DefaultAvailabilityZone or the DefaultSubnetId parameter only, AWS OpsWorks Stacks infers the value of the other parameter. If you specify neither parameter, AWS OpsWorks Stacks sets these parameters to the first valid Availability Zone for the specified region and the corresponding default VPC subnet ID, respectively.
If you specify a nondefault VPC ID, note the following:
It must belong to a VPC in your account that is in the specified region.
You must specify a value for DefaultSubnetId .
For more information on how to use AWS OpsWorks Stacks with a VPC, see Running a Stack in a VPC . For more information on default VPC and EC2 Classic, see Supported Platforms .
:type Attributes: dict
:param Attributes: A list of stack attributes and values as key/value pairs to be added to the cloned stack.
(string) --
(string) --
:type ServiceRoleArn: string
:param ServiceRoleArn: [REQUIRED]
The stack AWS Identity and Access Management (IAM) role, which allows AWS OpsWorks Stacks to work with AWS resources on your behalf. You must set this parameter to the Amazon Resource Name (ARN) for an existing IAM role. If you create a stack by using the AWS OpsWorks Stacks console, it creates the role for you. You can obtain an existing stack's IAM ARN programmatically by calling DescribePermissions . For more information about IAM ARNs, see Using Identifiers .
Note
You must set this parameter to a valid service role ARN or the action will fail; there is no default value. You can specify the source stack's service role ARN, if you prefer, but you must do so explicitly.
:type DefaultInstanceProfileArn: string
:param DefaultInstanceProfileArn: The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type DefaultOs: string
:param DefaultOs: The stack's operating system, which must be set to one of the following.
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
A custom AMI: Custom . You specify the custom AMI you want to use when you create instances. For more information on how to use custom AMIs with OpsWorks, see Using Custom AMIs .
The default option is the parent stack's operating system. For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
Note
You can specify a different Linux operating system for the cloned stack, but you cannot change from Linux to Windows or Windows to Linux.
:type HostnameTheme: string
:param HostnameTheme: The stack's host name theme, with spaces are replaced by underscores. The theme is used to generate host names for the stack's instances. By default, HostnameTheme is set to Layer_Dependent , which creates host names by appending integers to the layer's short name. The other themes are:
Baked_Goods
Clouds
Europe_Cities
Fruits
Greek_Deities
Legendary_creatures_from_Japan
Planets_and_Moons
Roman_Deities
Scottish_Islands
US_Cities
Wild_Cats
To obtain a generated host name, call GetHostNameSuggestion , which returns a host name based on the current theme.
:type DefaultAvailabilityZone: string
:param DefaultAvailabilityZone: The cloned stack's default Availability Zone, which must be in the specified region. For more information, see Regions and Endpoints . If you also specify a value for DefaultSubnetId , the subnet must be in the same zone. For more information, see the VpcId parameter description.
:type DefaultSubnetId: string
:param DefaultSubnetId: The stack's default VPC subnet ID. This parameter is required if you specify a value for the VpcId parameter. All instances are launched into this subnet unless you specify otherwise when you create the instance. If you also specify a value for DefaultAvailabilityZone , the subnet must be in that zone. For information on default values and when this parameter is required, see the VpcId parameter description.
:type CustomJson: string
:param CustomJson: A string that contains user-defined, custom JSON. It is used to override the corresponding default stack configuration JSON values. The string should be in the following format:
'{\'key1\': \'value1\', \'key2\': \'value2\',...}'
For more information on custom JSON, see Use Custom JSON to Modify the Stack Configuration Attributes
:type ConfigurationManager: dict
:param ConfigurationManager: The configuration manager. When you clone a stack we recommend that you use the configuration manager to specify the Chef version: 12, 11.10, or 11.4 for Linux stacks, or 12.2 for Windows stacks. The default value for Linux stacks is currently 12.
Name (string) --The name. This parameter must be set to 'Chef'.
Version (string) --The Chef version. This parameter must be set to 12, 11.10, or 11.4 for Linux stacks, and to 12.2 for Windows stacks. The default value for Linux stacks is 11.4.
:type ChefConfiguration: dict
:param ChefConfiguration: A ChefConfiguration object that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .
ManageBerkshelf (boolean) --Whether to enable Berkshelf.
BerkshelfVersion (string) --The Berkshelf version.
:type UseCustomCookbooks: boolean
:param UseCustomCookbooks: Whether to use custom cookbooks.
:type UseOpsworksSecurityGroups: boolean
:param UseOpsworksSecurityGroups: Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.
AWS OpsWorks Stacks provides a standard set of built-in security groups, one for each layer, which are associated with layers by default. With UseOpsworksSecurityGroups you can instead provide your own custom security groups. UseOpsworksSecurityGroups has the following settings:
True - AWS OpsWorks Stacks automatically associates the appropriate built-in security group with each layer (default setting). You can associate additional security groups with a layer after you create it but you cannot delete the built-in security group.
False - AWS OpsWorks Stacks does not associate built-in security groups with layers. You must create appropriate Amazon Elastic Compute Cloud (Amazon EC2) security groups and associate a security group with each layer that you create. However, you can still manually associate a built-in security group with a layer on creation; custom security groups are required only for those layers that need custom settings.
For more information, see Create a New Stack .
:type CustomCookbooksSource: dict
:param CustomCookbooksSource: Contains the information required to retrieve an app or cookbook from a repository. For more information, see Creating Apps or Custom Recipes and Cookbooks .
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type DefaultSshKeyName: string
:param DefaultSshKeyName: A default Amazon EC2 key pair name. The default value is none. If you specify a key pair name, AWS OpsWorks installs the public key on the instance and you can use the private key with an SSH client to log in to the instance. For more information, see Using SSH to Communicate with an Instance and Managing SSH Access . You can override this setting by specifying a different key pair, or no key pair, when you create an instance .
:type ClonePermissions: boolean
:param ClonePermissions: Whether to clone the source stack's permissions.
:type CloneAppIds: list
:param CloneAppIds: A list of source stack app IDs to be included in the cloned stack.
(string) --
:type DefaultRootDeviceType: string
:param DefaultRootDeviceType: The default root device type. This value is used by default for all instances in the cloned stack, but you can override it when you create an instance. For more information, see Storage for the Root Device .
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
Auto-update - Set this parameter to LATEST . AWS OpsWorks Stacks automatically installs new agent versions on the stack's instances as soon as they are available.
Fixed version - Set this parameter to your preferred agent version. To update the agent version, you must edit the stack configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the stack's instances.
The default setting is LATEST . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.
Note
You can also specify an agent version when you create or update an instance, which overrides the stack's default setting.
:rtype: dict
:return: {
'StackId': 'string'
} | entailment |
def create_app(StackId=None, Shortname=None, Name=None, Description=None, DataSources=None, Type=None, AppSource=None, Domains=None, EnableSsl=None, SslConfiguration=None, Attributes=None, Environment=None):
"""
Creates an app for a specified stack. For more information, see Creating Apps .
See also: AWS API Documentation
:example: response = client.create_app(
StackId='string',
Shortname='string',
Name='string',
Description='string',
DataSources=[
{
'Type': 'string',
'Arn': 'string',
'DatabaseName': 'string'
},
],
Type='aws-flow-ruby'|'java'|'rails'|'php'|'nodejs'|'static'|'other',
AppSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
Domains=[
'string',
],
EnableSsl=True|False,
SslConfiguration={
'Certificate': 'string',
'PrivateKey': 'string',
'Chain': 'string'
},
Attributes={
'string': 'string'
},
Environment=[
{
'Key': 'string',
'Value': 'string',
'Secure': True|False
},
]
)
:type StackId: string
:param StackId: [REQUIRED]
The stack ID.
:type Shortname: string
:param Shortname: The app's short name.
:type Name: string
:param Name: [REQUIRED]
The app name.
:type Description: string
:param Description: A description of the app.
:type DataSources: list
:param DataSources: The app's data source.
(dict) --Describes an app's data source.
Type (string) --The data source's type, AutoSelectOpsworksMysqlInstance , OpsworksMysqlInstance , or RdsDbInstance .
Arn (string) --The data source's ARN.
DatabaseName (string) --The database name.
:type Type: string
:param Type: [REQUIRED]
The app type. Each supported type is associated with a particular layer. For example, PHP applications are associated with a PHP layer. AWS OpsWorks Stacks deploys an application to those instances that are members of the corresponding layer. If your app isn't one of the standard types, or you prefer to implement your own Deploy recipes, specify other .
:type AppSource: dict
:param AppSource: A Source object that specifies the app repository.
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type Domains: list
:param Domains: The app virtual host settings, with multiple domains separated by commas. For example: 'www.example.com, example.com'
(string) --
:type EnableSsl: boolean
:param EnableSsl: Whether to enable SSL for the app.
:type SslConfiguration: dict
:param SslConfiguration: An SslConfiguration object with the SSL configuration.
Certificate (string) -- [REQUIRED]The contents of the certificate's domain.crt file.
PrivateKey (string) -- [REQUIRED]The private key; the contents of the certificate's domain.kex file.
Chain (string) --Optional. Can be used to specify an intermediate certificate authority key or client authentication.
:type Attributes: dict
:param Attributes: One or more user-defined key/value pairs to be added to the stack attributes.
(string) --
(string) --
:type Environment: list
:param Environment: An array of EnvironmentVariable objects that specify environment variables to be associated with the app. After you deploy the app, these variables are defined on the associated app server instance. For more information, see Environment Variables .
There is no specific limit on the number of environment variables. However, the size of the associated data structure - which includes the variables' names, values, and protected flag values - cannot exceed 10 KB (10240 Bytes). This limit should accommodate most if not all use cases. Exceeding it will cause an exception with the message, 'Environment: is too large (maximum is 10KB).'
Note
This parameter is supported only by Chef 11.10 stacks. If you have specified one or more environment variables, you cannot modify the stack's Chef version.
(dict) --Represents an app's environment variable.
Key (string) -- [REQUIRED](Required) The environment variable's name, which can consist of up to 64 characters and must be specified. The name can contain upper- and lowercase letters, numbers, and underscores (_), but it must start with a letter or underscore.
Value (string) -- [REQUIRED](Optional) The environment variable's value, which can be left empty. If you specify a value, it can contain up to 256 characters, which must all be printable.
Secure (boolean) --(Optional) Whether the variable's value will be returned by the DescribeApps action. To conceal an environment variable's value, set Secure to true . DescribeApps then returns *****FILTERED***** instead of the actual value. The default value for Secure is false .
:rtype: dict
:return: {
'AppId': 'string'
}
"""
pass | Creates an app for a specified stack. For more information, see Creating Apps .
See also: AWS API Documentation
:example: response = client.create_app(
StackId='string',
Shortname='string',
Name='string',
Description='string',
DataSources=[
{
'Type': 'string',
'Arn': 'string',
'DatabaseName': 'string'
},
],
Type='aws-flow-ruby'|'java'|'rails'|'php'|'nodejs'|'static'|'other',
AppSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
Domains=[
'string',
],
EnableSsl=True|False,
SslConfiguration={
'Certificate': 'string',
'PrivateKey': 'string',
'Chain': 'string'
},
Attributes={
'string': 'string'
},
Environment=[
{
'Key': 'string',
'Value': 'string',
'Secure': True|False
},
]
)
:type StackId: string
:param StackId: [REQUIRED]
The stack ID.
:type Shortname: string
:param Shortname: The app's short name.
:type Name: string
:param Name: [REQUIRED]
The app name.
:type Description: string
:param Description: A description of the app.
:type DataSources: list
:param DataSources: The app's data source.
(dict) --Describes an app's data source.
Type (string) --The data source's type, AutoSelectOpsworksMysqlInstance , OpsworksMysqlInstance , or RdsDbInstance .
Arn (string) --The data source's ARN.
DatabaseName (string) --The database name.
:type Type: string
:param Type: [REQUIRED]
The app type. Each supported type is associated with a particular layer. For example, PHP applications are associated with a PHP layer. AWS OpsWorks Stacks deploys an application to those instances that are members of the corresponding layer. If your app isn't one of the standard types, or you prefer to implement your own Deploy recipes, specify other .
:type AppSource: dict
:param AppSource: A Source object that specifies the app repository.
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type Domains: list
:param Domains: The app virtual host settings, with multiple domains separated by commas. For example: 'www.example.com, example.com'
(string) --
:type EnableSsl: boolean
:param EnableSsl: Whether to enable SSL for the app.
:type SslConfiguration: dict
:param SslConfiguration: An SslConfiguration object with the SSL configuration.
Certificate (string) -- [REQUIRED]The contents of the certificate's domain.crt file.
PrivateKey (string) -- [REQUIRED]The private key; the contents of the certificate's domain.kex file.
Chain (string) --Optional. Can be used to specify an intermediate certificate authority key or client authentication.
:type Attributes: dict
:param Attributes: One or more user-defined key/value pairs to be added to the stack attributes.
(string) --
(string) --
:type Environment: list
:param Environment: An array of EnvironmentVariable objects that specify environment variables to be associated with the app. After you deploy the app, these variables are defined on the associated app server instance. For more information, see Environment Variables .
There is no specific limit on the number of environment variables. However, the size of the associated data structure - which includes the variables' names, values, and protected flag values - cannot exceed 10 KB (10240 Bytes). This limit should accommodate most if not all use cases. Exceeding it will cause an exception with the message, 'Environment: is too large (maximum is 10KB).'
Note
This parameter is supported only by Chef 11.10 stacks. If you have specified one or more environment variables, you cannot modify the stack's Chef version.
(dict) --Represents an app's environment variable.
Key (string) -- [REQUIRED](Required) The environment variable's name, which can consist of up to 64 characters and must be specified. The name can contain upper- and lowercase letters, numbers, and underscores (_), but it must start with a letter or underscore.
Value (string) -- [REQUIRED](Optional) The environment variable's value, which can be left empty. If you specify a value, it can contain up to 256 characters, which must all be printable.
Secure (boolean) --(Optional) Whether the variable's value will be returned by the DescribeApps action. To conceal an environment variable's value, set Secure to true . DescribeApps then returns *****FILTERED***** instead of the actual value. The default value for Secure is false .
:rtype: dict
:return: {
'AppId': 'string'
} | entailment |
def create_instance(StackId=None, LayerIds=None, InstanceType=None, AutoScalingType=None, Hostname=None, Os=None, AmiId=None, SshKeyName=None, AvailabilityZone=None, VirtualizationType=None, SubnetId=None, Architecture=None, RootDeviceType=None, BlockDeviceMappings=None, InstallUpdatesOnBoot=None, EbsOptimized=None, AgentVersion=None, Tenancy=None):
"""
Creates an instance in a specified stack. For more information, see Adding an Instance to a Layer .
See also: AWS API Documentation
:example: response = client.create_instance(
StackId='string',
LayerIds=[
'string',
],
InstanceType='string',
AutoScalingType='load'|'timer',
Hostname='string',
Os='string',
AmiId='string',
SshKeyName='string',
AvailabilityZone='string',
VirtualizationType='string',
SubnetId='string',
Architecture='x86_64'|'i386',
RootDeviceType='ebs'|'instance-store',
BlockDeviceMappings=[
{
'DeviceName': 'string',
'NoDevice': 'string',
'VirtualName': 'string',
'Ebs': {
'SnapshotId': 'string',
'Iops': 123,
'VolumeSize': 123,
'VolumeType': 'gp2'|'io1'|'standard',
'DeleteOnTermination': True|False
}
},
],
InstallUpdatesOnBoot=True|False,
EbsOptimized=True|False,
AgentVersion='string',
Tenancy='string'
)
:type StackId: string
:param StackId: [REQUIRED]
The stack ID.
:type LayerIds: list
:param LayerIds: [REQUIRED]
An array that contains the instance's layer IDs.
(string) --
:type InstanceType: string
:param InstanceType: [REQUIRED]
The instance type, such as t2.micro . For a list of supported instance types, open the stack in the console, choose Instances , and choose + Instance . The Size list contains the currently supported types. For more information, see Instance Families and Types . The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table.
:type AutoScalingType: string
:param AutoScalingType: For load-based or time-based instances, the type. Windows stacks can use only time-based instances.
:type Hostname: string
:param Hostname: The instance host name.
:type Os: string
:param Os: The instance's operating system, which must be set to one of the following.
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
A custom AMI: Custom .
For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
The default option is the current Amazon Linux version. If you set this parameter to Custom , you must use the CreateInstance action's AmiId parameter to specify the custom AMI that you want to use. Block device mappings are not supported if the value is Custom . For more information on the supported operating systems, see Operating Systems For more information on how to use custom AMIs with AWS OpsWorks Stacks, see Using Custom AMIs .
:type AmiId: string
:param AmiId: A custom AMI ID to be used to create the instance. The AMI should be based on one of the supported operating systems. For more information, see Using Custom AMIs .
Note
If you specify a custom AMI, you must set Os to Custom .
:type SshKeyName: string
:param SshKeyName: The instance's Amazon EC2 key-pair name.
:type AvailabilityZone: string
:param AvailabilityZone: The instance Availability Zone. For more information, see Regions and Endpoints .
:type VirtualizationType: string
:param VirtualizationType: The instance's virtualization type, paravirtual or hvm .
:type SubnetId: string
:param SubnetId: The ID of the instance's subnet. If the stack is running in a VPC, you can use this parameter to override the stack's default subnet ID value and direct AWS OpsWorks Stacks to launch the instance in a different subnet.
:type Architecture: string
:param Architecture: The instance architecture. The default option is x86_64 . Instance types do not necessarily support both architectures. For a list of the architectures that are supported by the different instance types, see Instance Families and Types .
:type RootDeviceType: string
:param RootDeviceType: The instance root device type. For more information, see Storage for the Root Device .
:type BlockDeviceMappings: list
:param BlockDeviceMappings: An array of BlockDeviceMapping objects that specify the instance's block devices. For more information, see Block Device Mapping . Note that block device mappings are not supported for custom AMIs.
(dict) --Describes a block device mapping. This data type maps directly to the Amazon EC2 BlockDeviceMapping data type.
DeviceName (string) --The device name that is exposed to the instance, such as /dev/sdh . For the root device, you can use the explicit device name or you can set this parameter to ROOT_DEVICE and AWS OpsWorks Stacks will provide the correct device name.
NoDevice (string) --Suppresses the specified device included in the AMI's block device mapping.
VirtualName (string) --The virtual device name. For more information, see BlockDeviceMapping .
Ebs (dict) --An EBSBlockDevice that defines how to configure an Amazon EBS volume when the instance is launched.
SnapshotId (string) --The snapshot ID.
Iops (integer) --The number of I/O operations per second (IOPS) that the volume supports. For more information, see EbsBlockDevice .
VolumeSize (integer) --The volume size, in GiB. For more information, see EbsBlockDevice .
VolumeType (string) --The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic volumes.
DeleteOnTermination (boolean) --Whether the volume is deleted on instance termination.
:type InstallUpdatesOnBoot: boolean
:param InstallUpdatesOnBoot: Whether to install operating system and package updates when the instance boots. The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.
Note
We strongly recommend using the default value of true to ensure that your instances have the latest security updates.
:type EbsOptimized: boolean
:param EbsOptimized: Whether to create an Amazon EBS-optimized instance.
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
INHERIT - Use the stack's default agent version setting.
version_number - Use the specified agent version. This value overrides the stack's default setting. To update the agent version, edit the instance configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the instance.
The default setting is INHERIT . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.
:type Tenancy: string
:param Tenancy: The instance's tenancy option. The default option is no tenancy, or if the instance is running in a VPC, inherit tenancy settings from the VPC. The following are valid values for this parameter: dedicated , default , or host . Because there are costs associated with changes in tenancy options, we recommend that you research tenancy options before choosing them for your instances. For more information about dedicated hosts, see Dedicated Hosts Overview and Amazon EC2 Dedicated Hosts . For more information about dedicated instances, see Dedicated Instances and Amazon EC2 Dedicated Instances .
:rtype: dict
:return: {
'InstanceId': 'string'
}
"""
pass | Creates an instance in a specified stack. For more information, see Adding an Instance to a Layer .
See also: AWS API Documentation
:example: response = client.create_instance(
StackId='string',
LayerIds=[
'string',
],
InstanceType='string',
AutoScalingType='load'|'timer',
Hostname='string',
Os='string',
AmiId='string',
SshKeyName='string',
AvailabilityZone='string',
VirtualizationType='string',
SubnetId='string',
Architecture='x86_64'|'i386',
RootDeviceType='ebs'|'instance-store',
BlockDeviceMappings=[
{
'DeviceName': 'string',
'NoDevice': 'string',
'VirtualName': 'string',
'Ebs': {
'SnapshotId': 'string',
'Iops': 123,
'VolumeSize': 123,
'VolumeType': 'gp2'|'io1'|'standard',
'DeleteOnTermination': True|False
}
},
],
InstallUpdatesOnBoot=True|False,
EbsOptimized=True|False,
AgentVersion='string',
Tenancy='string'
)
:type StackId: string
:param StackId: [REQUIRED]
The stack ID.
:type LayerIds: list
:param LayerIds: [REQUIRED]
An array that contains the instance's layer IDs.
(string) --
:type InstanceType: string
:param InstanceType: [REQUIRED]
The instance type, such as t2.micro . For a list of supported instance types, open the stack in the console, choose Instances , and choose + Instance . The Size list contains the currently supported types. For more information, see Instance Families and Types . The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table.
:type AutoScalingType: string
:param AutoScalingType: For load-based or time-based instances, the type. Windows stacks can use only time-based instances.
:type Hostname: string
:param Hostname: The instance host name.
:type Os: string
:param Os: The instance's operating system, which must be set to one of the following.
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
A custom AMI: Custom .
For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
The default option is the current Amazon Linux version. If you set this parameter to Custom , you must use the CreateInstance action's AmiId parameter to specify the custom AMI that you want to use. Block device mappings are not supported if the value is Custom . For more information on the supported operating systems, see Operating Systems For more information on how to use custom AMIs with AWS OpsWorks Stacks, see Using Custom AMIs .
:type AmiId: string
:param AmiId: A custom AMI ID to be used to create the instance. The AMI should be based on one of the supported operating systems. For more information, see Using Custom AMIs .
Note
If you specify a custom AMI, you must set Os to Custom .
:type SshKeyName: string
:param SshKeyName: The instance's Amazon EC2 key-pair name.
:type AvailabilityZone: string
:param AvailabilityZone: The instance Availability Zone. For more information, see Regions and Endpoints .
:type VirtualizationType: string
:param VirtualizationType: The instance's virtualization type, paravirtual or hvm .
:type SubnetId: string
:param SubnetId: The ID of the instance's subnet. If the stack is running in a VPC, you can use this parameter to override the stack's default subnet ID value and direct AWS OpsWorks Stacks to launch the instance in a different subnet.
:type Architecture: string
:param Architecture: The instance architecture. The default option is x86_64 . Instance types do not necessarily support both architectures. For a list of the architectures that are supported by the different instance types, see Instance Families and Types .
:type RootDeviceType: string
:param RootDeviceType: The instance root device type. For more information, see Storage for the Root Device .
:type BlockDeviceMappings: list
:param BlockDeviceMappings: An array of BlockDeviceMapping objects that specify the instance's block devices. For more information, see Block Device Mapping . Note that block device mappings are not supported for custom AMIs.
(dict) --Describes a block device mapping. This data type maps directly to the Amazon EC2 BlockDeviceMapping data type.
DeviceName (string) --The device name that is exposed to the instance, such as /dev/sdh . For the root device, you can use the explicit device name or you can set this parameter to ROOT_DEVICE and AWS OpsWorks Stacks will provide the correct device name.
NoDevice (string) --Suppresses the specified device included in the AMI's block device mapping.
VirtualName (string) --The virtual device name. For more information, see BlockDeviceMapping .
Ebs (dict) --An EBSBlockDevice that defines how to configure an Amazon EBS volume when the instance is launched.
SnapshotId (string) --The snapshot ID.
Iops (integer) --The number of I/O operations per second (IOPS) that the volume supports. For more information, see EbsBlockDevice .
VolumeSize (integer) --The volume size, in GiB. For more information, see EbsBlockDevice .
VolumeType (string) --The volume type. gp2 for General Purpose (SSD) volumes, io1 for Provisioned IOPS (SSD) volumes, and standard for Magnetic volumes.
DeleteOnTermination (boolean) --Whether the volume is deleted on instance termination.
:type InstallUpdatesOnBoot: boolean
:param InstallUpdatesOnBoot: Whether to install operating system and package updates when the instance boots. The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.
Note
We strongly recommend using the default value of true to ensure that your instances have the latest security updates.
:type EbsOptimized: boolean
:param EbsOptimized: Whether to create an Amazon EBS-optimized instance.
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
INHERIT - Use the stack's default agent version setting.
version_number - Use the specified agent version. This value overrides the stack's default setting. To update the agent version, edit the instance configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the instance.
The default setting is INHERIT . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.
:type Tenancy: string
:param Tenancy: The instance's tenancy option. The default option is no tenancy, or if the instance is running in a VPC, inherit tenancy settings from the VPC. The following are valid values for this parameter: dedicated , default , or host . Because there are costs associated with changes in tenancy options, we recommend that you research tenancy options before choosing them for your instances. For more information about dedicated hosts, see Dedicated Hosts Overview and Amazon EC2 Dedicated Hosts . For more information about dedicated instances, see Dedicated Instances and Amazon EC2 Dedicated Instances .
:rtype: dict
:return: {
'InstanceId': 'string'
} | entailment |
def create_layer(StackId=None, Type=None, Name=None, Shortname=None, Attributes=None, CloudWatchLogsConfiguration=None, CustomInstanceProfileArn=None, CustomJson=None, CustomSecurityGroupIds=None, Packages=None, VolumeConfigurations=None, EnableAutoHealing=None, AutoAssignElasticIps=None, AutoAssignPublicIps=None, CustomRecipes=None, InstallUpdatesOnBoot=None, UseEbsOptimizedInstances=None, LifecycleEventConfiguration=None):
"""
Creates a layer. For more information, see How to Create a Layer .
See also: AWS API Documentation
:example: response = client.create_layer(
StackId='string',
Type='aws-flow-ruby'|'ecs-cluster'|'java-app'|'lb'|'web'|'php-app'|'rails-app'|'nodejs-app'|'memcached'|'db-master'|'monitoring-master'|'custom',
Name='string',
Shortname='string',
Attributes={
'string': 'string'
},
CloudWatchLogsConfiguration={
'Enabled': True|False,
'LogStreams': [
{
'LogGroupName': 'string',
'DatetimeFormat': 'string',
'TimeZone': 'LOCAL'|'UTC',
'File': 'string',
'FileFingerprintLines': 'string',
'MultiLineStartPattern': 'string',
'InitialPosition': 'start_of_file'|'end_of_file',
'Encoding': 'ascii'|'big5'|'big5hkscs'|'cp037'|'cp424'|'cp437'|'cp500'|'cp720'|'cp737'|'cp775'|'cp850'|'cp852'|'cp855'|'cp856'|'cp857'|'cp858'|'cp860'|'cp861'|'cp862'|'cp863'|'cp864'|'cp865'|'cp866'|'cp869'|'cp874'|'cp875'|'cp932'|'cp949'|'cp950'|'cp1006'|'cp1026'|'cp1140'|'cp1250'|'cp1251'|'cp1252'|'cp1253'|'cp1254'|'cp1255'|'cp1256'|'cp1257'|'cp1258'|'euc_jp'|'euc_jis_2004'|'euc_jisx0213'|'euc_kr'|'gb2312'|'gbk'|'gb18030'|'hz'|'iso2022_jp'|'iso2022_jp_1'|'iso2022_jp_2'|'iso2022_jp_2004'|'iso2022_jp_3'|'iso2022_jp_ext'|'iso2022_kr'|'latin_1'|'iso8859_2'|'iso8859_3'|'iso8859_4'|'iso8859_5'|'iso8859_6'|'iso8859_7'|'iso8859_8'|'iso8859_9'|'iso8859_10'|'iso8859_13'|'iso8859_14'|'iso8859_15'|'iso8859_16'|'johab'|'koi8_r'|'koi8_u'|'mac_cyrillic'|'mac_greek'|'mac_iceland'|'mac_latin2'|'mac_roman'|'mac_turkish'|'ptcp154'|'shift_jis'|'shift_jis_2004'|'shift_jisx0213'|'utf_32'|'utf_32_be'|'utf_32_le'|'utf_16'|'utf_16_be'|'utf_16_le'|'utf_7'|'utf_8'|'utf_8_sig',
'BufferDuration': 123,
'BatchCount': 123,
'BatchSize': 123
},
]
},
CustomInstanceProfileArn='string',
CustomJson='string',
CustomSecurityGroupIds=[
'string',
],
Packages=[
'string',
],
VolumeConfigurations=[
{
'MountPoint': 'string',
'RaidLevel': 123,
'NumberOfDisks': 123,
'Size': 123,
'VolumeType': 'string',
'Iops': 123
},
],
EnableAutoHealing=True|False,
AutoAssignElasticIps=True|False,
AutoAssignPublicIps=True|False,
CustomRecipes={
'Setup': [
'string',
],
'Configure': [
'string',
],
'Deploy': [
'string',
],
'Undeploy': [
'string',
],
'Shutdown': [
'string',
]
},
InstallUpdatesOnBoot=True|False,
UseEbsOptimizedInstances=True|False,
LifecycleEventConfiguration={
'Shutdown': {
'ExecutionTimeout': 123,
'DelayUntilElbConnectionsDrained': True|False
}
}
)
:type StackId: string
:param StackId: [REQUIRED]
The layer stack ID.
:type Type: string
:param Type: [REQUIRED]
The layer type. A stack cannot have more than one built-in layer of the same type. It can have any number of custom layers. Built-in layers are not available in Chef 12 stacks.
:type Name: string
:param Name: [REQUIRED]
The layer name, which is used by the console.
:type Shortname: string
:param Shortname: [REQUIRED]
For custom layers only, use this parameter to specify the layer's short name, which is used internally by AWS OpsWorks Stacks and by Chef recipes. The short name is also used as the name for the directory where your app files are installed. It can have a maximum of 200 characters, which are limited to the alphanumeric characters, '-', '_', and '.'.
The built-in layers' short names are defined by AWS OpsWorks Stacks. For more information, see the Layer Reference .
:type Attributes: dict
:param Attributes: One or more user-defined key-value pairs to be added to the stack attributes.
To create a cluster layer, set the EcsClusterArn attribute to the cluster's ARN.
(string) --
(string) --
:type CloudWatchLogsConfiguration: dict
:param CloudWatchLogsConfiguration: Specifies CloudWatch Logs configuration options for the layer. For more information, see CloudWatchLogsLogStream .
Enabled (boolean) --Whether CloudWatch Logs is enabled for a layer.
LogStreams (list) --A list of configuration options for CloudWatch Logs.
(dict) --Describes the Amazon CloudWatch logs configuration for a layer. For detailed information about members of this data type, see the CloudWatch Logs Agent Reference .
LogGroupName (string) --Specifies the destination log group. A log group is created automatically if it doesn't already exist. Log group names can be between 1 and 512 characters long. Allowed characters include a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period).
DatetimeFormat (string) --Specifies how the time stamp is extracted from logs. For more information, see the CloudWatch Logs Agent Reference .
TimeZone (string) --Specifies the time zone of log event time stamps.
File (string) --Specifies log files that you want to push to CloudWatch Logs.
File can point to a specific file or multiple files (by using wild card characters such as /var/log/system.log* ). Only the latest file is pushed to CloudWatch Logs, based on file modification time. We recommend that you use wild card characters to specify a series of files of the same type, such as access_log.2014-06-01-01 , access_log.2014-06-01-02 , and so on by using a pattern like access_log.* . Don't use a wildcard to match multiple file types, such as access_log_80 and access_log_443 . To specify multiple, different file types, add another log stream entry to the configuration file, so that each log file type is stored in a different log group.
Zipped files are not supported.
FileFingerprintLines (string) --Specifies the range of lines for identifying a file. The valid values are one number, or two dash-delimited numbers, such as '1', '2-5'. The default value is '1', meaning the first line is used to calculate the fingerprint. Fingerprint lines are not sent to CloudWatch Logs unless all specified lines are available.
MultiLineStartPattern (string) --Specifies the pattern for identifying the start of a log message.
InitialPosition (string) --Specifies where to start to read data (start_of_file or end_of_file). The default is start_of_file. This setting is only used if there is no state persisted for that log stream.
Encoding (string) --Specifies the encoding of the log file so that the file can be read correctly. The default is utf_8 . Encodings supported by Python codecs.decode() can be used here.
BufferDuration (integer) --Specifies the time duration for the batching of log events. The minimum value is 5000ms and default value is 5000ms.
BatchCount (integer) --Specifies the max number of log events in a batch, up to 10000. The default value is 1000.
BatchSize (integer) --Specifies the maximum size of log events in a batch, in bytes, up to 1048576 bytes. The default value is 32768 bytes. This size is calculated as the sum of all event messages in UTF-8, plus 26 bytes for each log event.
:type CustomInstanceProfileArn: string
:param CustomInstanceProfileArn: The ARN of an IAM profile to be used for the layer's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type CustomJson: string
:param CustomJson: A JSON-formatted string containing custom stack configuration and deployment attributes to be installed on the layer's instances. For more information, see Using Custom JSON . This feature is supported as of version 1.7.42 of the AWS CLI.
:type CustomSecurityGroupIds: list
:param CustomSecurityGroupIds: An array containing the layer custom security group IDs.
(string) --
:type Packages: list
:param Packages: An array of Package objects that describes the layer packages.
(string) --
:type VolumeConfigurations: list
:param VolumeConfigurations: A VolumeConfigurations object that describes the layer's Amazon EBS volumes.
(dict) --Describes an Amazon EBS volume configuration.
MountPoint (string) -- [REQUIRED]The volume mount point. For example '/dev/sdh'.
RaidLevel (integer) --The volume RAID level .
NumberOfDisks (integer) -- [REQUIRED]The number of disks in the volume.
Size (integer) -- [REQUIRED]The volume size.
VolumeType (string) --The volume type:
standard - Magnetic
io1 - Provisioned IOPS (SSD)
gp2 - General Purpose (SSD)
Iops (integer) --For PIOPS volumes, the IOPS per disk.
:type EnableAutoHealing: boolean
:param EnableAutoHealing: Whether to disable auto healing for the layer.
:type AutoAssignElasticIps: boolean
:param AutoAssignElasticIps: Whether to automatically assign an Elastic IP address to the layer's instances. For more information, see How to Edit a Layer .
:type AutoAssignPublicIps: boolean
:param AutoAssignPublicIps: For stacks that are running in a VPC, whether to automatically assign a public IP address to the layer's instances. For more information, see How to Edit a Layer .
:type CustomRecipes: dict
:param CustomRecipes: A LayerCustomRecipes object that specifies the layer custom recipes.
Setup (list) --An array of custom recipe names to be run following a setup event.
(string) --
Configure (list) --An array of custom recipe names to be run following a configure event.
(string) --
Deploy (list) --An array of custom recipe names to be run following a deploy event.
(string) --
Undeploy (list) --An array of custom recipe names to be run following a undeploy event.
(string) --
Shutdown (list) --An array of custom recipe names to be run following a shutdown event.
(string) --
:type InstallUpdatesOnBoot: boolean
:param InstallUpdatesOnBoot: Whether to install operating system and package updates when the instance boots. The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.
Note
To ensure that your instances have the latest security updates, we strongly recommend using the default value of true .
:type UseEbsOptimizedInstances: boolean
:param UseEbsOptimizedInstances: Whether to use Amazon EBS-optimized instances.
:type LifecycleEventConfiguration: dict
:param LifecycleEventConfiguration: A LifeCycleEventConfiguration object that you can use to configure the Shutdown event to specify an execution timeout and enable or disable Elastic Load Balancer connection draining.
Shutdown (dict) --A ShutdownEventConfiguration object that specifies the Shutdown event configuration.
ExecutionTimeout (integer) --The time, in seconds, that AWS OpsWorks Stacks will wait after triggering a Shutdown event before shutting down an instance.
DelayUntilElbConnectionsDrained (boolean) --Whether to enable Elastic Load Balancing connection draining. For more information, see Connection Draining
:rtype: dict
:return: {
'LayerId': 'string'
}
"""
pass | Creates a layer. For more information, see How to Create a Layer .
See also: AWS API Documentation
:example: response = client.create_layer(
StackId='string',
Type='aws-flow-ruby'|'ecs-cluster'|'java-app'|'lb'|'web'|'php-app'|'rails-app'|'nodejs-app'|'memcached'|'db-master'|'monitoring-master'|'custom',
Name='string',
Shortname='string',
Attributes={
'string': 'string'
},
CloudWatchLogsConfiguration={
'Enabled': True|False,
'LogStreams': [
{
'LogGroupName': 'string',
'DatetimeFormat': 'string',
'TimeZone': 'LOCAL'|'UTC',
'File': 'string',
'FileFingerprintLines': 'string',
'MultiLineStartPattern': 'string',
'InitialPosition': 'start_of_file'|'end_of_file',
'Encoding': 'ascii'|'big5'|'big5hkscs'|'cp037'|'cp424'|'cp437'|'cp500'|'cp720'|'cp737'|'cp775'|'cp850'|'cp852'|'cp855'|'cp856'|'cp857'|'cp858'|'cp860'|'cp861'|'cp862'|'cp863'|'cp864'|'cp865'|'cp866'|'cp869'|'cp874'|'cp875'|'cp932'|'cp949'|'cp950'|'cp1006'|'cp1026'|'cp1140'|'cp1250'|'cp1251'|'cp1252'|'cp1253'|'cp1254'|'cp1255'|'cp1256'|'cp1257'|'cp1258'|'euc_jp'|'euc_jis_2004'|'euc_jisx0213'|'euc_kr'|'gb2312'|'gbk'|'gb18030'|'hz'|'iso2022_jp'|'iso2022_jp_1'|'iso2022_jp_2'|'iso2022_jp_2004'|'iso2022_jp_3'|'iso2022_jp_ext'|'iso2022_kr'|'latin_1'|'iso8859_2'|'iso8859_3'|'iso8859_4'|'iso8859_5'|'iso8859_6'|'iso8859_7'|'iso8859_8'|'iso8859_9'|'iso8859_10'|'iso8859_13'|'iso8859_14'|'iso8859_15'|'iso8859_16'|'johab'|'koi8_r'|'koi8_u'|'mac_cyrillic'|'mac_greek'|'mac_iceland'|'mac_latin2'|'mac_roman'|'mac_turkish'|'ptcp154'|'shift_jis'|'shift_jis_2004'|'shift_jisx0213'|'utf_32'|'utf_32_be'|'utf_32_le'|'utf_16'|'utf_16_be'|'utf_16_le'|'utf_7'|'utf_8'|'utf_8_sig',
'BufferDuration': 123,
'BatchCount': 123,
'BatchSize': 123
},
]
},
CustomInstanceProfileArn='string',
CustomJson='string',
CustomSecurityGroupIds=[
'string',
],
Packages=[
'string',
],
VolumeConfigurations=[
{
'MountPoint': 'string',
'RaidLevel': 123,
'NumberOfDisks': 123,
'Size': 123,
'VolumeType': 'string',
'Iops': 123
},
],
EnableAutoHealing=True|False,
AutoAssignElasticIps=True|False,
AutoAssignPublicIps=True|False,
CustomRecipes={
'Setup': [
'string',
],
'Configure': [
'string',
],
'Deploy': [
'string',
],
'Undeploy': [
'string',
],
'Shutdown': [
'string',
]
},
InstallUpdatesOnBoot=True|False,
UseEbsOptimizedInstances=True|False,
LifecycleEventConfiguration={
'Shutdown': {
'ExecutionTimeout': 123,
'DelayUntilElbConnectionsDrained': True|False
}
}
)
:type StackId: string
:param StackId: [REQUIRED]
The layer stack ID.
:type Type: string
:param Type: [REQUIRED]
The layer type. A stack cannot have more than one built-in layer of the same type. It can have any number of custom layers. Built-in layers are not available in Chef 12 stacks.
:type Name: string
:param Name: [REQUIRED]
The layer name, which is used by the console.
:type Shortname: string
:param Shortname: [REQUIRED]
For custom layers only, use this parameter to specify the layer's short name, which is used internally by AWS OpsWorks Stacks and by Chef recipes. The short name is also used as the name for the directory where your app files are installed. It can have a maximum of 200 characters, which are limited to the alphanumeric characters, '-', '_', and '.'.
The built-in layers' short names are defined by AWS OpsWorks Stacks. For more information, see the Layer Reference .
:type Attributes: dict
:param Attributes: One or more user-defined key-value pairs to be added to the stack attributes.
To create a cluster layer, set the EcsClusterArn attribute to the cluster's ARN.
(string) --
(string) --
:type CloudWatchLogsConfiguration: dict
:param CloudWatchLogsConfiguration: Specifies CloudWatch Logs configuration options for the layer. For more information, see CloudWatchLogsLogStream .
Enabled (boolean) --Whether CloudWatch Logs is enabled for a layer.
LogStreams (list) --A list of configuration options for CloudWatch Logs.
(dict) --Describes the Amazon CloudWatch logs configuration for a layer. For detailed information about members of this data type, see the CloudWatch Logs Agent Reference .
LogGroupName (string) --Specifies the destination log group. A log group is created automatically if it doesn't already exist. Log group names can be between 1 and 512 characters long. Allowed characters include a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period).
DatetimeFormat (string) --Specifies how the time stamp is extracted from logs. For more information, see the CloudWatch Logs Agent Reference .
TimeZone (string) --Specifies the time zone of log event time stamps.
File (string) --Specifies log files that you want to push to CloudWatch Logs.
File can point to a specific file or multiple files (by using wild card characters such as /var/log/system.log* ). Only the latest file is pushed to CloudWatch Logs, based on file modification time. We recommend that you use wild card characters to specify a series of files of the same type, such as access_log.2014-06-01-01 , access_log.2014-06-01-02 , and so on by using a pattern like access_log.* . Don't use a wildcard to match multiple file types, such as access_log_80 and access_log_443 . To specify multiple, different file types, add another log stream entry to the configuration file, so that each log file type is stored in a different log group.
Zipped files are not supported.
FileFingerprintLines (string) --Specifies the range of lines for identifying a file. The valid values are one number, or two dash-delimited numbers, such as '1', '2-5'. The default value is '1', meaning the first line is used to calculate the fingerprint. Fingerprint lines are not sent to CloudWatch Logs unless all specified lines are available.
MultiLineStartPattern (string) --Specifies the pattern for identifying the start of a log message.
InitialPosition (string) --Specifies where to start to read data (start_of_file or end_of_file). The default is start_of_file. This setting is only used if there is no state persisted for that log stream.
Encoding (string) --Specifies the encoding of the log file so that the file can be read correctly. The default is utf_8 . Encodings supported by Python codecs.decode() can be used here.
BufferDuration (integer) --Specifies the time duration for the batching of log events. The minimum value is 5000ms and default value is 5000ms.
BatchCount (integer) --Specifies the max number of log events in a batch, up to 10000. The default value is 1000.
BatchSize (integer) --Specifies the maximum size of log events in a batch, in bytes, up to 1048576 bytes. The default value is 32768 bytes. This size is calculated as the sum of all event messages in UTF-8, plus 26 bytes for each log event.
:type CustomInstanceProfileArn: string
:param CustomInstanceProfileArn: The ARN of an IAM profile to be used for the layer's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type CustomJson: string
:param CustomJson: A JSON-formatted string containing custom stack configuration and deployment attributes to be installed on the layer's instances. For more information, see Using Custom JSON . This feature is supported as of version 1.7.42 of the AWS CLI.
:type CustomSecurityGroupIds: list
:param CustomSecurityGroupIds: An array containing the layer custom security group IDs.
(string) --
:type Packages: list
:param Packages: An array of Package objects that describes the layer packages.
(string) --
:type VolumeConfigurations: list
:param VolumeConfigurations: A VolumeConfigurations object that describes the layer's Amazon EBS volumes.
(dict) --Describes an Amazon EBS volume configuration.
MountPoint (string) -- [REQUIRED]The volume mount point. For example '/dev/sdh'.
RaidLevel (integer) --The volume RAID level .
NumberOfDisks (integer) -- [REQUIRED]The number of disks in the volume.
Size (integer) -- [REQUIRED]The volume size.
VolumeType (string) --The volume type:
standard - Magnetic
io1 - Provisioned IOPS (SSD)
gp2 - General Purpose (SSD)
Iops (integer) --For PIOPS volumes, the IOPS per disk.
:type EnableAutoHealing: boolean
:param EnableAutoHealing: Whether to disable auto healing for the layer.
:type AutoAssignElasticIps: boolean
:param AutoAssignElasticIps: Whether to automatically assign an Elastic IP address to the layer's instances. For more information, see How to Edit a Layer .
:type AutoAssignPublicIps: boolean
:param AutoAssignPublicIps: For stacks that are running in a VPC, whether to automatically assign a public IP address to the layer's instances. For more information, see How to Edit a Layer .
:type CustomRecipes: dict
:param CustomRecipes: A LayerCustomRecipes object that specifies the layer custom recipes.
Setup (list) --An array of custom recipe names to be run following a setup event.
(string) --
Configure (list) --An array of custom recipe names to be run following a configure event.
(string) --
Deploy (list) --An array of custom recipe names to be run following a deploy event.
(string) --
Undeploy (list) --An array of custom recipe names to be run following a undeploy event.
(string) --
Shutdown (list) --An array of custom recipe names to be run following a shutdown event.
(string) --
:type InstallUpdatesOnBoot: boolean
:param InstallUpdatesOnBoot: Whether to install operating system and package updates when the instance boots. The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.
Note
To ensure that your instances have the latest security updates, we strongly recommend using the default value of true .
:type UseEbsOptimizedInstances: boolean
:param UseEbsOptimizedInstances: Whether to use Amazon EBS-optimized instances.
:type LifecycleEventConfiguration: dict
:param LifecycleEventConfiguration: A LifeCycleEventConfiguration object that you can use to configure the Shutdown event to specify an execution timeout and enable or disable Elastic Load Balancer connection draining.
Shutdown (dict) --A ShutdownEventConfiguration object that specifies the Shutdown event configuration.
ExecutionTimeout (integer) --The time, in seconds, that AWS OpsWorks Stacks will wait after triggering a Shutdown event before shutting down an instance.
DelayUntilElbConnectionsDrained (boolean) --Whether to enable Elastic Load Balancing connection draining. For more information, see Connection Draining
:rtype: dict
:return: {
'LayerId': 'string'
} | entailment |
def create_stack(Name=None, Region=None, VpcId=None, Attributes=None, ServiceRoleArn=None, DefaultInstanceProfileArn=None, DefaultOs=None, HostnameTheme=None, DefaultAvailabilityZone=None, DefaultSubnetId=None, CustomJson=None, ConfigurationManager=None, ChefConfiguration=None, UseCustomCookbooks=None, UseOpsworksSecurityGroups=None, CustomCookbooksSource=None, DefaultSshKeyName=None, DefaultRootDeviceType=None, AgentVersion=None):
"""
Creates a new stack. For more information, see Create a New Stack .
See also: AWS API Documentation
:example: response = client.create_stack(
Name='string',
Region='string',
VpcId='string',
Attributes={
'string': 'string'
},
ServiceRoleArn='string',
DefaultInstanceProfileArn='string',
DefaultOs='string',
HostnameTheme='string',
DefaultAvailabilityZone='string',
DefaultSubnetId='string',
CustomJson='string',
ConfigurationManager={
'Name': 'string',
'Version': 'string'
},
ChefConfiguration={
'ManageBerkshelf': True|False,
'BerkshelfVersion': 'string'
},
UseCustomCookbooks=True|False,
UseOpsworksSecurityGroups=True|False,
CustomCookbooksSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
DefaultSshKeyName='string',
DefaultRootDeviceType='ebs'|'instance-store',
AgentVersion='string'
)
:type Name: string
:param Name: [REQUIRED]
The stack name.
:type Region: string
:param Region: [REQUIRED]
The stack's AWS region, such as 'ap-south-1'. For more information about Amazon regions, see Regions and Endpoints .
:type VpcId: string
:param VpcId: The ID of the VPC that the stack is to be launched into. The VPC must be in the stack's region. All instances are launched into this VPC. You cannot change the ID later.
If your account supports EC2-Classic, the default value is no VPC .
If your account does not support EC2-Classic, the default value is the default VPC for the specified region.
If the VPC ID corresponds to a default VPC and you have specified either the DefaultAvailabilityZone or the DefaultSubnetId parameter only, AWS OpsWorks Stacks infers the value of the other parameter. If you specify neither parameter, AWS OpsWorks Stacks sets these parameters to the first valid Availability Zone for the specified region and the corresponding default VPC subnet ID, respectively.
If you specify a nondefault VPC ID, note the following:
It must belong to a VPC in your account that is in the specified region.
You must specify a value for DefaultSubnetId .
For more information on how to use AWS OpsWorks Stacks with a VPC, see Running a Stack in a VPC . For more information on default VPC and EC2-Classic, see Supported Platforms .
:type Attributes: dict
:param Attributes: One or more user-defined key-value pairs to be added to the stack attributes.
(string) --
(string) --
:type ServiceRoleArn: string
:param ServiceRoleArn: [REQUIRED]
The stack's AWS Identity and Access Management (IAM) role, which allows AWS OpsWorks Stacks to work with AWS resources on your behalf. You must set this parameter to the Amazon Resource Name (ARN) for an existing IAM role. For more information about IAM ARNs, see Using Identifiers .
:type DefaultInstanceProfileArn: string
:param DefaultInstanceProfileArn: [REQUIRED]
The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type DefaultOs: string
:param DefaultOs: The stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance. You can specify one of the following.
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
A custom AMI: Custom . You specify the custom AMI you want to use when you create instances. For more information, see Using Custom AMIs .
The default option is the current Amazon Linux version. For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
:type HostnameTheme: string
:param HostnameTheme: The stack's host name theme, with spaces replaced by underscores. The theme is used to generate host names for the stack's instances. By default, HostnameTheme is set to Layer_Dependent , which creates host names by appending integers to the layer's short name. The other themes are:
Baked_Goods
Clouds
Europe_Cities
Fruits
Greek_Deities
Legendary_creatures_from_Japan
Planets_and_Moons
Roman_Deities
Scottish_Islands
US_Cities
Wild_Cats
To obtain a generated host name, call GetHostNameSuggestion , which returns a host name based on the current theme.
:type DefaultAvailabilityZone: string
:param DefaultAvailabilityZone: The stack's default Availability Zone, which must be in the specified region. For more information, see Regions and Endpoints . If you also specify a value for DefaultSubnetId , the subnet must be in the same zone. For more information, see the VpcId parameter description.
:type DefaultSubnetId: string
:param DefaultSubnetId: The stack's default VPC subnet ID. This parameter is required if you specify a value for the VpcId parameter. All instances are launched into this subnet unless you specify otherwise when you create the instance. If you also specify a value for DefaultAvailabilityZone , the subnet must be in that zone. For information on default values and when this parameter is required, see the VpcId parameter description.
:type CustomJson: string
:param CustomJson: A string that contains user-defined, custom JSON. It can be used to override the corresponding default stack configuration attribute values or to pass data to recipes. The string should be in the following format:
'{\'key1\': \'value1\', \'key2\': \'value2\',...}'
For more information on custom JSON, see Use Custom JSON to Modify the Stack Configuration Attributes .
:type ConfigurationManager: dict
:param ConfigurationManager: The configuration manager. When you create a stack we recommend that you use the configuration manager to specify the Chef version: 12, 11.10, or 11.4 for Linux stacks, or 12.2 for Windows stacks. The default value for Linux stacks is currently 11.4.
Name (string) --The name. This parameter must be set to 'Chef'.
Version (string) --The Chef version. This parameter must be set to 12, 11.10, or 11.4 for Linux stacks, and to 12.2 for Windows stacks. The default value for Linux stacks is 11.4.
:type ChefConfiguration: dict
:param ChefConfiguration: A ChefConfiguration object that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .
ManageBerkshelf (boolean) --Whether to enable Berkshelf.
BerkshelfVersion (string) --The Berkshelf version.
:type UseCustomCookbooks: boolean
:param UseCustomCookbooks: Whether the stack uses custom cookbooks.
:type UseOpsworksSecurityGroups: boolean
:param UseOpsworksSecurityGroups: Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.
AWS OpsWorks Stacks provides a standard set of built-in security groups, one for each layer, which are associated with layers by default. With UseOpsworksSecurityGroups you can instead provide your own custom security groups. UseOpsworksSecurityGroups has the following settings:
True - AWS OpsWorks Stacks automatically associates the appropriate built-in security group with each layer (default setting). You can associate additional security groups with a layer after you create it, but you cannot delete the built-in security group.
False - AWS OpsWorks Stacks does not associate built-in security groups with layers. You must create appropriate EC2 security groups and associate a security group with each layer that you create. However, you can still manually associate a built-in security group with a layer on creation; custom security groups are required only for those layers that need custom settings.
For more information, see Create a New Stack .
:type CustomCookbooksSource: dict
:param CustomCookbooksSource: Contains the information required to retrieve an app or cookbook from a repository. For more information, see Creating Apps or Custom Recipes and Cookbooks .
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type DefaultSshKeyName: string
:param DefaultSshKeyName: A default Amazon EC2 key pair name. The default value is none. If you specify a key pair name, AWS OpsWorks installs the public key on the instance and you can use the private key with an SSH client to log in to the instance. For more information, see Using SSH to Communicate with an Instance and Managing SSH Access . You can override this setting by specifying a different key pair, or no key pair, when you create an instance .
:type DefaultRootDeviceType: string
:param DefaultRootDeviceType: The default root device type. This value is the default for all instances in the stack, but you can override it when you create an instance. The default option is instance-store . For more information, see Storage for the Root Device .
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
Auto-update - Set this parameter to LATEST . AWS OpsWorks Stacks automatically installs new agent versions on the stack's instances as soon as they are available.
Fixed version - Set this parameter to your preferred agent version. To update the agent version, you must edit the stack configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the stack's instances.
The default setting is the most recent release of the agent. To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.
Note
You can also specify an agent version when you create or update an instance, which overrides the stack's default setting.
:rtype: dict
:return: {
'StackId': 'string'
}
"""
pass | Creates a new stack. For more information, see Create a New Stack .
See also: AWS API Documentation
:example: response = client.create_stack(
Name='string',
Region='string',
VpcId='string',
Attributes={
'string': 'string'
},
ServiceRoleArn='string',
DefaultInstanceProfileArn='string',
DefaultOs='string',
HostnameTheme='string',
DefaultAvailabilityZone='string',
DefaultSubnetId='string',
CustomJson='string',
ConfigurationManager={
'Name': 'string',
'Version': 'string'
},
ChefConfiguration={
'ManageBerkshelf': True|False,
'BerkshelfVersion': 'string'
},
UseCustomCookbooks=True|False,
UseOpsworksSecurityGroups=True|False,
CustomCookbooksSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
DefaultSshKeyName='string',
DefaultRootDeviceType='ebs'|'instance-store',
AgentVersion='string'
)
:type Name: string
:param Name: [REQUIRED]
The stack name.
:type Region: string
:param Region: [REQUIRED]
The stack's AWS region, such as 'ap-south-1'. For more information about Amazon regions, see Regions and Endpoints .
:type VpcId: string
:param VpcId: The ID of the VPC that the stack is to be launched into. The VPC must be in the stack's region. All instances are launched into this VPC. You cannot change the ID later.
If your account supports EC2-Classic, the default value is no VPC .
If your account does not support EC2-Classic, the default value is the default VPC for the specified region.
If the VPC ID corresponds to a default VPC and you have specified either the DefaultAvailabilityZone or the DefaultSubnetId parameter only, AWS OpsWorks Stacks infers the value of the other parameter. If you specify neither parameter, AWS OpsWorks Stacks sets these parameters to the first valid Availability Zone for the specified region and the corresponding default VPC subnet ID, respectively.
If you specify a nondefault VPC ID, note the following:
It must belong to a VPC in your account that is in the specified region.
You must specify a value for DefaultSubnetId .
For more information on how to use AWS OpsWorks Stacks with a VPC, see Running a Stack in a VPC . For more information on default VPC and EC2-Classic, see Supported Platforms .
:type Attributes: dict
:param Attributes: One or more user-defined key-value pairs to be added to the stack attributes.
(string) --
(string) --
:type ServiceRoleArn: string
:param ServiceRoleArn: [REQUIRED]
The stack's AWS Identity and Access Management (IAM) role, which allows AWS OpsWorks Stacks to work with AWS resources on your behalf. You must set this parameter to the Amazon Resource Name (ARN) for an existing IAM role. For more information about IAM ARNs, see Using Identifiers .
:type DefaultInstanceProfileArn: string
:param DefaultInstanceProfileArn: [REQUIRED]
The Amazon Resource Name (ARN) of an IAM profile that is the default profile for all of the stack's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type DefaultOs: string
:param DefaultOs: The stack's default operating system, which is installed on every instance unless you specify a different operating system when you create the instance. You can specify one of the following.
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
A custom AMI: Custom . You specify the custom AMI you want to use when you create instances. For more information, see Using Custom AMIs .
The default option is the current Amazon Linux version. For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
:type HostnameTheme: string
:param HostnameTheme: The stack's host name theme, with spaces replaced by underscores. The theme is used to generate host names for the stack's instances. By default, HostnameTheme is set to Layer_Dependent , which creates host names by appending integers to the layer's short name. The other themes are:
Baked_Goods
Clouds
Europe_Cities
Fruits
Greek_Deities
Legendary_creatures_from_Japan
Planets_and_Moons
Roman_Deities
Scottish_Islands
US_Cities
Wild_Cats
To obtain a generated host name, call GetHostNameSuggestion , which returns a host name based on the current theme.
:type DefaultAvailabilityZone: string
:param DefaultAvailabilityZone: The stack's default Availability Zone, which must be in the specified region. For more information, see Regions and Endpoints . If you also specify a value for DefaultSubnetId , the subnet must be in the same zone. For more information, see the VpcId parameter description.
:type DefaultSubnetId: string
:param DefaultSubnetId: The stack's default VPC subnet ID. This parameter is required if you specify a value for the VpcId parameter. All instances are launched into this subnet unless you specify otherwise when you create the instance. If you also specify a value for DefaultAvailabilityZone , the subnet must be in that zone. For information on default values and when this parameter is required, see the VpcId parameter description.
:type CustomJson: string
:param CustomJson: A string that contains user-defined, custom JSON. It can be used to override the corresponding default stack configuration attribute values or to pass data to recipes. The string should be in the following format:
'{\'key1\': \'value1\', \'key2\': \'value2\',...}'
For more information on custom JSON, see Use Custom JSON to Modify the Stack Configuration Attributes .
:type ConfigurationManager: dict
:param ConfigurationManager: The configuration manager. When you create a stack we recommend that you use the configuration manager to specify the Chef version: 12, 11.10, or 11.4 for Linux stacks, or 12.2 for Windows stacks. The default value for Linux stacks is currently 11.4.
Name (string) --The name. This parameter must be set to 'Chef'.
Version (string) --The Chef version. This parameter must be set to 12, 11.10, or 11.4 for Linux stacks, and to 12.2 for Windows stacks. The default value for Linux stacks is 11.4.
:type ChefConfiguration: dict
:param ChefConfiguration: A ChefConfiguration object that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .
ManageBerkshelf (boolean) --Whether to enable Berkshelf.
BerkshelfVersion (string) --The Berkshelf version.
:type UseCustomCookbooks: boolean
:param UseCustomCookbooks: Whether the stack uses custom cookbooks.
:type UseOpsworksSecurityGroups: boolean
:param UseOpsworksSecurityGroups: Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.
AWS OpsWorks Stacks provides a standard set of built-in security groups, one for each layer, which are associated with layers by default. With UseOpsworksSecurityGroups you can instead provide your own custom security groups. UseOpsworksSecurityGroups has the following settings:
True - AWS OpsWorks Stacks automatically associates the appropriate built-in security group with each layer (default setting). You can associate additional security groups with a layer after you create it, but you cannot delete the built-in security group.
False - AWS OpsWorks Stacks does not associate built-in security groups with layers. You must create appropriate EC2 security groups and associate a security group with each layer that you create. However, you can still manually associate a built-in security group with a layer on creation; custom security groups are required only for those layers that need custom settings.
For more information, see Create a New Stack .
:type CustomCookbooksSource: dict
:param CustomCookbooksSource: Contains the information required to retrieve an app or cookbook from a repository. For more information, see Creating Apps or Custom Recipes and Cookbooks .
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type DefaultSshKeyName: string
:param DefaultSshKeyName: A default Amazon EC2 key pair name. The default value is none. If you specify a key pair name, AWS OpsWorks installs the public key on the instance and you can use the private key with an SSH client to log in to the instance. For more information, see Using SSH to Communicate with an Instance and Managing SSH Access . You can override this setting by specifying a different key pair, or no key pair, when you create an instance .
:type DefaultRootDeviceType: string
:param DefaultRootDeviceType: The default root device type. This value is the default for all instances in the stack, but you can override it when you create an instance. The default option is instance-store . For more information, see Storage for the Root Device .
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
Auto-update - Set this parameter to LATEST . AWS OpsWorks Stacks automatically installs new agent versions on the stack's instances as soon as they are available.
Fixed version - Set this parameter to your preferred agent version. To update the agent version, you must edit the stack configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the stack's instances.
The default setting is the most recent release of the agent. To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.
Note
You can also specify an agent version when you create or update an instance, which overrides the stack's default setting.
:rtype: dict
:return: {
'StackId': 'string'
} | entailment |
def update_app(AppId=None, Name=None, Description=None, DataSources=None, Type=None, AppSource=None, Domains=None, EnableSsl=None, SslConfiguration=None, Attributes=None, Environment=None):
"""
Updates a specified app.
See also: AWS API Documentation
:example: response = client.update_app(
AppId='string',
Name='string',
Description='string',
DataSources=[
{
'Type': 'string',
'Arn': 'string',
'DatabaseName': 'string'
},
],
Type='aws-flow-ruby'|'java'|'rails'|'php'|'nodejs'|'static'|'other',
AppSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
Domains=[
'string',
],
EnableSsl=True|False,
SslConfiguration={
'Certificate': 'string',
'PrivateKey': 'string',
'Chain': 'string'
},
Attributes={
'string': 'string'
},
Environment=[
{
'Key': 'string',
'Value': 'string',
'Secure': True|False
},
]
)
:type AppId: string
:param AppId: [REQUIRED]
The app ID.
:type Name: string
:param Name: The app name.
:type Description: string
:param Description: A description of the app.
:type DataSources: list
:param DataSources: The app's data sources.
(dict) --Describes an app's data source.
Type (string) --The data source's type, AutoSelectOpsworksMysqlInstance , OpsworksMysqlInstance , or RdsDbInstance .
Arn (string) --The data source's ARN.
DatabaseName (string) --The database name.
:type Type: string
:param Type: The app type.
:type AppSource: dict
:param AppSource: A Source object that specifies the app repository.
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type Domains: list
:param Domains: The app's virtual host settings, with multiple domains separated by commas. For example: 'www.example.com, example.com'
(string) --
:type EnableSsl: boolean
:param EnableSsl: Whether SSL is enabled for the app.
:type SslConfiguration: dict
:param SslConfiguration: An SslConfiguration object with the SSL configuration.
Certificate (string) -- [REQUIRED]The contents of the certificate's domain.crt file.
PrivateKey (string) -- [REQUIRED]The private key; the contents of the certificate's domain.kex file.
Chain (string) --Optional. Can be used to specify an intermediate certificate authority key or client authentication.
:type Attributes: dict
:param Attributes: One or more user-defined key/value pairs to be added to the stack attributes.
(string) --
(string) --
:type Environment: list
:param Environment: An array of EnvironmentVariable objects that specify environment variables to be associated with the app. After you deploy the app, these variables are defined on the associated app server instances.For more information, see Environment Variables .
There is no specific limit on the number of environment variables. However, the size of the associated data structure - which includes the variables' names, values, and protected flag values - cannot exceed 10 KB (10240 Bytes). This limit should accommodate most if not all use cases. Exceeding it will cause an exception with the message, 'Environment: is too large (maximum is 10KB).'
Note
This parameter is supported only by Chef 11.10 stacks. If you have specified one or more environment variables, you cannot modify the stack's Chef version.
(dict) --Represents an app's environment variable.
Key (string) -- [REQUIRED](Required) The environment variable's name, which can consist of up to 64 characters and must be specified. The name can contain upper- and lowercase letters, numbers, and underscores (_), but it must start with a letter or underscore.
Value (string) -- [REQUIRED](Optional) The environment variable's value, which can be left empty. If you specify a value, it can contain up to 256 characters, which must all be printable.
Secure (boolean) --(Optional) Whether the variable's value will be returned by the DescribeApps action. To conceal an environment variable's value, set Secure to true . DescribeApps then returns *****FILTERED***** instead of the actual value. The default value for Secure is false .
"""
pass | Updates a specified app.
See also: AWS API Documentation
:example: response = client.update_app(
AppId='string',
Name='string',
Description='string',
DataSources=[
{
'Type': 'string',
'Arn': 'string',
'DatabaseName': 'string'
},
],
Type='aws-flow-ruby'|'java'|'rails'|'php'|'nodejs'|'static'|'other',
AppSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
Domains=[
'string',
],
EnableSsl=True|False,
SslConfiguration={
'Certificate': 'string',
'PrivateKey': 'string',
'Chain': 'string'
},
Attributes={
'string': 'string'
},
Environment=[
{
'Key': 'string',
'Value': 'string',
'Secure': True|False
},
]
)
:type AppId: string
:param AppId: [REQUIRED]
The app ID.
:type Name: string
:param Name: The app name.
:type Description: string
:param Description: A description of the app.
:type DataSources: list
:param DataSources: The app's data sources.
(dict) --Describes an app's data source.
Type (string) --The data source's type, AutoSelectOpsworksMysqlInstance , OpsworksMysqlInstance , or RdsDbInstance .
Arn (string) --The data source's ARN.
DatabaseName (string) --The database name.
:type Type: string
:param Type: The app type.
:type AppSource: dict
:param AppSource: A Source object that specifies the app repository.
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type Domains: list
:param Domains: The app's virtual host settings, with multiple domains separated by commas. For example: 'www.example.com, example.com'
(string) --
:type EnableSsl: boolean
:param EnableSsl: Whether SSL is enabled for the app.
:type SslConfiguration: dict
:param SslConfiguration: An SslConfiguration object with the SSL configuration.
Certificate (string) -- [REQUIRED]The contents of the certificate's domain.crt file.
PrivateKey (string) -- [REQUIRED]The private key; the contents of the certificate's domain.kex file.
Chain (string) --Optional. Can be used to specify an intermediate certificate authority key or client authentication.
:type Attributes: dict
:param Attributes: One or more user-defined key/value pairs to be added to the stack attributes.
(string) --
(string) --
:type Environment: list
:param Environment: An array of EnvironmentVariable objects that specify environment variables to be associated with the app. After you deploy the app, these variables are defined on the associated app server instances.For more information, see Environment Variables .
There is no specific limit on the number of environment variables. However, the size of the associated data structure - which includes the variables' names, values, and protected flag values - cannot exceed 10 KB (10240 Bytes). This limit should accommodate most if not all use cases. Exceeding it will cause an exception with the message, 'Environment: is too large (maximum is 10KB).'
Note
This parameter is supported only by Chef 11.10 stacks. If you have specified one or more environment variables, you cannot modify the stack's Chef version.
(dict) --Represents an app's environment variable.
Key (string) -- [REQUIRED](Required) The environment variable's name, which can consist of up to 64 characters and must be specified. The name can contain upper- and lowercase letters, numbers, and underscores (_), but it must start with a letter or underscore.
Value (string) -- [REQUIRED](Optional) The environment variable's value, which can be left empty. If you specify a value, it can contain up to 256 characters, which must all be printable.
Secure (boolean) --(Optional) Whether the variable's value will be returned by the DescribeApps action. To conceal an environment variable's value, set Secure to true . DescribeApps then returns *****FILTERED***** instead of the actual value. The default value for Secure is false . | entailment |
def update_instance(InstanceId=None, LayerIds=None, InstanceType=None, AutoScalingType=None, Hostname=None, Os=None, AmiId=None, SshKeyName=None, Architecture=None, InstallUpdatesOnBoot=None, EbsOptimized=None, AgentVersion=None):
"""
Updates a specified instance.
See also: AWS API Documentation
:example: response = client.update_instance(
InstanceId='string',
LayerIds=[
'string',
],
InstanceType='string',
AutoScalingType='load'|'timer',
Hostname='string',
Os='string',
AmiId='string',
SshKeyName='string',
Architecture='x86_64'|'i386',
InstallUpdatesOnBoot=True|False,
EbsOptimized=True|False,
AgentVersion='string'
)
:type InstanceId: string
:param InstanceId: [REQUIRED]
The instance ID.
:type LayerIds: list
:param LayerIds: The instance's layer IDs.
(string) --
:type InstanceType: string
:param InstanceType: The instance type, such as t2.micro . For a list of supported instance types, open the stack in the console, choose Instances , and choose + Instance . The Size list contains the currently supported types. For more information, see Instance Families and Types . The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table.
:type AutoScalingType: string
:param AutoScalingType: For load-based or time-based instances, the type. Windows stacks can use only time-based instances.
:type Hostname: string
:param Hostname: The instance host name.
:type Os: string
:param Os: The instance's operating system, which must be set to one of the following. You cannot update an instance that is using a custom AMI.
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
The default option is the current Amazon Linux version. If you set this parameter to Custom , you must use the AmiId parameter to specify the custom AMI that you want to use. For more information on the supported operating systems, see Operating Systems . For more information on how to use custom AMIs with OpsWorks, see Using Custom AMIs .
Note
You can specify a different Linux operating system for the updated stack, but you cannot change from Linux to Windows or Windows to Linux.
:type AmiId: string
:param AmiId: The ID of the AMI that was used to create the instance. The value of this parameter must be the same AMI ID that the instance is already using. You cannot apply a new AMI to an instance by running UpdateInstance. UpdateInstance does not work on instances that are using custom AMIs.
:type SshKeyName: string
:param SshKeyName: The instance's Amazon EC2 key name.
:type Architecture: string
:param Architecture: The instance architecture. Instance types do not necessarily support both architectures. For a list of the architectures that are supported by the different instance types, see Instance Families and Types .
:type InstallUpdatesOnBoot: boolean
:param InstallUpdatesOnBoot: Whether to install operating system and package updates when the instance boots. The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.
Note
We strongly recommend using the default value of true , to ensure that your instances have the latest security updates.
:type EbsOptimized: boolean
:param EbsOptimized: This property cannot be updated.
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
INHERIT - Use the stack's default agent version setting.
version_number - Use the specified agent version. This value overrides the stack's default setting. To update the agent version, you must edit the instance configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the instance.
The default setting is INHERIT . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions .
AgentVersion cannot be set to Chef 12.2.
"""
pass | Updates a specified instance.
See also: AWS API Documentation
:example: response = client.update_instance(
InstanceId='string',
LayerIds=[
'string',
],
InstanceType='string',
AutoScalingType='load'|'timer',
Hostname='string',
Os='string',
AmiId='string',
SshKeyName='string',
Architecture='x86_64'|'i386',
InstallUpdatesOnBoot=True|False,
EbsOptimized=True|False,
AgentVersion='string'
)
:type InstanceId: string
:param InstanceId: [REQUIRED]
The instance ID.
:type LayerIds: list
:param LayerIds: The instance's layer IDs.
(string) --
:type InstanceType: string
:param InstanceType: The instance type, such as t2.micro . For a list of supported instance types, open the stack in the console, choose Instances , and choose + Instance . The Size list contains the currently supported types. For more information, see Instance Families and Types . The parameter values that you use to specify the various types are in the API Name column of the Available Instance Types table.
:type AutoScalingType: string
:param AutoScalingType: For load-based or time-based instances, the type. Windows stacks can use only time-based instances.
:type Hostname: string
:param Hostname: The instance host name.
:type Os: string
:param Os: The instance's operating system, which must be set to one of the following. You cannot update an instance that is using a custom AMI.
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
The default option is the current Amazon Linux version. If you set this parameter to Custom , you must use the AmiId parameter to specify the custom AMI that you want to use. For more information on the supported operating systems, see Operating Systems . For more information on how to use custom AMIs with OpsWorks, see Using Custom AMIs .
Note
You can specify a different Linux operating system for the updated stack, but you cannot change from Linux to Windows or Windows to Linux.
:type AmiId: string
:param AmiId: The ID of the AMI that was used to create the instance. The value of this parameter must be the same AMI ID that the instance is already using. You cannot apply a new AMI to an instance by running UpdateInstance. UpdateInstance does not work on instances that are using custom AMIs.
:type SshKeyName: string
:param SshKeyName: The instance's Amazon EC2 key name.
:type Architecture: string
:param Architecture: The instance architecture. Instance types do not necessarily support both architectures. For a list of the architectures that are supported by the different instance types, see Instance Families and Types .
:type InstallUpdatesOnBoot: boolean
:param InstallUpdatesOnBoot: Whether to install operating system and package updates when the instance boots. The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or by manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.
Note
We strongly recommend using the default value of true , to ensure that your instances have the latest security updates.
:type EbsOptimized: boolean
:param EbsOptimized: This property cannot be updated.
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
INHERIT - Use the stack's default agent version setting.
version_number - Use the specified agent version. This value overrides the stack's default setting. To update the agent version, you must edit the instance configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the instance.
The default setting is INHERIT . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions .
AgentVersion cannot be set to Chef 12.2. | entailment |
def update_layer(LayerId=None, Name=None, Shortname=None, Attributes=None, CloudWatchLogsConfiguration=None, CustomInstanceProfileArn=None, CustomJson=None, CustomSecurityGroupIds=None, Packages=None, VolumeConfigurations=None, EnableAutoHealing=None, AutoAssignElasticIps=None, AutoAssignPublicIps=None, CustomRecipes=None, InstallUpdatesOnBoot=None, UseEbsOptimizedInstances=None, LifecycleEventConfiguration=None):
"""
Updates a specified layer.
See also: AWS API Documentation
:example: response = client.update_layer(
LayerId='string',
Name='string',
Shortname='string',
Attributes={
'string': 'string'
},
CloudWatchLogsConfiguration={
'Enabled': True|False,
'LogStreams': [
{
'LogGroupName': 'string',
'DatetimeFormat': 'string',
'TimeZone': 'LOCAL'|'UTC',
'File': 'string',
'FileFingerprintLines': 'string',
'MultiLineStartPattern': 'string',
'InitialPosition': 'start_of_file'|'end_of_file',
'Encoding': 'ascii'|'big5'|'big5hkscs'|'cp037'|'cp424'|'cp437'|'cp500'|'cp720'|'cp737'|'cp775'|'cp850'|'cp852'|'cp855'|'cp856'|'cp857'|'cp858'|'cp860'|'cp861'|'cp862'|'cp863'|'cp864'|'cp865'|'cp866'|'cp869'|'cp874'|'cp875'|'cp932'|'cp949'|'cp950'|'cp1006'|'cp1026'|'cp1140'|'cp1250'|'cp1251'|'cp1252'|'cp1253'|'cp1254'|'cp1255'|'cp1256'|'cp1257'|'cp1258'|'euc_jp'|'euc_jis_2004'|'euc_jisx0213'|'euc_kr'|'gb2312'|'gbk'|'gb18030'|'hz'|'iso2022_jp'|'iso2022_jp_1'|'iso2022_jp_2'|'iso2022_jp_2004'|'iso2022_jp_3'|'iso2022_jp_ext'|'iso2022_kr'|'latin_1'|'iso8859_2'|'iso8859_3'|'iso8859_4'|'iso8859_5'|'iso8859_6'|'iso8859_7'|'iso8859_8'|'iso8859_9'|'iso8859_10'|'iso8859_13'|'iso8859_14'|'iso8859_15'|'iso8859_16'|'johab'|'koi8_r'|'koi8_u'|'mac_cyrillic'|'mac_greek'|'mac_iceland'|'mac_latin2'|'mac_roman'|'mac_turkish'|'ptcp154'|'shift_jis'|'shift_jis_2004'|'shift_jisx0213'|'utf_32'|'utf_32_be'|'utf_32_le'|'utf_16'|'utf_16_be'|'utf_16_le'|'utf_7'|'utf_8'|'utf_8_sig',
'BufferDuration': 123,
'BatchCount': 123,
'BatchSize': 123
},
]
},
CustomInstanceProfileArn='string',
CustomJson='string',
CustomSecurityGroupIds=[
'string',
],
Packages=[
'string',
],
VolumeConfigurations=[
{
'MountPoint': 'string',
'RaidLevel': 123,
'NumberOfDisks': 123,
'Size': 123,
'VolumeType': 'string',
'Iops': 123
},
],
EnableAutoHealing=True|False,
AutoAssignElasticIps=True|False,
AutoAssignPublicIps=True|False,
CustomRecipes={
'Setup': [
'string',
],
'Configure': [
'string',
],
'Deploy': [
'string',
],
'Undeploy': [
'string',
],
'Shutdown': [
'string',
]
},
InstallUpdatesOnBoot=True|False,
UseEbsOptimizedInstances=True|False,
LifecycleEventConfiguration={
'Shutdown': {
'ExecutionTimeout': 123,
'DelayUntilElbConnectionsDrained': True|False
}
}
)
:type LayerId: string
:param LayerId: [REQUIRED]
The layer ID.
:type Name: string
:param Name: The layer name, which is used by the console.
:type Shortname: string
:param Shortname: For custom layers only, use this parameter to specify the layer's short name, which is used internally by AWS OpsWorks Stacks and by Chef. The short name is also used as the name for the directory where your app files are installed. It can have a maximum of 200 characters and must be in the following format: /A[a-z0-9-_.]+Z/.
The built-in layers' short names are defined by AWS OpsWorks Stacks. For more information, see the Layer Reference
:type Attributes: dict
:param Attributes: One or more user-defined key/value pairs to be added to the stack attributes.
(string) --
(string) --
:type CloudWatchLogsConfiguration: dict
:param CloudWatchLogsConfiguration: Specifies CloudWatch Logs configuration options for the layer. For more information, see CloudWatchLogsLogStream .
Enabled (boolean) --Whether CloudWatch Logs is enabled for a layer.
LogStreams (list) --A list of configuration options for CloudWatch Logs.
(dict) --Describes the Amazon CloudWatch logs configuration for a layer. For detailed information about members of this data type, see the CloudWatch Logs Agent Reference .
LogGroupName (string) --Specifies the destination log group. A log group is created automatically if it doesn't already exist. Log group names can be between 1 and 512 characters long. Allowed characters include a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period).
DatetimeFormat (string) --Specifies how the time stamp is extracted from logs. For more information, see the CloudWatch Logs Agent Reference .
TimeZone (string) --Specifies the time zone of log event time stamps.
File (string) --Specifies log files that you want to push to CloudWatch Logs.
File can point to a specific file or multiple files (by using wild card characters such as /var/log/system.log* ). Only the latest file is pushed to CloudWatch Logs, based on file modification time. We recommend that you use wild card characters to specify a series of files of the same type, such as access_log.2014-06-01-01 , access_log.2014-06-01-02 , and so on by using a pattern like access_log.* . Don't use a wildcard to match multiple file types, such as access_log_80 and access_log_443 . To specify multiple, different file types, add another log stream entry to the configuration file, so that each log file type is stored in a different log group.
Zipped files are not supported.
FileFingerprintLines (string) --Specifies the range of lines for identifying a file. The valid values are one number, or two dash-delimited numbers, such as '1', '2-5'. The default value is '1', meaning the first line is used to calculate the fingerprint. Fingerprint lines are not sent to CloudWatch Logs unless all specified lines are available.
MultiLineStartPattern (string) --Specifies the pattern for identifying the start of a log message.
InitialPosition (string) --Specifies where to start to read data (start_of_file or end_of_file). The default is start_of_file. This setting is only used if there is no state persisted for that log stream.
Encoding (string) --Specifies the encoding of the log file so that the file can be read correctly. The default is utf_8 . Encodings supported by Python codecs.decode() can be used here.
BufferDuration (integer) --Specifies the time duration for the batching of log events. The minimum value is 5000ms and default value is 5000ms.
BatchCount (integer) --Specifies the max number of log events in a batch, up to 10000. The default value is 1000.
BatchSize (integer) --Specifies the maximum size of log events in a batch, in bytes, up to 1048576 bytes. The default value is 32768 bytes. This size is calculated as the sum of all event messages in UTF-8, plus 26 bytes for each log event.
:type CustomInstanceProfileArn: string
:param CustomInstanceProfileArn: The ARN of an IAM profile to be used for all of the layer's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type CustomJson: string
:param CustomJson: A JSON-formatted string containing custom stack configuration and deployment attributes to be installed on the layer's instances. For more information, see Using Custom JSON .
:type CustomSecurityGroupIds: list
:param CustomSecurityGroupIds: An array containing the layer's custom security group IDs.
(string) --
:type Packages: list
:param Packages: An array of Package objects that describe the layer's packages.
(string) --
:type VolumeConfigurations: list
:param VolumeConfigurations: A VolumeConfigurations object that describes the layer's Amazon EBS volumes.
(dict) --Describes an Amazon EBS volume configuration.
MountPoint (string) -- [REQUIRED]The volume mount point. For example '/dev/sdh'.
RaidLevel (integer) --The volume RAID level .
NumberOfDisks (integer) -- [REQUIRED]The number of disks in the volume.
Size (integer) -- [REQUIRED]The volume size.
VolumeType (string) --The volume type:
standard - Magnetic
io1 - Provisioned IOPS (SSD)
gp2 - General Purpose (SSD)
Iops (integer) --For PIOPS volumes, the IOPS per disk.
:type EnableAutoHealing: boolean
:param EnableAutoHealing: Whether to disable auto healing for the layer.
:type AutoAssignElasticIps: boolean
:param AutoAssignElasticIps: Whether to automatically assign an Elastic IP address to the layer's instances. For more information, see How to Edit a Layer .
:type AutoAssignPublicIps: boolean
:param AutoAssignPublicIps: For stacks that are running in a VPC, whether to automatically assign a public IP address to the layer's instances. For more information, see How to Edit a Layer .
:type CustomRecipes: dict
:param CustomRecipes: A LayerCustomRecipes object that specifies the layer's custom recipes.
Setup (list) --An array of custom recipe names to be run following a setup event.
(string) --
Configure (list) --An array of custom recipe names to be run following a configure event.
(string) --
Deploy (list) --An array of custom recipe names to be run following a deploy event.
(string) --
Undeploy (list) --An array of custom recipe names to be run following a undeploy event.
(string) --
Shutdown (list) --An array of custom recipe names to be run following a shutdown event.
(string) --
:type InstallUpdatesOnBoot: boolean
:param InstallUpdatesOnBoot: Whether to install operating system and package updates when the instance boots. The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.
Note
We strongly recommend using the default value of true , to ensure that your instances have the latest security updates.
:type UseEbsOptimizedInstances: boolean
:param UseEbsOptimizedInstances: Whether to use Amazon EBS-optimized instances.
:type LifecycleEventConfiguration: dict
:param LifecycleEventConfiguration:
Shutdown (dict) --A ShutdownEventConfiguration object that specifies the Shutdown event configuration.
ExecutionTimeout (integer) --The time, in seconds, that AWS OpsWorks Stacks will wait after triggering a Shutdown event before shutting down an instance.
DelayUntilElbConnectionsDrained (boolean) --Whether to enable Elastic Load Balancing connection draining. For more information, see Connection Draining
"""
pass | Updates a specified layer.
See also: AWS API Documentation
:example: response = client.update_layer(
LayerId='string',
Name='string',
Shortname='string',
Attributes={
'string': 'string'
},
CloudWatchLogsConfiguration={
'Enabled': True|False,
'LogStreams': [
{
'LogGroupName': 'string',
'DatetimeFormat': 'string',
'TimeZone': 'LOCAL'|'UTC',
'File': 'string',
'FileFingerprintLines': 'string',
'MultiLineStartPattern': 'string',
'InitialPosition': 'start_of_file'|'end_of_file',
'Encoding': 'ascii'|'big5'|'big5hkscs'|'cp037'|'cp424'|'cp437'|'cp500'|'cp720'|'cp737'|'cp775'|'cp850'|'cp852'|'cp855'|'cp856'|'cp857'|'cp858'|'cp860'|'cp861'|'cp862'|'cp863'|'cp864'|'cp865'|'cp866'|'cp869'|'cp874'|'cp875'|'cp932'|'cp949'|'cp950'|'cp1006'|'cp1026'|'cp1140'|'cp1250'|'cp1251'|'cp1252'|'cp1253'|'cp1254'|'cp1255'|'cp1256'|'cp1257'|'cp1258'|'euc_jp'|'euc_jis_2004'|'euc_jisx0213'|'euc_kr'|'gb2312'|'gbk'|'gb18030'|'hz'|'iso2022_jp'|'iso2022_jp_1'|'iso2022_jp_2'|'iso2022_jp_2004'|'iso2022_jp_3'|'iso2022_jp_ext'|'iso2022_kr'|'latin_1'|'iso8859_2'|'iso8859_3'|'iso8859_4'|'iso8859_5'|'iso8859_6'|'iso8859_7'|'iso8859_8'|'iso8859_9'|'iso8859_10'|'iso8859_13'|'iso8859_14'|'iso8859_15'|'iso8859_16'|'johab'|'koi8_r'|'koi8_u'|'mac_cyrillic'|'mac_greek'|'mac_iceland'|'mac_latin2'|'mac_roman'|'mac_turkish'|'ptcp154'|'shift_jis'|'shift_jis_2004'|'shift_jisx0213'|'utf_32'|'utf_32_be'|'utf_32_le'|'utf_16'|'utf_16_be'|'utf_16_le'|'utf_7'|'utf_8'|'utf_8_sig',
'BufferDuration': 123,
'BatchCount': 123,
'BatchSize': 123
},
]
},
CustomInstanceProfileArn='string',
CustomJson='string',
CustomSecurityGroupIds=[
'string',
],
Packages=[
'string',
],
VolumeConfigurations=[
{
'MountPoint': 'string',
'RaidLevel': 123,
'NumberOfDisks': 123,
'Size': 123,
'VolumeType': 'string',
'Iops': 123
},
],
EnableAutoHealing=True|False,
AutoAssignElasticIps=True|False,
AutoAssignPublicIps=True|False,
CustomRecipes={
'Setup': [
'string',
],
'Configure': [
'string',
],
'Deploy': [
'string',
],
'Undeploy': [
'string',
],
'Shutdown': [
'string',
]
},
InstallUpdatesOnBoot=True|False,
UseEbsOptimizedInstances=True|False,
LifecycleEventConfiguration={
'Shutdown': {
'ExecutionTimeout': 123,
'DelayUntilElbConnectionsDrained': True|False
}
}
)
:type LayerId: string
:param LayerId: [REQUIRED]
The layer ID.
:type Name: string
:param Name: The layer name, which is used by the console.
:type Shortname: string
:param Shortname: For custom layers only, use this parameter to specify the layer's short name, which is used internally by AWS OpsWorks Stacks and by Chef. The short name is also used as the name for the directory where your app files are installed. It can have a maximum of 200 characters and must be in the following format: /A[a-z0-9-_.]+Z/.
The built-in layers' short names are defined by AWS OpsWorks Stacks. For more information, see the Layer Reference
:type Attributes: dict
:param Attributes: One or more user-defined key/value pairs to be added to the stack attributes.
(string) --
(string) --
:type CloudWatchLogsConfiguration: dict
:param CloudWatchLogsConfiguration: Specifies CloudWatch Logs configuration options for the layer. For more information, see CloudWatchLogsLogStream .
Enabled (boolean) --Whether CloudWatch Logs is enabled for a layer.
LogStreams (list) --A list of configuration options for CloudWatch Logs.
(dict) --Describes the Amazon CloudWatch logs configuration for a layer. For detailed information about members of this data type, see the CloudWatch Logs Agent Reference .
LogGroupName (string) --Specifies the destination log group. A log group is created automatically if it doesn't already exist. Log group names can be between 1 and 512 characters long. Allowed characters include a-z, A-Z, 0-9, '_' (underscore), '-' (hyphen), '/' (forward slash), and '.' (period).
DatetimeFormat (string) --Specifies how the time stamp is extracted from logs. For more information, see the CloudWatch Logs Agent Reference .
TimeZone (string) --Specifies the time zone of log event time stamps.
File (string) --Specifies log files that you want to push to CloudWatch Logs.
File can point to a specific file or multiple files (by using wild card characters such as /var/log/system.log* ). Only the latest file is pushed to CloudWatch Logs, based on file modification time. We recommend that you use wild card characters to specify a series of files of the same type, such as access_log.2014-06-01-01 , access_log.2014-06-01-02 , and so on by using a pattern like access_log.* . Don't use a wildcard to match multiple file types, such as access_log_80 and access_log_443 . To specify multiple, different file types, add another log stream entry to the configuration file, so that each log file type is stored in a different log group.
Zipped files are not supported.
FileFingerprintLines (string) --Specifies the range of lines for identifying a file. The valid values are one number, or two dash-delimited numbers, such as '1', '2-5'. The default value is '1', meaning the first line is used to calculate the fingerprint. Fingerprint lines are not sent to CloudWatch Logs unless all specified lines are available.
MultiLineStartPattern (string) --Specifies the pattern for identifying the start of a log message.
InitialPosition (string) --Specifies where to start to read data (start_of_file or end_of_file). The default is start_of_file. This setting is only used if there is no state persisted for that log stream.
Encoding (string) --Specifies the encoding of the log file so that the file can be read correctly. The default is utf_8 . Encodings supported by Python codecs.decode() can be used here.
BufferDuration (integer) --Specifies the time duration for the batching of log events. The minimum value is 5000ms and default value is 5000ms.
BatchCount (integer) --Specifies the max number of log events in a batch, up to 10000. The default value is 1000.
BatchSize (integer) --Specifies the maximum size of log events in a batch, in bytes, up to 1048576 bytes. The default value is 32768 bytes. This size is calculated as the sum of all event messages in UTF-8, plus 26 bytes for each log event.
:type CustomInstanceProfileArn: string
:param CustomInstanceProfileArn: The ARN of an IAM profile to be used for all of the layer's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type CustomJson: string
:param CustomJson: A JSON-formatted string containing custom stack configuration and deployment attributes to be installed on the layer's instances. For more information, see Using Custom JSON .
:type CustomSecurityGroupIds: list
:param CustomSecurityGroupIds: An array containing the layer's custom security group IDs.
(string) --
:type Packages: list
:param Packages: An array of Package objects that describe the layer's packages.
(string) --
:type VolumeConfigurations: list
:param VolumeConfigurations: A VolumeConfigurations object that describes the layer's Amazon EBS volumes.
(dict) --Describes an Amazon EBS volume configuration.
MountPoint (string) -- [REQUIRED]The volume mount point. For example '/dev/sdh'.
RaidLevel (integer) --The volume RAID level .
NumberOfDisks (integer) -- [REQUIRED]The number of disks in the volume.
Size (integer) -- [REQUIRED]The volume size.
VolumeType (string) --The volume type:
standard - Magnetic
io1 - Provisioned IOPS (SSD)
gp2 - General Purpose (SSD)
Iops (integer) --For PIOPS volumes, the IOPS per disk.
:type EnableAutoHealing: boolean
:param EnableAutoHealing: Whether to disable auto healing for the layer.
:type AutoAssignElasticIps: boolean
:param AutoAssignElasticIps: Whether to automatically assign an Elastic IP address to the layer's instances. For more information, see How to Edit a Layer .
:type AutoAssignPublicIps: boolean
:param AutoAssignPublicIps: For stacks that are running in a VPC, whether to automatically assign a public IP address to the layer's instances. For more information, see How to Edit a Layer .
:type CustomRecipes: dict
:param CustomRecipes: A LayerCustomRecipes object that specifies the layer's custom recipes.
Setup (list) --An array of custom recipe names to be run following a setup event.
(string) --
Configure (list) --An array of custom recipe names to be run following a configure event.
(string) --
Deploy (list) --An array of custom recipe names to be run following a deploy event.
(string) --
Undeploy (list) --An array of custom recipe names to be run following a undeploy event.
(string) --
Shutdown (list) --An array of custom recipe names to be run following a shutdown event.
(string) --
:type InstallUpdatesOnBoot: boolean
:param InstallUpdatesOnBoot: Whether to install operating system and package updates when the instance boots. The default value is true . To control when updates are installed, set this value to false . You must then update your instances manually by using CreateDeployment to run the update_dependencies stack command or manually running yum (Amazon Linux) or apt-get (Ubuntu) on the instances.
Note
We strongly recommend using the default value of true , to ensure that your instances have the latest security updates.
:type UseEbsOptimizedInstances: boolean
:param UseEbsOptimizedInstances: Whether to use Amazon EBS-optimized instances.
:type LifecycleEventConfiguration: dict
:param LifecycleEventConfiguration:
Shutdown (dict) --A ShutdownEventConfiguration object that specifies the Shutdown event configuration.
ExecutionTimeout (integer) --The time, in seconds, that AWS OpsWorks Stacks will wait after triggering a Shutdown event before shutting down an instance.
DelayUntilElbConnectionsDrained (boolean) --Whether to enable Elastic Load Balancing connection draining. For more information, see Connection Draining | entailment |
def update_stack(StackId=None, Name=None, Attributes=None, ServiceRoleArn=None, DefaultInstanceProfileArn=None, DefaultOs=None, HostnameTheme=None, DefaultAvailabilityZone=None, DefaultSubnetId=None, CustomJson=None, ConfigurationManager=None, ChefConfiguration=None, UseCustomCookbooks=None, CustomCookbooksSource=None, DefaultSshKeyName=None, DefaultRootDeviceType=None, UseOpsworksSecurityGroups=None, AgentVersion=None):
"""
Updates a specified stack.
See also: AWS API Documentation
:example: response = client.update_stack(
StackId='string',
Name='string',
Attributes={
'string': 'string'
},
ServiceRoleArn='string',
DefaultInstanceProfileArn='string',
DefaultOs='string',
HostnameTheme='string',
DefaultAvailabilityZone='string',
DefaultSubnetId='string',
CustomJson='string',
ConfigurationManager={
'Name': 'string',
'Version': 'string'
},
ChefConfiguration={
'ManageBerkshelf': True|False,
'BerkshelfVersion': 'string'
},
UseCustomCookbooks=True|False,
CustomCookbooksSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
DefaultSshKeyName='string',
DefaultRootDeviceType='ebs'|'instance-store',
UseOpsworksSecurityGroups=True|False,
AgentVersion='string'
)
:type StackId: string
:param StackId: [REQUIRED]
The stack ID.
:type Name: string
:param Name: The stack's new name.
:type Attributes: dict
:param Attributes: One or more user-defined key-value pairs to be added to the stack attributes.
(string) --
(string) --
:type ServiceRoleArn: string
:param ServiceRoleArn: Do not use this parameter. You cannot update a stack's service role.
:type DefaultInstanceProfileArn: string
:param DefaultInstanceProfileArn: The ARN of an IAM profile that is the default profile for all of the stack's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type DefaultOs: string
:param DefaultOs: The stack's operating system, which must be set to one of the following:
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
A custom AMI: Custom . You specify the custom AMI you want to use when you create instances. For more information on how to use custom AMIs with OpsWorks, see Using Custom AMIs .
The default option is the stack's current operating system. For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
:type HostnameTheme: string
:param HostnameTheme: The stack's new host name theme, with spaces replaced by underscores. The theme is used to generate host names for the stack's instances. By default, HostnameTheme is set to Layer_Dependent , which creates host names by appending integers to the layer's short name. The other themes are:
Baked_Goods
Clouds
Europe_Cities
Fruits
Greek_Deities
Legendary_creatures_from_Japan
Planets_and_Moons
Roman_Deities
Scottish_Islands
US_Cities
Wild_Cats
To obtain a generated host name, call GetHostNameSuggestion , which returns a host name based on the current theme.
:type DefaultAvailabilityZone: string
:param DefaultAvailabilityZone: The stack's default Availability Zone, which must be in the stack's region. For more information, see Regions and Endpoints . If you also specify a value for DefaultSubnetId , the subnet must be in the same zone. For more information, see CreateStack .
:type DefaultSubnetId: string
:param DefaultSubnetId: The stack's default VPC subnet ID. This parameter is required if you specify a value for the VpcId parameter. All instances are launched into this subnet unless you specify otherwise when you create the instance. If you also specify a value for DefaultAvailabilityZone , the subnet must be in that zone. For information on default values and when this parameter is required, see the VpcId parameter description.
:type CustomJson: string
:param CustomJson: A string that contains user-defined, custom JSON. It can be used to override the corresponding default stack configuration JSON values or to pass data to recipes. The string should be in the following format:
'{\'key1\': \'value1\', \'key2\': \'value2\',...}'
For more information on custom JSON, see Use Custom JSON to Modify the Stack Configuration Attributes .
:type ConfigurationManager: dict
:param ConfigurationManager: The configuration manager. When you update a stack, we recommend that you use the configuration manager to specify the Chef version: 12, 11.10, or 11.4 for Linux stacks, or 12.2 for Windows stacks. The default value for Linux stacks is currently 11.4.
Name (string) --The name. This parameter must be set to 'Chef'.
Version (string) --The Chef version. This parameter must be set to 12, 11.10, or 11.4 for Linux stacks, and to 12.2 for Windows stacks. The default value for Linux stacks is 11.4.
:type ChefConfiguration: dict
:param ChefConfiguration: A ChefConfiguration object that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .
ManageBerkshelf (boolean) --Whether to enable Berkshelf.
BerkshelfVersion (string) --The Berkshelf version.
:type UseCustomCookbooks: boolean
:param UseCustomCookbooks: Whether the stack uses custom cookbooks.
:type CustomCookbooksSource: dict
:param CustomCookbooksSource: Contains the information required to retrieve an app or cookbook from a repository. For more information, see Creating Apps or Custom Recipes and Cookbooks .
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type DefaultSshKeyName: string
:param DefaultSshKeyName: A default Amazon EC2 key-pair name. The default value is none . If you specify a key-pair name, AWS OpsWorks Stacks installs the public key on the instance and you can use the private key with an SSH client to log in to the instance. For more information, see Using SSH to Communicate with an Instance and Managing SSH Access . You can override this setting by specifying a different key pair, or no key pair, when you create an instance .
:type DefaultRootDeviceType: string
:param DefaultRootDeviceType: The default root device type. This value is used by default for all instances in the stack, but you can override it when you create an instance. For more information, see Storage for the Root Device .
:type UseOpsworksSecurityGroups: boolean
:param UseOpsworksSecurityGroups: Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.
AWS OpsWorks Stacks provides a standard set of built-in security groups, one for each layer, which are associated with layers by default. UseOpsworksSecurityGroups allows you to provide your own custom security groups instead of using the built-in groups. UseOpsworksSecurityGroups has the following settings:
True - AWS OpsWorks Stacks automatically associates the appropriate built-in security group with each layer (default setting). You can associate additional security groups with a layer after you create it, but you cannot delete the built-in security group.
False - AWS OpsWorks Stacks does not associate built-in security groups with layers. You must create appropriate EC2 security groups and associate a security group with each layer that you create. However, you can still manually associate a built-in security group with a layer on. Custom security groups are required only for those layers that need custom settings.
For more information, see Create a New Stack .
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
Auto-update - Set this parameter to LATEST . AWS OpsWorks Stacks automatically installs new agent versions on the stack's instances as soon as they are available.
Fixed version - Set this parameter to your preferred agent version. To update the agent version, you must edit the stack configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the stack's instances.
The default setting is LATEST . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.
Note
You can also specify an agent version when you create or update an instance, which overrides the stack's default setting.
"""
pass | Updates a specified stack.
See also: AWS API Documentation
:example: response = client.update_stack(
StackId='string',
Name='string',
Attributes={
'string': 'string'
},
ServiceRoleArn='string',
DefaultInstanceProfileArn='string',
DefaultOs='string',
HostnameTheme='string',
DefaultAvailabilityZone='string',
DefaultSubnetId='string',
CustomJson='string',
ConfigurationManager={
'Name': 'string',
'Version': 'string'
},
ChefConfiguration={
'ManageBerkshelf': True|False,
'BerkshelfVersion': 'string'
},
UseCustomCookbooks=True|False,
CustomCookbooksSource={
'Type': 'git'|'svn'|'archive'|'s3',
'Url': 'string',
'Username': 'string',
'Password': 'string',
'SshKey': 'string',
'Revision': 'string'
},
DefaultSshKeyName='string',
DefaultRootDeviceType='ebs'|'instance-store',
UseOpsworksSecurityGroups=True|False,
AgentVersion='string'
)
:type StackId: string
:param StackId: [REQUIRED]
The stack ID.
:type Name: string
:param Name: The stack's new name.
:type Attributes: dict
:param Attributes: One or more user-defined key-value pairs to be added to the stack attributes.
(string) --
(string) --
:type ServiceRoleArn: string
:param ServiceRoleArn: Do not use this parameter. You cannot update a stack's service role.
:type DefaultInstanceProfileArn: string
:param DefaultInstanceProfileArn: The ARN of an IAM profile that is the default profile for all of the stack's EC2 instances. For more information about IAM ARNs, see Using Identifiers .
:type DefaultOs: string
:param DefaultOs: The stack's operating system, which must be set to one of the following:
A supported Linux operating system: An Amazon Linux version, such as Amazon Linux 2016.09 , Amazon Linux 2016.03 , Amazon Linux 2015.09 , or Amazon Linux 2015.03 .
A supported Ubuntu operating system, such as Ubuntu 16.04 LTS , Ubuntu 14.04 LTS , or Ubuntu 12.04 LTS .
CentOS Linux 7
Red Hat Enterprise Linux 7
A supported Windows operating system, such as Microsoft Windows Server 2012 R2 Base , Microsoft Windows Server 2012 R2 with SQL Server Express , Microsoft Windows Server 2012 R2 with SQL Server Standard , or Microsoft Windows Server 2012 R2 with SQL Server Web .
A custom AMI: Custom . You specify the custom AMI you want to use when you create instances. For more information on how to use custom AMIs with OpsWorks, see Using Custom AMIs .
The default option is the stack's current operating system. For more information on the supported operating systems, see AWS OpsWorks Stacks Operating Systems .
:type HostnameTheme: string
:param HostnameTheme: The stack's new host name theme, with spaces replaced by underscores. The theme is used to generate host names for the stack's instances. By default, HostnameTheme is set to Layer_Dependent , which creates host names by appending integers to the layer's short name. The other themes are:
Baked_Goods
Clouds
Europe_Cities
Fruits
Greek_Deities
Legendary_creatures_from_Japan
Planets_and_Moons
Roman_Deities
Scottish_Islands
US_Cities
Wild_Cats
To obtain a generated host name, call GetHostNameSuggestion , which returns a host name based on the current theme.
:type DefaultAvailabilityZone: string
:param DefaultAvailabilityZone: The stack's default Availability Zone, which must be in the stack's region. For more information, see Regions and Endpoints . If you also specify a value for DefaultSubnetId , the subnet must be in the same zone. For more information, see CreateStack .
:type DefaultSubnetId: string
:param DefaultSubnetId: The stack's default VPC subnet ID. This parameter is required if you specify a value for the VpcId parameter. All instances are launched into this subnet unless you specify otherwise when you create the instance. If you also specify a value for DefaultAvailabilityZone , the subnet must be in that zone. For information on default values and when this parameter is required, see the VpcId parameter description.
:type CustomJson: string
:param CustomJson: A string that contains user-defined, custom JSON. It can be used to override the corresponding default stack configuration JSON values or to pass data to recipes. The string should be in the following format:
'{\'key1\': \'value1\', \'key2\': \'value2\',...}'
For more information on custom JSON, see Use Custom JSON to Modify the Stack Configuration Attributes .
:type ConfigurationManager: dict
:param ConfigurationManager: The configuration manager. When you update a stack, we recommend that you use the configuration manager to specify the Chef version: 12, 11.10, or 11.4 for Linux stacks, or 12.2 for Windows stacks. The default value for Linux stacks is currently 11.4.
Name (string) --The name. This parameter must be set to 'Chef'.
Version (string) --The Chef version. This parameter must be set to 12, 11.10, or 11.4 for Linux stacks, and to 12.2 for Windows stacks. The default value for Linux stacks is 11.4.
:type ChefConfiguration: dict
:param ChefConfiguration: A ChefConfiguration object that specifies whether to enable Berkshelf and the Berkshelf version on Chef 11.10 stacks. For more information, see Create a New Stack .
ManageBerkshelf (boolean) --Whether to enable Berkshelf.
BerkshelfVersion (string) --The Berkshelf version.
:type UseCustomCookbooks: boolean
:param UseCustomCookbooks: Whether the stack uses custom cookbooks.
:type CustomCookbooksSource: dict
:param CustomCookbooksSource: Contains the information required to retrieve an app or cookbook from a repository. For more information, see Creating Apps or Custom Recipes and Cookbooks .
Type (string) --The repository type.
Url (string) --The source URL.
Username (string) --This parameter depends on the repository type.
For Amazon S3 bundles, set Username to the appropriate IAM access key ID.
For HTTP bundles, Git repositories, and Subversion repositories, set Username to the user name.
Password (string) --When included in a request, the parameter depends on the repository type.
For Amazon S3 bundles, set Password to the appropriate IAM secret access key.
For HTTP bundles and Subversion repositories, set Password to the password.
For more information on how to safely handle IAM credentials, see http://docs.aws.amazon.com/general/latest/gr/aws-access-keys-best-practices.html .
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
SshKey (string) --In requests, the repository's SSH key.
In responses, AWS OpsWorks Stacks returns *****FILTERED***** instead of the actual value.
Revision (string) --The application's version. AWS OpsWorks Stacks enables you to easily deploy new versions of an application. One of the simplest approaches is to have branches or revisions in your repository that represent different versions that can potentially be deployed.
:type DefaultSshKeyName: string
:param DefaultSshKeyName: A default Amazon EC2 key-pair name. The default value is none . If you specify a key-pair name, AWS OpsWorks Stacks installs the public key on the instance and you can use the private key with an SSH client to log in to the instance. For more information, see Using SSH to Communicate with an Instance and Managing SSH Access . You can override this setting by specifying a different key pair, or no key pair, when you create an instance .
:type DefaultRootDeviceType: string
:param DefaultRootDeviceType: The default root device type. This value is used by default for all instances in the stack, but you can override it when you create an instance. For more information, see Storage for the Root Device .
:type UseOpsworksSecurityGroups: boolean
:param UseOpsworksSecurityGroups: Whether to associate the AWS OpsWorks Stacks built-in security groups with the stack's layers.
AWS OpsWorks Stacks provides a standard set of built-in security groups, one for each layer, which are associated with layers by default. UseOpsworksSecurityGroups allows you to provide your own custom security groups instead of using the built-in groups. UseOpsworksSecurityGroups has the following settings:
True - AWS OpsWorks Stacks automatically associates the appropriate built-in security group with each layer (default setting). You can associate additional security groups with a layer after you create it, but you cannot delete the built-in security group.
False - AWS OpsWorks Stacks does not associate built-in security groups with layers. You must create appropriate EC2 security groups and associate a security group with each layer that you create. However, you can still manually associate a built-in security group with a layer on. Custom security groups are required only for those layers that need custom settings.
For more information, see Create a New Stack .
:type AgentVersion: string
:param AgentVersion: The default AWS OpsWorks Stacks agent version. You have the following options:
Auto-update - Set this parameter to LATEST . AWS OpsWorks Stacks automatically installs new agent versions on the stack's instances as soon as they are available.
Fixed version - Set this parameter to your preferred agent version. To update the agent version, you must edit the stack configuration and specify a new version. AWS OpsWorks Stacks then automatically installs that version on the stack's instances.
The default setting is LATEST . To specify an agent version, you must use the complete version number, not the abbreviated number shown on the console. For a list of available agent version numbers, call DescribeAgentVersions . AgentVersion cannot be set to Chef 12.2.
Note
You can also specify an agent version when you create or update an instance, which overrides the stack's default setting. | entailment |
def create_project(name=None, description=None, source=None, artifacts=None, environment=None, serviceRole=None, timeoutInMinutes=None, encryptionKey=None, tags=None):
"""
Creates a build project.
See also: AWS API Documentation
:example: response = client.create_project(
name='string',
description='string',
source={
'type': 'CODECOMMIT'|'CODEPIPELINE'|'GITHUB'|'S3',
'location': 'string',
'buildspec': 'string',
'auth': {
'type': 'OAUTH',
'resource': 'string'
}
},
artifacts={
'type': 'CODEPIPELINE'|'S3'|'NO_ARTIFACTS',
'location': 'string',
'path': 'string',
'namespaceType': 'NONE'|'BUILD_ID',
'name': 'string',
'packaging': 'NONE'|'ZIP'
},
environment={
'type': 'LINUX_CONTAINER',
'image': 'string',
'computeType': 'BUILD_GENERAL1_SMALL'|'BUILD_GENERAL1_MEDIUM'|'BUILD_GENERAL1_LARGE',
'environmentVariables': [
{
'name': 'string',
'value': 'string'
},
]
},
serviceRole='string',
timeoutInMinutes=123,
encryptionKey='string',
tags=[
{
'key': 'string',
'value': 'string'
},
]
)
:type name: string
:param name: [REQUIRED]
The name of the build project.
:type description: string
:param description: A description that makes the build project easy to identify.
:type source: dict
:param source: [REQUIRED]
Information about the build input source code for the build project.
type (string) -- [REQUIRED]The type of repository that contains the source code to be built. Valid values include:
CODECOMMIT : The source code is in an AWS CodeCommit repository.
CODEPIPELINE : The source code settings are specified in the source action of a pipeline in AWS CodePipeline.
GITHUB : The source code is in a GitHub repository.
S3 : The source code is in an Amazon Simple Storage Service (Amazon S3) input bucket.
location (string) --Information about the location of the source code to be built. Valid values include:
For source code settings that are specified in the source action of a pipeline in AWS CodePipeline, location should not be specified. If it is specified, AWS CodePipeline will ignore it. This is because AWS CodePipeline uses the settings in a pipeline's source action instead of this value.
For source code in an AWS CodeCommit repository, the HTTPS clone URL to the repository that contains the source code and the build spec (for example, ``https://git-codecommit.*region-ID* .amazonaws.com/v1/repos/repo-name `` ).
For source code in an Amazon Simple Storage Service (Amazon S3) input bucket, the path to the ZIP file that contains the source code (for example, `` bucket-name /path /to /object-name .zip`` )
For source code in a GitHub repository, the HTTPS clone URL to the repository that contains the source and the build spec. Also, you must connect your AWS account to your GitHub account. To do this, use the AWS CodeBuild console to begin creating a build project, and follow the on-screen instructions to complete the connection. (After you have connected to your GitHub account, you do not need to finish creating the build project, and you may then leave the AWS CodeBuild console.) To instruct AWS CodeBuild to then use this connection, in the source object, set the auth object's type value to OAUTH .
buildspec (string) --The build spec declaration to use for the builds in this build project.
If this value is not specified, a build spec must be included along with the source code to be built.
auth (dict) --Information about the authorization settings for AWS CodeBuild to access the source code to be built.
This information is for the AWS CodeBuild console's use only. Your code should not get or set this information directly (unless the build project's source type value is GITHUB ).
type (string) -- [REQUIRED]The authorization type to use. The only valid value is OAUTH , which represents the OAuth authorization type.
resource (string) --The resource value that applies to the specified authorization type.
:type artifacts: dict
:param artifacts: [REQUIRED]
Information about the build output artifacts for the build project.
type (string) -- [REQUIRED]The type of build output artifact. Valid values include:
CODEPIPELINE : The build project will have build output generated through AWS CodePipeline.
NO_ARTIFACTS : The build project will not produce any build output.
S3 : The build project will store build output in Amazon Simple Storage Service (Amazon S3).
location (string) --Information about the build output artifact location, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output locations instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , this is the name of the output bucket.
path (string) --Along with namespaceType and name , the pattern that AWS CodeBuild will use to name and store the output artifact, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output names instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , this is the path to the output artifact. If path is not specified, then path will not be used.
For example, if path is set to MyArtifacts , namespaceType is set to NONE , and name is set to MyArtifact.zip , then the output artifact would be stored in the output bucket at MyArtifacts/MyArtifact.zip .
namespaceType (string) --Along with path and name , the pattern that AWS CodeBuild will use to determine the name and location to store the output artifact, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output names instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , then valid values include:
BUILD_ID : Include the build ID in the location of the build output artifact.
NONE : Do not include the build ID. This is the default if namespaceType is not specified.
For example, if path is set to MyArtifacts , namespaceType is set to BUILD_ID , and name is set to MyArtifact.zip , then the output artifact would be stored in MyArtifacts/*build-ID* /MyArtifact.zip .
name (string) --Along with path and namespaceType , the pattern that AWS CodeBuild will use to name and store the output artifact, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output names instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , this is the name of the output artifact object.
For example, if path is set to MyArtifacts , namespaceType is set to BUILD_ID , and name is set to MyArtifact.zip , then the output artifact would be stored in MyArtifacts/*build-ID* /MyArtifact.zip .
packaging (string) --The type of build output artifact to create, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output artifacts instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , valid values include:
NONE : AWS CodeBuild will create in the output bucket a folder containing the build output. This is the default if packaging is not specified.
ZIP : AWS CodeBuild will create in the output bucket a ZIP file containing the build output.
:type environment: dict
:param environment: [REQUIRED]
Information about the build environment for the build project.
type (string) -- [REQUIRED]The type of build environment to use for related builds.
image (string) -- [REQUIRED]The ID of the Docker image to use for this build project.
computeType (string) -- [REQUIRED]Information about the compute resources the build project will use. Available values include:
BUILD_GENERAL1_SMALL : Use up to 3 GB memory and 2 vCPUs for builds.
BUILD_GENERAL1_MEDIUM : Use up to 7 GB memory and 4 vCPUs for builds.
BUILD_GENERAL1_LARGE : Use up to 15 GB memory and 8 vCPUs for builds.
environmentVariables (list) --A set of environment variables to make available to builds for this build project.
(dict) --Information about an environment variable for a build project or a build.
name (string) -- [REQUIRED]The name or key of the environment variable.
value (string) -- [REQUIRED]The value of the environment variable.
:type serviceRole: string
:param serviceRole: The ARN of the AWS Identity and Access Management (IAM) role that enables AWS CodeBuild to interact with dependent AWS services on behalf of the AWS account.
:type timeoutInMinutes: integer
:param timeoutInMinutes: How long, in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any build that has not been marked as completed. The default is 60 minutes.
:type encryptionKey: string
:param encryptionKey: The AWS Key Management Service (AWS KMS) customer master key (CMK) to be used for encrypting the build output artifacts.
You can specify either the CMK's Amazon Resource Name (ARN) or, if available, the CMK's alias (using the format ``alias/alias-name `` ).
:type tags: list
:param tags: A set of tags for this build project.
These tags are available for use by AWS services that support AWS CodeBuild build project tags.
(dict) --A tag, consisting of a key and a value.
This tag is available for use by AWS services that support tags in AWS CodeBuild.
key (string) --The tag's key.
value (string) --The tag's value.
:rtype: dict
:return: {
'project': {
'name': 'string',
'arn': 'string',
'description': 'string',
'source': {
'type': 'CODECOMMIT'|'CODEPIPELINE'|'GITHUB'|'S3',
'location': 'string',
'buildspec': 'string',
'auth': {
'type': 'OAUTH',
'resource': 'string'
}
},
'artifacts': {
'type': 'CODEPIPELINE'|'S3'|'NO_ARTIFACTS',
'location': 'string',
'path': 'string',
'namespaceType': 'NONE'|'BUILD_ID',
'name': 'string',
'packaging': 'NONE'|'ZIP'
},
'environment': {
'type': 'LINUX_CONTAINER',
'image': 'string',
'computeType': 'BUILD_GENERAL1_SMALL'|'BUILD_GENERAL1_MEDIUM'|'BUILD_GENERAL1_LARGE',
'environmentVariables': [
{
'name': 'string',
'value': 'string'
},
]
},
'serviceRole': 'string',
'timeoutInMinutes': 123,
'encryptionKey': 'string',
'tags': [
{
'key': 'string',
'value': 'string'
},
],
'created': datetime(2015, 1, 1),
'lastModified': datetime(2015, 1, 1)
}
}
:returns:
CODECOMMIT : The source code is in an AWS CodeCommit repository.
CODEPIPELINE : The source code settings are specified in the source action of a pipeline in AWS CodePipeline.
GITHUB : The source code is in a GitHub repository.
S3 : The source code is in an Amazon Simple Storage Service (Amazon S3) input bucket.
"""
pass | Creates a build project.
See also: AWS API Documentation
:example: response = client.create_project(
name='string',
description='string',
source={
'type': 'CODECOMMIT'|'CODEPIPELINE'|'GITHUB'|'S3',
'location': 'string',
'buildspec': 'string',
'auth': {
'type': 'OAUTH',
'resource': 'string'
}
},
artifacts={
'type': 'CODEPIPELINE'|'S3'|'NO_ARTIFACTS',
'location': 'string',
'path': 'string',
'namespaceType': 'NONE'|'BUILD_ID',
'name': 'string',
'packaging': 'NONE'|'ZIP'
},
environment={
'type': 'LINUX_CONTAINER',
'image': 'string',
'computeType': 'BUILD_GENERAL1_SMALL'|'BUILD_GENERAL1_MEDIUM'|'BUILD_GENERAL1_LARGE',
'environmentVariables': [
{
'name': 'string',
'value': 'string'
},
]
},
serviceRole='string',
timeoutInMinutes=123,
encryptionKey='string',
tags=[
{
'key': 'string',
'value': 'string'
},
]
)
:type name: string
:param name: [REQUIRED]
The name of the build project.
:type description: string
:param description: A description that makes the build project easy to identify.
:type source: dict
:param source: [REQUIRED]
Information about the build input source code for the build project.
type (string) -- [REQUIRED]The type of repository that contains the source code to be built. Valid values include:
CODECOMMIT : The source code is in an AWS CodeCommit repository.
CODEPIPELINE : The source code settings are specified in the source action of a pipeline in AWS CodePipeline.
GITHUB : The source code is in a GitHub repository.
S3 : The source code is in an Amazon Simple Storage Service (Amazon S3) input bucket.
location (string) --Information about the location of the source code to be built. Valid values include:
For source code settings that are specified in the source action of a pipeline in AWS CodePipeline, location should not be specified. If it is specified, AWS CodePipeline will ignore it. This is because AWS CodePipeline uses the settings in a pipeline's source action instead of this value.
For source code in an AWS CodeCommit repository, the HTTPS clone URL to the repository that contains the source code and the build spec (for example, ``https://git-codecommit.*region-ID* .amazonaws.com/v1/repos/repo-name `` ).
For source code in an Amazon Simple Storage Service (Amazon S3) input bucket, the path to the ZIP file that contains the source code (for example, `` bucket-name /path /to /object-name .zip`` )
For source code in a GitHub repository, the HTTPS clone URL to the repository that contains the source and the build spec. Also, you must connect your AWS account to your GitHub account. To do this, use the AWS CodeBuild console to begin creating a build project, and follow the on-screen instructions to complete the connection. (After you have connected to your GitHub account, you do not need to finish creating the build project, and you may then leave the AWS CodeBuild console.) To instruct AWS CodeBuild to then use this connection, in the source object, set the auth object's type value to OAUTH .
buildspec (string) --The build spec declaration to use for the builds in this build project.
If this value is not specified, a build spec must be included along with the source code to be built.
auth (dict) --Information about the authorization settings for AWS CodeBuild to access the source code to be built.
This information is for the AWS CodeBuild console's use only. Your code should not get or set this information directly (unless the build project's source type value is GITHUB ).
type (string) -- [REQUIRED]The authorization type to use. The only valid value is OAUTH , which represents the OAuth authorization type.
resource (string) --The resource value that applies to the specified authorization type.
:type artifacts: dict
:param artifacts: [REQUIRED]
Information about the build output artifacts for the build project.
type (string) -- [REQUIRED]The type of build output artifact. Valid values include:
CODEPIPELINE : The build project will have build output generated through AWS CodePipeline.
NO_ARTIFACTS : The build project will not produce any build output.
S3 : The build project will store build output in Amazon Simple Storage Service (Amazon S3).
location (string) --Information about the build output artifact location, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output locations instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , this is the name of the output bucket.
path (string) --Along with namespaceType and name , the pattern that AWS CodeBuild will use to name and store the output artifact, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output names instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , this is the path to the output artifact. If path is not specified, then path will not be used.
For example, if path is set to MyArtifacts , namespaceType is set to NONE , and name is set to MyArtifact.zip , then the output artifact would be stored in the output bucket at MyArtifacts/MyArtifact.zip .
namespaceType (string) --Along with path and name , the pattern that AWS CodeBuild will use to determine the name and location to store the output artifact, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output names instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , then valid values include:
BUILD_ID : Include the build ID in the location of the build output artifact.
NONE : Do not include the build ID. This is the default if namespaceType is not specified.
For example, if path is set to MyArtifacts , namespaceType is set to BUILD_ID , and name is set to MyArtifact.zip , then the output artifact would be stored in MyArtifacts/*build-ID* /MyArtifact.zip .
name (string) --Along with path and namespaceType , the pattern that AWS CodeBuild will use to name and store the output artifact, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output names instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , this is the name of the output artifact object.
For example, if path is set to MyArtifacts , namespaceType is set to BUILD_ID , and name is set to MyArtifact.zip , then the output artifact would be stored in MyArtifacts/*build-ID* /MyArtifact.zip .
packaging (string) --The type of build output artifact to create, as follows:
If type is set to CODEPIPELINE , then AWS CodePipeline will ignore this value if specified. This is because AWS CodePipeline manages its build output artifacts instead of AWS CodeBuild.
If type is set to NO_ARTIFACTS , then this value will be ignored if specified, because no build output will be produced.
If type is set to S3 , valid values include:
NONE : AWS CodeBuild will create in the output bucket a folder containing the build output. This is the default if packaging is not specified.
ZIP : AWS CodeBuild will create in the output bucket a ZIP file containing the build output.
:type environment: dict
:param environment: [REQUIRED]
Information about the build environment for the build project.
type (string) -- [REQUIRED]The type of build environment to use for related builds.
image (string) -- [REQUIRED]The ID of the Docker image to use for this build project.
computeType (string) -- [REQUIRED]Information about the compute resources the build project will use. Available values include:
BUILD_GENERAL1_SMALL : Use up to 3 GB memory and 2 vCPUs for builds.
BUILD_GENERAL1_MEDIUM : Use up to 7 GB memory and 4 vCPUs for builds.
BUILD_GENERAL1_LARGE : Use up to 15 GB memory and 8 vCPUs for builds.
environmentVariables (list) --A set of environment variables to make available to builds for this build project.
(dict) --Information about an environment variable for a build project or a build.
name (string) -- [REQUIRED]The name or key of the environment variable.
value (string) -- [REQUIRED]The value of the environment variable.
:type serviceRole: string
:param serviceRole: The ARN of the AWS Identity and Access Management (IAM) role that enables AWS CodeBuild to interact with dependent AWS services on behalf of the AWS account.
:type timeoutInMinutes: integer
:param timeoutInMinutes: How long, in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any build that has not been marked as completed. The default is 60 minutes.
:type encryptionKey: string
:param encryptionKey: The AWS Key Management Service (AWS KMS) customer master key (CMK) to be used for encrypting the build output artifacts.
You can specify either the CMK's Amazon Resource Name (ARN) or, if available, the CMK's alias (using the format ``alias/alias-name `` ).
:type tags: list
:param tags: A set of tags for this build project.
These tags are available for use by AWS services that support AWS CodeBuild build project tags.
(dict) --A tag, consisting of a key and a value.
This tag is available for use by AWS services that support tags in AWS CodeBuild.
key (string) --The tag's key.
value (string) --The tag's value.
:rtype: dict
:return: {
'project': {
'name': 'string',
'arn': 'string',
'description': 'string',
'source': {
'type': 'CODECOMMIT'|'CODEPIPELINE'|'GITHUB'|'S3',
'location': 'string',
'buildspec': 'string',
'auth': {
'type': 'OAUTH',
'resource': 'string'
}
},
'artifacts': {
'type': 'CODEPIPELINE'|'S3'|'NO_ARTIFACTS',
'location': 'string',
'path': 'string',
'namespaceType': 'NONE'|'BUILD_ID',
'name': 'string',
'packaging': 'NONE'|'ZIP'
},
'environment': {
'type': 'LINUX_CONTAINER',
'image': 'string',
'computeType': 'BUILD_GENERAL1_SMALL'|'BUILD_GENERAL1_MEDIUM'|'BUILD_GENERAL1_LARGE',
'environmentVariables': [
{
'name': 'string',
'value': 'string'
},
]
},
'serviceRole': 'string',
'timeoutInMinutes': 123,
'encryptionKey': 'string',
'tags': [
{
'key': 'string',
'value': 'string'
},
],
'created': datetime(2015, 1, 1),
'lastModified': datetime(2015, 1, 1)
}
}
:returns:
CODECOMMIT : The source code is in an AWS CodeCommit repository.
CODEPIPELINE : The source code settings are specified in the source action of a pipeline in AWS CodePipeline.
GITHUB : The source code is in a GitHub repository.
S3 : The source code is in an Amazon Simple Storage Service (Amazon S3) input bucket. | entailment |
def put_bot(name=None, description=None, intents=None, clarificationPrompt=None, abortStatement=None, idleSessionTTLInSeconds=None, voiceId=None, checksum=None, processBehavior=None, locale=None, childDirected=None):
"""
Creates an Amazon Lex conversational bot or replaces an existing bot. When you create or update a bot you only required to specify a name. You can use this to add intents later, or to remove intents from an existing bot. When you create a bot with a name only, the bot is created or updated but Amazon Lex returns the ```` response FAILED . You can build the bot after you add one or more intents. For more information about Amazon Lex bots, see how-it-works .
If you specify the name of an existing bot, the fields in the request replace the existing values in the $LATEST version of the bot. Amazon Lex removes any fields that you don't provide values for in the request, except for the idleTTLInSeconds and privacySettings fields, which are set to their default values. If you don't specify values for required fields, Amazon Lex throws an exception.
This operation requires permissions for the lex:PutBot action. For more information, see auth-and-access-control .
See also: AWS API Documentation
:example: response = client.put_bot(
name='string',
description='string',
intents=[
{
'intentName': 'string',
'intentVersion': 'string'
},
],
clarificationPrompt={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
abortStatement={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
idleSessionTTLInSeconds=123,
voiceId='string',
checksum='string',
processBehavior='SAVE'|'BUILD',
locale='en-US',
childDirected=True|False
)
:type name: string
:param name: [REQUIRED]
The name of the bot. The name is not case sensitive.
:type description: string
:param description: A description of the bot.
:type intents: list
:param intents: An array of Intent objects. Each intent represents a command that a user can express. For example, a pizza ordering bot might support an OrderPizza intent. For more information, see how-it-works .
(dict) --Identifies the specific version of an intent.
intentName (string) -- [REQUIRED]The name of the intent.
intentVersion (string) -- [REQUIRED]The version of the intent.
:type clarificationPrompt: dict
:param clarificationPrompt: When Amazon Lex doesn't understand the user's intent, it uses one of these messages to get clarification. For example, 'Sorry, I didn't understand. Please repeat.' Amazon Lex repeats the clarification prompt the number of times specified in maxAttempts . If Amazon Lex still can't understand, it sends the message specified in abortStatement .
messages (list) -- [REQUIRED]An array of objects, each of which provides a message string and its type. You can specify the message string in plain text or in Speech Synthesis Markup Language (SSML).
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
maxAttempts (integer) -- [REQUIRED]The number of times to prompt the user for information.
responseCard (string) --A response card. Amazon Lex uses this prompt at runtime, in the PostText API response. It substitutes session attributes and slot values for placeholders in the response card. For more information, see ex-resp-card .
:type abortStatement: dict
:param abortStatement: When Amazon Lex can't understand the user's input in context, it tries to elicit the information a few times. After that, Amazon Lex sends the message defined in abortStatement to the user, and then aborts the conversation. To set the number of retries, use the valueElicitationPrompt field for the slot type.
For example, in a pizza ordering bot, Amazon Lex might ask a user 'What type of crust would you like?' If the user's response is not one of the expected responses (for example, 'thin crust, 'deep dish,' etc.), Amazon Lex tries to elicit a correct response a few more times.
For example, in a pizza ordering application, OrderPizza might be one of the intents. This intent might require the CrustType slot. You specify the valueElicitationPrompt field when you create the CrustType slot.
messages (list) -- [REQUIRED]A collection of message objects.
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
responseCard (string) --At runtime, if the client is using the API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.
:type idleSessionTTLInSeconds: integer
:param idleSessionTTLInSeconds: The maximum time in seconds that Amazon Lex retains the data gathered in a conversation.
A user interaction session remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Lex deletes any data provided before the timeout.
For example, suppose that a user chooses the OrderPizza intent, but gets sidetracked halfway through placing an order. If the user doesn't complete the order within the specified time, Amazon Lex discards the slot information that it gathered, and the user must start over.
If you don't include the idleSessionTTLInSeconds element in a PutBot operation request, Amazon Lex uses the default value. This is also true if the request replaces an existing bot.
The default is 300 seconds (5 minutes).
:type voiceId: string
:param voiceId: The Amazon Polly voice ID that you want Amazon Lex to use for voice interactions with the user. The locale configured for the voice must match the locale of the bot. For more information, see Voice in the Amazon Polly Developer Guide .
:type checksum: string
:param checksum: Identifies a specific revision of the $LATEST version.
When you create a new bot, leave the checksum field blank. If you specify a checksum you get a BadRequestException exception.
When you want to update a bot, set the checksum field to the checksum of the most recent revision of the $LATEST version. If you don't specify the checksum field, or if the checksum does not match the $LATEST version, you get a PreconditionFailedException exception.
:type processBehavior: string
:param processBehavior: If you set the processBehavior element to Build , Amazon Lex builds the bot so that it can be run. If you set the element to Save Amazon Lex saves the bot, but doesn't build it.
If you don't specify this value, the default value is Save .
:type locale: string
:param locale: [REQUIRED]
Specifies the target locale for the bot. Any intent used in the bot must be compatible with the locale of the bot.
The default is en-US .
:type childDirected: boolean
:param childDirected: [REQUIRED]
For each Amazon Lex bot created with the Amazon Lex Model Building Service, you must specify whether your use of Amazon Lex is related to a website, program, or other application that is directed or targeted, in whole or in part, to children under age 13 and subject to the Children's Online Privacy Protection Act (COPPA) by specifying true or false in the childDirected field. By specifying true in the childDirected field, you confirm that your use of Amazon Lex is related to a website, program, or other application that is directed or targeted, in whole or in part, to children under age 13 and subject to COPPA. By specifying false in the childDirected field, you confirm that your use of Amazon Lex is not related to a website, program, or other application that is directed or targeted, in whole or in part, to children under age 13 and subject to COPPA. You may not specify a default value for the childDirected field that does not accurately reflect whether your use of Amazon Lex is related to a website, program, or other application that is directed or targeted, in whole or in part, to children under age 13 and subject to COPPA.
If your use of Amazon Lex relates to a website, program, or other application that is directed in whole or in part, to children under age 13, you must obtain any required verifiable parental consent under COPPA. For information regarding the use of Amazon Lex in connection with websites, programs, or other applications that are directed or targeted, in whole or in part, to children under age 13, see the Amazon Lex FAQ.
:rtype: dict
:return: {
'name': 'string',
'description': 'string',
'intents': [
{
'intentName': 'string',
'intentVersion': 'string'
},
],
'clarificationPrompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'abortStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
'status': 'BUILDING'|'READY'|'FAILED'|'NOT_BUILT',
'failureReason': 'string',
'lastUpdatedDate': datetime(2015, 1, 1),
'createdDate': datetime(2015, 1, 1),
'idleSessionTTLInSeconds': 123,
'voiceId': 'string',
'checksum': 'string',
'version': 'string',
'locale': 'en-US',
'childDirected': True|False
}
"""
pass | Creates an Amazon Lex conversational bot or replaces an existing bot. When you create or update a bot you only required to specify a name. You can use this to add intents later, or to remove intents from an existing bot. When you create a bot with a name only, the bot is created or updated but Amazon Lex returns the ```` response FAILED . You can build the bot after you add one or more intents. For more information about Amazon Lex bots, see how-it-works .
If you specify the name of an existing bot, the fields in the request replace the existing values in the $LATEST version of the bot. Amazon Lex removes any fields that you don't provide values for in the request, except for the idleTTLInSeconds and privacySettings fields, which are set to their default values. If you don't specify values for required fields, Amazon Lex throws an exception.
This operation requires permissions for the lex:PutBot action. For more information, see auth-and-access-control .
See also: AWS API Documentation
:example: response = client.put_bot(
name='string',
description='string',
intents=[
{
'intentName': 'string',
'intentVersion': 'string'
},
],
clarificationPrompt={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
abortStatement={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
idleSessionTTLInSeconds=123,
voiceId='string',
checksum='string',
processBehavior='SAVE'|'BUILD',
locale='en-US',
childDirected=True|False
)
:type name: string
:param name: [REQUIRED]
The name of the bot. The name is not case sensitive.
:type description: string
:param description: A description of the bot.
:type intents: list
:param intents: An array of Intent objects. Each intent represents a command that a user can express. For example, a pizza ordering bot might support an OrderPizza intent. For more information, see how-it-works .
(dict) --Identifies the specific version of an intent.
intentName (string) -- [REQUIRED]The name of the intent.
intentVersion (string) -- [REQUIRED]The version of the intent.
:type clarificationPrompt: dict
:param clarificationPrompt: When Amazon Lex doesn't understand the user's intent, it uses one of these messages to get clarification. For example, 'Sorry, I didn't understand. Please repeat.' Amazon Lex repeats the clarification prompt the number of times specified in maxAttempts . If Amazon Lex still can't understand, it sends the message specified in abortStatement .
messages (list) -- [REQUIRED]An array of objects, each of which provides a message string and its type. You can specify the message string in plain text or in Speech Synthesis Markup Language (SSML).
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
maxAttempts (integer) -- [REQUIRED]The number of times to prompt the user for information.
responseCard (string) --A response card. Amazon Lex uses this prompt at runtime, in the PostText API response. It substitutes session attributes and slot values for placeholders in the response card. For more information, see ex-resp-card .
:type abortStatement: dict
:param abortStatement: When Amazon Lex can't understand the user's input in context, it tries to elicit the information a few times. After that, Amazon Lex sends the message defined in abortStatement to the user, and then aborts the conversation. To set the number of retries, use the valueElicitationPrompt field for the slot type.
For example, in a pizza ordering bot, Amazon Lex might ask a user 'What type of crust would you like?' If the user's response is not one of the expected responses (for example, 'thin crust, 'deep dish,' etc.), Amazon Lex tries to elicit a correct response a few more times.
For example, in a pizza ordering application, OrderPizza might be one of the intents. This intent might require the CrustType slot. You specify the valueElicitationPrompt field when you create the CrustType slot.
messages (list) -- [REQUIRED]A collection of message objects.
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
responseCard (string) --At runtime, if the client is using the API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.
:type idleSessionTTLInSeconds: integer
:param idleSessionTTLInSeconds: The maximum time in seconds that Amazon Lex retains the data gathered in a conversation.
A user interaction session remains active for the amount of time specified. If no conversation occurs during this time, the session expires and Amazon Lex deletes any data provided before the timeout.
For example, suppose that a user chooses the OrderPizza intent, but gets sidetracked halfway through placing an order. If the user doesn't complete the order within the specified time, Amazon Lex discards the slot information that it gathered, and the user must start over.
If you don't include the idleSessionTTLInSeconds element in a PutBot operation request, Amazon Lex uses the default value. This is also true if the request replaces an existing bot.
The default is 300 seconds (5 minutes).
:type voiceId: string
:param voiceId: The Amazon Polly voice ID that you want Amazon Lex to use for voice interactions with the user. The locale configured for the voice must match the locale of the bot. For more information, see Voice in the Amazon Polly Developer Guide .
:type checksum: string
:param checksum: Identifies a specific revision of the $LATEST version.
When you create a new bot, leave the checksum field blank. If you specify a checksum you get a BadRequestException exception.
When you want to update a bot, set the checksum field to the checksum of the most recent revision of the $LATEST version. If you don't specify the checksum field, or if the checksum does not match the $LATEST version, you get a PreconditionFailedException exception.
:type processBehavior: string
:param processBehavior: If you set the processBehavior element to Build , Amazon Lex builds the bot so that it can be run. If you set the element to Save Amazon Lex saves the bot, but doesn't build it.
If you don't specify this value, the default value is Save .
:type locale: string
:param locale: [REQUIRED]
Specifies the target locale for the bot. Any intent used in the bot must be compatible with the locale of the bot.
The default is en-US .
:type childDirected: boolean
:param childDirected: [REQUIRED]
For each Amazon Lex bot created with the Amazon Lex Model Building Service, you must specify whether your use of Amazon Lex is related to a website, program, or other application that is directed or targeted, in whole or in part, to children under age 13 and subject to the Children's Online Privacy Protection Act (COPPA) by specifying true or false in the childDirected field. By specifying true in the childDirected field, you confirm that your use of Amazon Lex is related to a website, program, or other application that is directed or targeted, in whole or in part, to children under age 13 and subject to COPPA. By specifying false in the childDirected field, you confirm that your use of Amazon Lex is not related to a website, program, or other application that is directed or targeted, in whole or in part, to children under age 13 and subject to COPPA. You may not specify a default value for the childDirected field that does not accurately reflect whether your use of Amazon Lex is related to a website, program, or other application that is directed or targeted, in whole or in part, to children under age 13 and subject to COPPA.
If your use of Amazon Lex relates to a website, program, or other application that is directed in whole or in part, to children under age 13, you must obtain any required verifiable parental consent under COPPA. For information regarding the use of Amazon Lex in connection with websites, programs, or other applications that are directed or targeted, in whole or in part, to children under age 13, see the Amazon Lex FAQ.
:rtype: dict
:return: {
'name': 'string',
'description': 'string',
'intents': [
{
'intentName': 'string',
'intentVersion': 'string'
},
],
'clarificationPrompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'abortStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
'status': 'BUILDING'|'READY'|'FAILED'|'NOT_BUILT',
'failureReason': 'string',
'lastUpdatedDate': datetime(2015, 1, 1),
'createdDate': datetime(2015, 1, 1),
'idleSessionTTLInSeconds': 123,
'voiceId': 'string',
'checksum': 'string',
'version': 'string',
'locale': 'en-US',
'childDirected': True|False
} | entailment |
def put_intent(name=None, description=None, slots=None, sampleUtterances=None, confirmationPrompt=None, rejectionStatement=None, followUpPrompt=None, conclusionStatement=None, dialogCodeHook=None, fulfillmentActivity=None, parentIntentSignature=None, checksum=None):
"""
Creates an intent or replaces an existing intent.
To define the interaction between the user and your bot, you use one or more intents. For a pizza ordering bot, for example, you would create an OrderPizza intent.
To create an intent or replace an existing intent, you must provide the following:
You can specify other optional information in the request, such as:
If you specify an existing intent name to update the intent, Amazon Lex replaces the values in the $LATEST version of the slot type with the values in the request. Amazon Lex removes fields that you don't provide in the request. If you don't specify the required fields, Amazon Lex throws an exception.
For more information, see how-it-works .
This operation requires permissions for the lex:PutIntent action.
See also: AWS API Documentation
:example: response = client.put_intent(
name='string',
description='string',
slots=[
{
'name': 'string',
'description': 'string',
'slotConstraint': 'Required'|'Optional',
'slotType': 'string',
'slotTypeVersion': 'string',
'valueElicitationPrompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'priority': 123,
'sampleUtterances': [
'string',
],
'responseCard': 'string'
},
],
sampleUtterances=[
'string',
],
confirmationPrompt={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
rejectionStatement={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
followUpPrompt={
'prompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'rejectionStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
}
},
conclusionStatement={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
dialogCodeHook={
'uri': 'string',
'messageVersion': 'string'
},
fulfillmentActivity={
'type': 'ReturnIntent'|'CodeHook',
'codeHook': {
'uri': 'string',
'messageVersion': 'string'
}
},
parentIntentSignature='string',
checksum='string'
)
:type name: string
:param name: [REQUIRED]
The name of the intent. The name is not case sensitive.
The name can't match a built-in intent name, or a built-in intent name with 'AMAZON.' removed. For example, because there is a built-in intent called AMAZON.HelpIntent , you can't create a custom intent called HelpIntent .
For a list of built-in intents, see Standard Built-in Intents in the Alexa Skills Kit .
:type description: string
:param description: A description of the intent.
:type slots: list
:param slots: An array of intent slots. At runtime, Amazon Lex elicits required slot values from the user using prompts defined in the slots. For more information, see xref linkend='how-it-works'/.
(dict) --Identifies the version of a specific slot.
name (string) -- [REQUIRED]The name of the slot.
description (string) --A description of the slot.
slotConstraint (string) -- [REQUIRED]Specifies whether the slot is required or optional.
slotType (string) --The type of the slot, either a custom slot type that you defined or one of the built-in slot types.
slotTypeVersion (string) --The version of the slot type.
valueElicitationPrompt (dict) --The prompt that Amazon Lex uses to elicit the slot value from the user.
messages (list) -- [REQUIRED]An array of objects, each of which provides a message string and its type. You can specify the message string in plain text or in Speech Synthesis Markup Language (SSML).
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
maxAttempts (integer) -- [REQUIRED]The number of times to prompt the user for information.
responseCard (string) --A response card. Amazon Lex uses this prompt at runtime, in the PostText API response. It substitutes session attributes and slot values for placeholders in the response card. For more information, see ex-resp-card .
priority (integer) --Directs Lex the order in which to elicit this slot value from the user. For example, if the intent has two slots with priorities 1 and 2, AWS Lex first elicits a value for the slot with priority 1.
If multiple slots share the same priority, the order in which Lex elicits values is arbitrary.
sampleUtterances (list) --If you know a specific pattern with which users might respond to an Amazon Lex request for a slot value, you can provide those utterances to improve accuracy. This is optional. In most cases, Amazon Lex is capable of understanding user utterances.
(string) --
responseCard (string) --A set of possible responses for the slot type used by text-based clients. A user chooses an option from the response card, instead of using text to reply.
:type sampleUtterances: list
:param sampleUtterances: An array of utterances (strings) that a user might say to signal the intent. For example, 'I want {PizzaSize} pizza', 'Order {Quantity} {PizzaSize} pizzas'.
In each utterance, a slot name is enclosed in curly braces.
(string) --
:type confirmationPrompt: dict
:param confirmationPrompt: Prompts the user to confirm the intent. This question should have a yes or no answer.
Amazon Lex uses this prompt to ensure that the user acknowledges that the intent is ready for fulfillment. For example, with the OrderPizza intent, you might want to confirm that the order is correct before placing it. For other intents, such as intents that simply respond to user questions, you might not need to ask the user for confirmation before providing the information.
Note
You you must provide both the rejectionStatement and the confirmationPrompt , or neither.
messages (list) -- [REQUIRED]An array of objects, each of which provides a message string and its type. You can specify the message string in plain text or in Speech Synthesis Markup Language (SSML).
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
maxAttempts (integer) -- [REQUIRED]The number of times to prompt the user for information.
responseCard (string) --A response card. Amazon Lex uses this prompt at runtime, in the PostText API response. It substitutes session attributes and slot values for placeholders in the response card. For more information, see ex-resp-card .
:type rejectionStatement: dict
:param rejectionStatement: When the user answers 'no' to the question defined in confirmationPrompt , Amazon Lex responds with this statement to acknowledge that the intent was canceled.
Note
You must provide both the rejectionStatement and the confirmationPrompt , or neither.
messages (list) -- [REQUIRED]A collection of message objects.
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
responseCard (string) --At runtime, if the client is using the API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.
:type followUpPrompt: dict
:param followUpPrompt: A user prompt for additional activity after an intent is fulfilled. For example, after the OrderPizza intent is fulfilled (your Lambda function placed an order with a pizzeria), you might prompt the user to find if they want to order a drink (assuming that you have defined an OrderDrink intent in your bot).
Note
The followUpPrompt and conclusionStatement are mutually exclusive. You can specify only one. For example, your bot may not solicit both the following:
Follow up prompt - '$session.FirstName , your pizza order has been placed. Would you like to order a drink or a dessert?'
Conclusion statement - '$session.FirstName , your pizza order has been placed.'
prompt (dict) -- [REQUIRED]Obtains information from the user.
messages (list) -- [REQUIRED]An array of objects, each of which provides a message string and its type. You can specify the message string in plain text or in Speech Synthesis Markup Language (SSML).
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
maxAttempts (integer) -- [REQUIRED]The number of times to prompt the user for information.
responseCard (string) --A response card. Amazon Lex uses this prompt at runtime, in the PostText API response. It substitutes session attributes and slot values for placeholders in the response card. For more information, see ex-resp-card .
rejectionStatement (dict) -- [REQUIRED]If the user answers 'no' to the question defined in confirmationPrompt , Amazon Lex responds with this statement to acknowledge that the intent was canceled.
messages (list) -- [REQUIRED]A collection of message objects.
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
responseCard (string) --At runtime, if the client is using the API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.
:type conclusionStatement: dict
:param conclusionStatement: The statement that you want Amazon Lex to convey to the user after the intent is successfully fulfilled by the Lambda function.
This element is relevant only if you provide a Lambda function in the fulfillmentActivity . If you return the intent to the client application, you can't specify this element.
Note
The followUpPrompt and conclusionStatement are mutually exclusive. You can specify only one.
messages (list) -- [REQUIRED]A collection of message objects.
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
responseCard (string) --At runtime, if the client is using the API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.
:type dialogCodeHook: dict
:param dialogCodeHook: Specifies a Lambda function to invoke for each user input. You can invoke this Lambda function to personalize user interaction.
For example, suppose your bot determines that the user is John. Your Lambda function might retrieve John's information from a backend database and prepopulate some of the values. For example, if you find that John is gluten intolerant, you might set the corresponding intent slot, GlutenIntolerant , to true. You might find John's phone number and set the corresponding session attribute.
uri (string) -- [REQUIRED]The Amazon Resource Name (ARN) of the Lambda function.
messageVersion (string) -- [REQUIRED]The version of the request-response that you want Amazon Lex to use to invoke your Lambda function. For more information, see using-lambda .
:type fulfillmentActivity: dict
:param fulfillmentActivity: Describes how the intent is fulfilled. For example, after a user provides all of the information for a pizza order, fulfillmentActivity defines how the bot places an order with a local pizza store.
You might configure Amazon Lex to return all of the intent information to the client application, or direct it to invoke a Lambda function that can process the intent (for example, place an order with a pizzeria).
type (string) -- [REQUIRED]How the intent should be fulfilled, either by running a Lambda function or by returning the slot data to the client application.
codeHook (dict) --A description of the Lambda function that is run to fulfill the intent.
uri (string) -- [REQUIRED]The Amazon Resource Name (ARN) of the Lambda function.
messageVersion (string) -- [REQUIRED]The version of the request-response that you want Amazon Lex to use to invoke your Lambda function. For more information, see using-lambda .
:type parentIntentSignature: string
:param parentIntentSignature: A unique identifier for the built-in intent to base this intent on. To find the signature for an intent, see Standard Built-in Intents in the Alexa Skills Kit .
:type checksum: string
:param checksum: Identifies a specific revision of the $LATEST version.
When you create a new intent, leave the checksum field blank. If you specify a checksum you get a BadRequestException exception.
When you want to update a intent, set the checksum field to the checksum of the most recent revision of the $LATEST version. If you don't specify the checksum field, or if the checksum does not match the $LATEST version, you get a PreconditionFailedException exception.
:rtype: dict
:return: {
'name': 'string',
'description': 'string',
'slots': [
{
'name': 'string',
'description': 'string',
'slotConstraint': 'Required'|'Optional',
'slotType': 'string',
'slotTypeVersion': 'string',
'valueElicitationPrompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'priority': 123,
'sampleUtterances': [
'string',
],
'responseCard': 'string'
},
],
'sampleUtterances': [
'string',
],
'confirmationPrompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'rejectionStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
'followUpPrompt': {
'prompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'rejectionStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
}
},
'conclusionStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
'dialogCodeHook': {
'uri': 'string',
'messageVersion': 'string'
},
'fulfillmentActivity': {
'type': 'ReturnIntent'|'CodeHook',
'codeHook': {
'uri': 'string',
'messageVersion': 'string'
}
},
'parentIntentSignature': 'string',
'lastUpdatedDate': datetime(2015, 1, 1),
'createdDate': datetime(2015, 1, 1),
'version': 'string',
'checksum': 'string'
}
:returns:
A confirmation prompt to ask the user to confirm an intent. For example, "Shall I order your pizza?"
A conclusion statement to send to the user after the intent has been fulfilled. For example, "I placed your pizza order."
A follow-up prompt that asks the user for additional activity. For example, asking "Do you want to order a drink with your pizza?"
"""
pass | Creates an intent or replaces an existing intent.
To define the interaction between the user and your bot, you use one or more intents. For a pizza ordering bot, for example, you would create an OrderPizza intent.
To create an intent or replace an existing intent, you must provide the following:
You can specify other optional information in the request, such as:
If you specify an existing intent name to update the intent, Amazon Lex replaces the values in the $LATEST version of the slot type with the values in the request. Amazon Lex removes fields that you don't provide in the request. If you don't specify the required fields, Amazon Lex throws an exception.
For more information, see how-it-works .
This operation requires permissions for the lex:PutIntent action.
See also: AWS API Documentation
:example: response = client.put_intent(
name='string',
description='string',
slots=[
{
'name': 'string',
'description': 'string',
'slotConstraint': 'Required'|'Optional',
'slotType': 'string',
'slotTypeVersion': 'string',
'valueElicitationPrompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'priority': 123,
'sampleUtterances': [
'string',
],
'responseCard': 'string'
},
],
sampleUtterances=[
'string',
],
confirmationPrompt={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
rejectionStatement={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
followUpPrompt={
'prompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'rejectionStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
}
},
conclusionStatement={
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
dialogCodeHook={
'uri': 'string',
'messageVersion': 'string'
},
fulfillmentActivity={
'type': 'ReturnIntent'|'CodeHook',
'codeHook': {
'uri': 'string',
'messageVersion': 'string'
}
},
parentIntentSignature='string',
checksum='string'
)
:type name: string
:param name: [REQUIRED]
The name of the intent. The name is not case sensitive.
The name can't match a built-in intent name, or a built-in intent name with 'AMAZON.' removed. For example, because there is a built-in intent called AMAZON.HelpIntent , you can't create a custom intent called HelpIntent .
For a list of built-in intents, see Standard Built-in Intents in the Alexa Skills Kit .
:type description: string
:param description: A description of the intent.
:type slots: list
:param slots: An array of intent slots. At runtime, Amazon Lex elicits required slot values from the user using prompts defined in the slots. For more information, see xref linkend='how-it-works'/.
(dict) --Identifies the version of a specific slot.
name (string) -- [REQUIRED]The name of the slot.
description (string) --A description of the slot.
slotConstraint (string) -- [REQUIRED]Specifies whether the slot is required or optional.
slotType (string) --The type of the slot, either a custom slot type that you defined or one of the built-in slot types.
slotTypeVersion (string) --The version of the slot type.
valueElicitationPrompt (dict) --The prompt that Amazon Lex uses to elicit the slot value from the user.
messages (list) -- [REQUIRED]An array of objects, each of which provides a message string and its type. You can specify the message string in plain text or in Speech Synthesis Markup Language (SSML).
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
maxAttempts (integer) -- [REQUIRED]The number of times to prompt the user for information.
responseCard (string) --A response card. Amazon Lex uses this prompt at runtime, in the PostText API response. It substitutes session attributes and slot values for placeholders in the response card. For more information, see ex-resp-card .
priority (integer) --Directs Lex the order in which to elicit this slot value from the user. For example, if the intent has two slots with priorities 1 and 2, AWS Lex first elicits a value for the slot with priority 1.
If multiple slots share the same priority, the order in which Lex elicits values is arbitrary.
sampleUtterances (list) --If you know a specific pattern with which users might respond to an Amazon Lex request for a slot value, you can provide those utterances to improve accuracy. This is optional. In most cases, Amazon Lex is capable of understanding user utterances.
(string) --
responseCard (string) --A set of possible responses for the slot type used by text-based clients. A user chooses an option from the response card, instead of using text to reply.
:type sampleUtterances: list
:param sampleUtterances: An array of utterances (strings) that a user might say to signal the intent. For example, 'I want {PizzaSize} pizza', 'Order {Quantity} {PizzaSize} pizzas'.
In each utterance, a slot name is enclosed in curly braces.
(string) --
:type confirmationPrompt: dict
:param confirmationPrompt: Prompts the user to confirm the intent. This question should have a yes or no answer.
Amazon Lex uses this prompt to ensure that the user acknowledges that the intent is ready for fulfillment. For example, with the OrderPizza intent, you might want to confirm that the order is correct before placing it. For other intents, such as intents that simply respond to user questions, you might not need to ask the user for confirmation before providing the information.
Note
You you must provide both the rejectionStatement and the confirmationPrompt , or neither.
messages (list) -- [REQUIRED]An array of objects, each of which provides a message string and its type. You can specify the message string in plain text or in Speech Synthesis Markup Language (SSML).
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
maxAttempts (integer) -- [REQUIRED]The number of times to prompt the user for information.
responseCard (string) --A response card. Amazon Lex uses this prompt at runtime, in the PostText API response. It substitutes session attributes and slot values for placeholders in the response card. For more information, see ex-resp-card .
:type rejectionStatement: dict
:param rejectionStatement: When the user answers 'no' to the question defined in confirmationPrompt , Amazon Lex responds with this statement to acknowledge that the intent was canceled.
Note
You must provide both the rejectionStatement and the confirmationPrompt , or neither.
messages (list) -- [REQUIRED]A collection of message objects.
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
responseCard (string) --At runtime, if the client is using the API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.
:type followUpPrompt: dict
:param followUpPrompt: A user prompt for additional activity after an intent is fulfilled. For example, after the OrderPizza intent is fulfilled (your Lambda function placed an order with a pizzeria), you might prompt the user to find if they want to order a drink (assuming that you have defined an OrderDrink intent in your bot).
Note
The followUpPrompt and conclusionStatement are mutually exclusive. You can specify only one. For example, your bot may not solicit both the following:
Follow up prompt - '$session.FirstName , your pizza order has been placed. Would you like to order a drink or a dessert?'
Conclusion statement - '$session.FirstName , your pizza order has been placed.'
prompt (dict) -- [REQUIRED]Obtains information from the user.
messages (list) -- [REQUIRED]An array of objects, each of which provides a message string and its type. You can specify the message string in plain text or in Speech Synthesis Markup Language (SSML).
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
maxAttempts (integer) -- [REQUIRED]The number of times to prompt the user for information.
responseCard (string) --A response card. Amazon Lex uses this prompt at runtime, in the PostText API response. It substitutes session attributes and slot values for placeholders in the response card. For more information, see ex-resp-card .
rejectionStatement (dict) -- [REQUIRED]If the user answers 'no' to the question defined in confirmationPrompt , Amazon Lex responds with this statement to acknowledge that the intent was canceled.
messages (list) -- [REQUIRED]A collection of message objects.
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
responseCard (string) --At runtime, if the client is using the API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.
:type conclusionStatement: dict
:param conclusionStatement: The statement that you want Amazon Lex to convey to the user after the intent is successfully fulfilled by the Lambda function.
This element is relevant only if you provide a Lambda function in the fulfillmentActivity . If you return the intent to the client application, you can't specify this element.
Note
The followUpPrompt and conclusionStatement are mutually exclusive. You can specify only one.
messages (list) -- [REQUIRED]A collection of message objects.
(dict) --The message object that provides the message text and its type.
contentType (string) -- [REQUIRED]The content type of the message string.
content (string) -- [REQUIRED]The text of the message.
responseCard (string) --At runtime, if the client is using the API, Amazon Lex includes the response card in the response. It substitutes all of the session attributes and slot values for placeholders in the response card.
:type dialogCodeHook: dict
:param dialogCodeHook: Specifies a Lambda function to invoke for each user input. You can invoke this Lambda function to personalize user interaction.
For example, suppose your bot determines that the user is John. Your Lambda function might retrieve John's information from a backend database and prepopulate some of the values. For example, if you find that John is gluten intolerant, you might set the corresponding intent slot, GlutenIntolerant , to true. You might find John's phone number and set the corresponding session attribute.
uri (string) -- [REQUIRED]The Amazon Resource Name (ARN) of the Lambda function.
messageVersion (string) -- [REQUIRED]The version of the request-response that you want Amazon Lex to use to invoke your Lambda function. For more information, see using-lambda .
:type fulfillmentActivity: dict
:param fulfillmentActivity: Describes how the intent is fulfilled. For example, after a user provides all of the information for a pizza order, fulfillmentActivity defines how the bot places an order with a local pizza store.
You might configure Amazon Lex to return all of the intent information to the client application, or direct it to invoke a Lambda function that can process the intent (for example, place an order with a pizzeria).
type (string) -- [REQUIRED]How the intent should be fulfilled, either by running a Lambda function or by returning the slot data to the client application.
codeHook (dict) --A description of the Lambda function that is run to fulfill the intent.
uri (string) -- [REQUIRED]The Amazon Resource Name (ARN) of the Lambda function.
messageVersion (string) -- [REQUIRED]The version of the request-response that you want Amazon Lex to use to invoke your Lambda function. For more information, see using-lambda .
:type parentIntentSignature: string
:param parentIntentSignature: A unique identifier for the built-in intent to base this intent on. To find the signature for an intent, see Standard Built-in Intents in the Alexa Skills Kit .
:type checksum: string
:param checksum: Identifies a specific revision of the $LATEST version.
When you create a new intent, leave the checksum field blank. If you specify a checksum you get a BadRequestException exception.
When you want to update a intent, set the checksum field to the checksum of the most recent revision of the $LATEST version. If you don't specify the checksum field, or if the checksum does not match the $LATEST version, you get a PreconditionFailedException exception.
:rtype: dict
:return: {
'name': 'string',
'description': 'string',
'slots': [
{
'name': 'string',
'description': 'string',
'slotConstraint': 'Required'|'Optional',
'slotType': 'string',
'slotTypeVersion': 'string',
'valueElicitationPrompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'priority': 123,
'sampleUtterances': [
'string',
],
'responseCard': 'string'
},
],
'sampleUtterances': [
'string',
],
'confirmationPrompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'rejectionStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
'followUpPrompt': {
'prompt': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'maxAttempts': 123,
'responseCard': 'string'
},
'rejectionStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
}
},
'conclusionStatement': {
'messages': [
{
'contentType': 'PlainText'|'SSML',
'content': 'string'
},
],
'responseCard': 'string'
},
'dialogCodeHook': {
'uri': 'string',
'messageVersion': 'string'
},
'fulfillmentActivity': {
'type': 'ReturnIntent'|'CodeHook',
'codeHook': {
'uri': 'string',
'messageVersion': 'string'
}
},
'parentIntentSignature': 'string',
'lastUpdatedDate': datetime(2015, 1, 1),
'createdDate': datetime(2015, 1, 1),
'version': 'string',
'checksum': 'string'
}
:returns:
A confirmation prompt to ask the user to confirm an intent. For example, "Shall I order your pizza?"
A conclusion statement to send to the user after the intent has been fulfilled. For example, "I placed your pizza order."
A follow-up prompt that asks the user for additional activity. For example, asking "Do you want to order a drink with your pizza?" | entailment |
def create_cache_cluster(CacheClusterId=None, ReplicationGroupId=None, AZMode=None, PreferredAvailabilityZone=None, PreferredAvailabilityZones=None, NumCacheNodes=None, CacheNodeType=None, Engine=None, EngineVersion=None, CacheParameterGroupName=None, CacheSubnetGroupName=None, CacheSecurityGroupNames=None, SecurityGroupIds=None, Tags=None, SnapshotArns=None, SnapshotName=None, PreferredMaintenanceWindow=None, Port=None, NotificationTopicArn=None, AutoMinorVersionUpgrade=None, SnapshotRetentionLimit=None, SnapshotWindow=None, AuthToken=None):
"""
Creates a cache cluster. All nodes in the cache cluster run the same protocol-compliant cache engine software, either Memcached or Redis.
See also: AWS API Documentation
:example: response = client.create_cache_cluster(
CacheClusterId='string',
ReplicationGroupId='string',
AZMode='single-az'|'cross-az',
PreferredAvailabilityZone='string',
PreferredAvailabilityZones=[
'string',
],
NumCacheNodes=123,
CacheNodeType='string',
Engine='string',
EngineVersion='string',
CacheParameterGroupName='string',
CacheSubnetGroupName='string',
CacheSecurityGroupNames=[
'string',
],
SecurityGroupIds=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
SnapshotArns=[
'string',
],
SnapshotName='string',
PreferredMaintenanceWindow='string',
Port=123,
NotificationTopicArn='string',
AutoMinorVersionUpgrade=True|False,
SnapshotRetentionLimit=123,
SnapshotWindow='string',
AuthToken='string'
)
:type CacheClusterId: string
:param CacheClusterId: [REQUIRED]
The node group (shard) identifier. This parameter is stored as a lowercase string.
Constraints:
A name must contain from 1 to 20 alphanumeric characters or hyphens.
The first character must be a letter.
A name cannot end with a hyphen or contain two consecutive hyphens.
:type ReplicationGroupId: string
:param ReplicationGroupId:
Warning
Due to current limitations on Redis (cluster mode disabled), this operation or parameter is not supported on Redis (cluster mode enabled) replication groups.
The ID of the replication group to which this cache cluster should belong. If this parameter is specified, the cache cluster is added to the specified replication group as a read replica; otherwise, the cache cluster is a standalone primary that is not part of any replication group.
If the specified replication group is Multi-AZ enabled and the Availability Zone is not specified, the cache cluster is created in Availability Zones that provide the best spread of read replicas across Availability Zones.
Note
This parameter is only valid if the Engine parameter is redis .
:type AZMode: string
:param AZMode: Specifies whether the nodes in this Memcached cluster are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region.
This parameter is only supported for Memcached cache clusters.
If the AZMode and PreferredAvailabilityZones are not specified, ElastiCache assumes single-az mode.
:type PreferredAvailabilityZone: string
:param PreferredAvailabilityZone: The EC2 Availability Zone in which the cache cluster is created.
All nodes belonging to this Memcached cache cluster are placed in the preferred Availability Zone. If you want to create your nodes across multiple Availability Zones, use PreferredAvailabilityZones .
Default: System chosen Availability Zone.
:type PreferredAvailabilityZones: list
:param PreferredAvailabilityZones: A list of the Availability Zones in which cache nodes are created. The order of the zones in the list is not important.
This option is only supported on Memcached.
Note
If you are creating your cache cluster in an Amazon VPC (recommended) you can only locate nodes in Availability Zones that are associated with the subnets in the selected subnet group.
The number of Availability Zones listed must equal the value of NumCacheNodes .
If you want all the nodes in the same Availability Zone, use PreferredAvailabilityZone instead, or repeat the Availability Zone multiple times in the list.
Default: System chosen Availability Zones.
(string) --
:type NumCacheNodes: integer
:param NumCacheNodes: The initial number of cache nodes that the cache cluster has.
For clusters running Redis, this value must be 1. For clusters running Memcached, this value must be between 1 and 20.
If you need more than 20 nodes for your Memcached cluster, please fill out the ElastiCache Limit Increase Request form at http://aws.amazon.com/contact-us/elasticache-node-limit-request/ .
:type CacheNodeType: string
:param CacheNodeType: The compute and memory capacity of the nodes in the node group (shard).
Valid node types are as follows:
General purpose:
Current generation: cache.t2.micro , cache.t2.small , cache.t2.medium , cache.m3.medium , cache.m3.large , cache.m3.xlarge , cache.m3.2xlarge , cache.m4.large , cache.m4.xlarge , cache.m4.2xlarge , cache.m4.4xlarge , cache.m4.10xlarge
Previous generation: cache.t1.micro , cache.m1.small , cache.m1.medium , cache.m1.large , cache.m1.xlarge
Compute optimized: cache.c1.xlarge
Memory optimized:
Current generation: cache.r3.large , cache.r3.xlarge , cache.r3.2xlarge , cache.r3.4xlarge , cache.r3.8xlarge
Previous generation: cache.m2.xlarge , cache.m2.2xlarge , cache.m2.4xlarge
Notes:
All T2 instances are created in an Amazon Virtual Private Cloud (Amazon VPC).
Redis backup/restore is not supported for Redis (cluster mode disabled) T1 and T2 instances. Backup/restore is supported on Redis (cluster mode enabled) T2 instances.
Redis Append-only files (AOF) functionality is not supported for T1 or T2 instances.
For a complete listing of node types and specifications, see Amazon ElastiCache Product Features and Details and either Cache Node Type-Specific Parameters for Memcached or Cache Node Type-Specific Parameters for Redis .
:type Engine: string
:param Engine: The name of the cache engine to be used for this cache cluster.
Valid values for this parameter are: memcached | redis
:type EngineVersion: string
:param EngineVersion: The version number of the cache engine to be used for this cache cluster. To view the supported cache engine versions, use the DescribeCacheEngineVersions operation.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version ), but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing cache cluster or replication group and create it anew with the earlier engine version.
:type CacheParameterGroupName: string
:param CacheParameterGroupName: The name of the parameter group to associate with this cache cluster. If this argument is omitted, the default parameter group for the specified engine is used. You cannot use any parameter group which has cluster-enabled='yes' when creating a cluster.
:type CacheSubnetGroupName: string
:param CacheSubnetGroupName: The name of the subnet group to be used for the cache cluster.
Use this parameter only when you are creating a cache cluster in an Amazon Virtual Private Cloud (Amazon VPC).
Warning
If you're going to launch your cluster in an Amazon VPC, you need to create a subnet group before you start creating a cluster. For more information, see Subnets and Subnet Groups .
:type CacheSecurityGroupNames: list
:param CacheSecurityGroupNames: A list of security group names to associate with this cache cluster.
Use this parameter only when you are creating a cache cluster outside of an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type SecurityGroupIds: list
:param SecurityGroupIds: One or more VPC security groups associated with the cache cluster.
Use this parameter only when you are creating a cache cluster in an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type Tags: list
:param Tags: A list of cost allocation tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value.
(dict) --A cost allocation Tag that can be added to an ElastiCache cluster or replication group. Tags are composed of a Key/Value pair. A tag with a null Value is permitted.
Key (string) --The key for the tag. May not be null.
Value (string) --The tag's value. May be null.
:type SnapshotArns: list
:param SnapshotArns: A single-element string list containing an Amazon Resource Name (ARN) that uniquely identifies a Redis RDB snapshot file stored in Amazon S3. The snapshot file is used to populate the node group (shard). The Amazon S3 object name in the ARN cannot contain any commas.
Note
This parameter is only valid if the Engine parameter is redis .
Example of an Amazon S3 ARN: arn:aws:s3:::my_bucket/snapshot1.rdb
(string) --
:type SnapshotName: string
:param SnapshotName: The name of a Redis snapshot from which to restore data into the new node group (shard). The snapshot status changes to restoring while the new node group (shard) is being created.
Note
This parameter is only valid if the Engine parameter is redis .
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: Specifies the weekly time range during which maintenance on the cache cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period. Valid values for ddd are:
Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for ddd are:
sun
mon
tue
wed
thu
fri
sat
Example: sun:23:00-mon:01:30
:type Port: integer
:param Port: The port number on which each of the cache nodes accepts connections.
:type NotificationTopicArn: string
:param NotificationTopicArn: The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.
Note
The Amazon SNS topic owner must be the same as the cache cluster owner.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: This parameter is currently disabled.
:type SnapshotRetentionLimit: integer
:param SnapshotRetentionLimit: The number of days for which ElastiCache retains automatic snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot taken today is retained for 5 days before being deleted.
Note
This parameter is only valid if the Engine parameter is redis .
Default: 0 (i.e., automatic backups are disabled for this cache cluster).
:type SnapshotWindow: string
:param SnapshotWindow: The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your node group (shard).
Example: 05:00-09:00
If you do not specify this parameter, ElastiCache automatically chooses an appropriate time range.
Note: This parameter is only valid if the Engine parameter is redis .
:type AuthToken: string
:param AuthToken:
Reserved parameter. The password used to access a password protected server.
Password constraints:
Must be only printable ASCII characters.
Must be at least 16 characters and no more than 128 characters in length.
Cannot contain any of the following characters: '/', ''', or '@'.
For more information, see AUTH password at Redis.
:rtype: dict
:return: {
'CacheCluster': {
'CacheClusterId': 'string',
'ConfigurationEndpoint': {
'Address': 'string',
'Port': 123
},
'ClientDownloadLandingPage': 'string',
'CacheNodeType': 'string',
'Engine': 'string',
'EngineVersion': 'string',
'CacheClusterStatus': 'string',
'NumCacheNodes': 123,
'PreferredAvailabilityZone': 'string',
'CacheClusterCreateTime': datetime(2015, 1, 1),
'PreferredMaintenanceWindow': 'string',
'PendingModifiedValues': {
'NumCacheNodes': 123,
'CacheNodeIdsToRemove': [
'string',
],
'EngineVersion': 'string',
'CacheNodeType': 'string'
},
'NotificationConfiguration': {
'TopicArn': 'string',
'TopicStatus': 'string'
},
'CacheSecurityGroups': [
{
'CacheSecurityGroupName': 'string',
'Status': 'string'
},
],
'CacheParameterGroup': {
'CacheParameterGroupName': 'string',
'ParameterApplyStatus': 'string',
'CacheNodeIdsToReboot': [
'string',
]
},
'CacheSubnetGroupName': 'string',
'CacheNodes': [
{
'CacheNodeId': 'string',
'CacheNodeStatus': 'string',
'CacheNodeCreateTime': datetime(2015, 1, 1),
'Endpoint': {
'Address': 'string',
'Port': 123
},
'ParameterGroupStatus': 'string',
'SourceCacheNodeId': 'string',
'CustomerAvailabilityZone': 'string'
},
],
'AutoMinorVersionUpgrade': True|False,
'SecurityGroups': [
{
'SecurityGroupId': 'string',
'Status': 'string'
},
],
'ReplicationGroupId': 'string',
'SnapshotRetentionLimit': 123,
'SnapshotWindow': 'string'
}
}
:returns:
General purpose:
Current generation: cache.t2.micro , cache.t2.small , cache.t2.medium , cache.m3.medium , cache.m3.large , cache.m3.xlarge , cache.m3.2xlarge , cache.m4.large , cache.m4.xlarge , cache.m4.2xlarge , cache.m4.4xlarge , cache.m4.10xlarge
Previous generation: cache.t1.micro , cache.m1.small , cache.m1.medium , cache.m1.large , cache.m1.xlarge
Compute optimized: cache.c1.xlarge
Memory optimized:
Current generation: cache.r3.large , cache.r3.xlarge , cache.r3.2xlarge , cache.r3.4xlarge , cache.r3.8xlarge
Previous generation: cache.m2.xlarge , cache.m2.2xlarge , cache.m2.4xlarge
"""
pass | Creates a cache cluster. All nodes in the cache cluster run the same protocol-compliant cache engine software, either Memcached or Redis.
See also: AWS API Documentation
:example: response = client.create_cache_cluster(
CacheClusterId='string',
ReplicationGroupId='string',
AZMode='single-az'|'cross-az',
PreferredAvailabilityZone='string',
PreferredAvailabilityZones=[
'string',
],
NumCacheNodes=123,
CacheNodeType='string',
Engine='string',
EngineVersion='string',
CacheParameterGroupName='string',
CacheSubnetGroupName='string',
CacheSecurityGroupNames=[
'string',
],
SecurityGroupIds=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
SnapshotArns=[
'string',
],
SnapshotName='string',
PreferredMaintenanceWindow='string',
Port=123,
NotificationTopicArn='string',
AutoMinorVersionUpgrade=True|False,
SnapshotRetentionLimit=123,
SnapshotWindow='string',
AuthToken='string'
)
:type CacheClusterId: string
:param CacheClusterId: [REQUIRED]
The node group (shard) identifier. This parameter is stored as a lowercase string.
Constraints:
A name must contain from 1 to 20 alphanumeric characters or hyphens.
The first character must be a letter.
A name cannot end with a hyphen or contain two consecutive hyphens.
:type ReplicationGroupId: string
:param ReplicationGroupId:
Warning
Due to current limitations on Redis (cluster mode disabled), this operation or parameter is not supported on Redis (cluster mode enabled) replication groups.
The ID of the replication group to which this cache cluster should belong. If this parameter is specified, the cache cluster is added to the specified replication group as a read replica; otherwise, the cache cluster is a standalone primary that is not part of any replication group.
If the specified replication group is Multi-AZ enabled and the Availability Zone is not specified, the cache cluster is created in Availability Zones that provide the best spread of read replicas across Availability Zones.
Note
This parameter is only valid if the Engine parameter is redis .
:type AZMode: string
:param AZMode: Specifies whether the nodes in this Memcached cluster are created in a single Availability Zone or created across multiple Availability Zones in the cluster's region.
This parameter is only supported for Memcached cache clusters.
If the AZMode and PreferredAvailabilityZones are not specified, ElastiCache assumes single-az mode.
:type PreferredAvailabilityZone: string
:param PreferredAvailabilityZone: The EC2 Availability Zone in which the cache cluster is created.
All nodes belonging to this Memcached cache cluster are placed in the preferred Availability Zone. If you want to create your nodes across multiple Availability Zones, use PreferredAvailabilityZones .
Default: System chosen Availability Zone.
:type PreferredAvailabilityZones: list
:param PreferredAvailabilityZones: A list of the Availability Zones in which cache nodes are created. The order of the zones in the list is not important.
This option is only supported on Memcached.
Note
If you are creating your cache cluster in an Amazon VPC (recommended) you can only locate nodes in Availability Zones that are associated with the subnets in the selected subnet group.
The number of Availability Zones listed must equal the value of NumCacheNodes .
If you want all the nodes in the same Availability Zone, use PreferredAvailabilityZone instead, or repeat the Availability Zone multiple times in the list.
Default: System chosen Availability Zones.
(string) --
:type NumCacheNodes: integer
:param NumCacheNodes: The initial number of cache nodes that the cache cluster has.
For clusters running Redis, this value must be 1. For clusters running Memcached, this value must be between 1 and 20.
If you need more than 20 nodes for your Memcached cluster, please fill out the ElastiCache Limit Increase Request form at http://aws.amazon.com/contact-us/elasticache-node-limit-request/ .
:type CacheNodeType: string
:param CacheNodeType: The compute and memory capacity of the nodes in the node group (shard).
Valid node types are as follows:
General purpose:
Current generation: cache.t2.micro , cache.t2.small , cache.t2.medium , cache.m3.medium , cache.m3.large , cache.m3.xlarge , cache.m3.2xlarge , cache.m4.large , cache.m4.xlarge , cache.m4.2xlarge , cache.m4.4xlarge , cache.m4.10xlarge
Previous generation: cache.t1.micro , cache.m1.small , cache.m1.medium , cache.m1.large , cache.m1.xlarge
Compute optimized: cache.c1.xlarge
Memory optimized:
Current generation: cache.r3.large , cache.r3.xlarge , cache.r3.2xlarge , cache.r3.4xlarge , cache.r3.8xlarge
Previous generation: cache.m2.xlarge , cache.m2.2xlarge , cache.m2.4xlarge
Notes:
All T2 instances are created in an Amazon Virtual Private Cloud (Amazon VPC).
Redis backup/restore is not supported for Redis (cluster mode disabled) T1 and T2 instances. Backup/restore is supported on Redis (cluster mode enabled) T2 instances.
Redis Append-only files (AOF) functionality is not supported for T1 or T2 instances.
For a complete listing of node types and specifications, see Amazon ElastiCache Product Features and Details and either Cache Node Type-Specific Parameters for Memcached or Cache Node Type-Specific Parameters for Redis .
:type Engine: string
:param Engine: The name of the cache engine to be used for this cache cluster.
Valid values for this parameter are: memcached | redis
:type EngineVersion: string
:param EngineVersion: The version number of the cache engine to be used for this cache cluster. To view the supported cache engine versions, use the DescribeCacheEngineVersions operation.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version ), but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing cache cluster or replication group and create it anew with the earlier engine version.
:type CacheParameterGroupName: string
:param CacheParameterGroupName: The name of the parameter group to associate with this cache cluster. If this argument is omitted, the default parameter group for the specified engine is used. You cannot use any parameter group which has cluster-enabled='yes' when creating a cluster.
:type CacheSubnetGroupName: string
:param CacheSubnetGroupName: The name of the subnet group to be used for the cache cluster.
Use this parameter only when you are creating a cache cluster in an Amazon Virtual Private Cloud (Amazon VPC).
Warning
If you're going to launch your cluster in an Amazon VPC, you need to create a subnet group before you start creating a cluster. For more information, see Subnets and Subnet Groups .
:type CacheSecurityGroupNames: list
:param CacheSecurityGroupNames: A list of security group names to associate with this cache cluster.
Use this parameter only when you are creating a cache cluster outside of an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type SecurityGroupIds: list
:param SecurityGroupIds: One or more VPC security groups associated with the cache cluster.
Use this parameter only when you are creating a cache cluster in an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type Tags: list
:param Tags: A list of cost allocation tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value.
(dict) --A cost allocation Tag that can be added to an ElastiCache cluster or replication group. Tags are composed of a Key/Value pair. A tag with a null Value is permitted.
Key (string) --The key for the tag. May not be null.
Value (string) --The tag's value. May be null.
:type SnapshotArns: list
:param SnapshotArns: A single-element string list containing an Amazon Resource Name (ARN) that uniquely identifies a Redis RDB snapshot file stored in Amazon S3. The snapshot file is used to populate the node group (shard). The Amazon S3 object name in the ARN cannot contain any commas.
Note
This parameter is only valid if the Engine parameter is redis .
Example of an Amazon S3 ARN: arn:aws:s3:::my_bucket/snapshot1.rdb
(string) --
:type SnapshotName: string
:param SnapshotName: The name of a Redis snapshot from which to restore data into the new node group (shard). The snapshot status changes to restoring while the new node group (shard) is being created.
Note
This parameter is only valid if the Engine parameter is redis .
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: Specifies the weekly time range during which maintenance on the cache cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period. Valid values for ddd are:
Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for ddd are:
sun
mon
tue
wed
thu
fri
sat
Example: sun:23:00-mon:01:30
:type Port: integer
:param Port: The port number on which each of the cache nodes accepts connections.
:type NotificationTopicArn: string
:param NotificationTopicArn: The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.
Note
The Amazon SNS topic owner must be the same as the cache cluster owner.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: This parameter is currently disabled.
:type SnapshotRetentionLimit: integer
:param SnapshotRetentionLimit: The number of days for which ElastiCache retains automatic snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot taken today is retained for 5 days before being deleted.
Note
This parameter is only valid if the Engine parameter is redis .
Default: 0 (i.e., automatic backups are disabled for this cache cluster).
:type SnapshotWindow: string
:param SnapshotWindow: The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your node group (shard).
Example: 05:00-09:00
If you do not specify this parameter, ElastiCache automatically chooses an appropriate time range.
Note: This parameter is only valid if the Engine parameter is redis .
:type AuthToken: string
:param AuthToken:
Reserved parameter. The password used to access a password protected server.
Password constraints:
Must be only printable ASCII characters.
Must be at least 16 characters and no more than 128 characters in length.
Cannot contain any of the following characters: '/', ''', or '@'.
For more information, see AUTH password at Redis.
:rtype: dict
:return: {
'CacheCluster': {
'CacheClusterId': 'string',
'ConfigurationEndpoint': {
'Address': 'string',
'Port': 123
},
'ClientDownloadLandingPage': 'string',
'CacheNodeType': 'string',
'Engine': 'string',
'EngineVersion': 'string',
'CacheClusterStatus': 'string',
'NumCacheNodes': 123,
'PreferredAvailabilityZone': 'string',
'CacheClusterCreateTime': datetime(2015, 1, 1),
'PreferredMaintenanceWindow': 'string',
'PendingModifiedValues': {
'NumCacheNodes': 123,
'CacheNodeIdsToRemove': [
'string',
],
'EngineVersion': 'string',
'CacheNodeType': 'string'
},
'NotificationConfiguration': {
'TopicArn': 'string',
'TopicStatus': 'string'
},
'CacheSecurityGroups': [
{
'CacheSecurityGroupName': 'string',
'Status': 'string'
},
],
'CacheParameterGroup': {
'CacheParameterGroupName': 'string',
'ParameterApplyStatus': 'string',
'CacheNodeIdsToReboot': [
'string',
]
},
'CacheSubnetGroupName': 'string',
'CacheNodes': [
{
'CacheNodeId': 'string',
'CacheNodeStatus': 'string',
'CacheNodeCreateTime': datetime(2015, 1, 1),
'Endpoint': {
'Address': 'string',
'Port': 123
},
'ParameterGroupStatus': 'string',
'SourceCacheNodeId': 'string',
'CustomerAvailabilityZone': 'string'
},
],
'AutoMinorVersionUpgrade': True|False,
'SecurityGroups': [
{
'SecurityGroupId': 'string',
'Status': 'string'
},
],
'ReplicationGroupId': 'string',
'SnapshotRetentionLimit': 123,
'SnapshotWindow': 'string'
}
}
:returns:
General purpose:
Current generation: cache.t2.micro , cache.t2.small , cache.t2.medium , cache.m3.medium , cache.m3.large , cache.m3.xlarge , cache.m3.2xlarge , cache.m4.large , cache.m4.xlarge , cache.m4.2xlarge , cache.m4.4xlarge , cache.m4.10xlarge
Previous generation: cache.t1.micro , cache.m1.small , cache.m1.medium , cache.m1.large , cache.m1.xlarge
Compute optimized: cache.c1.xlarge
Memory optimized:
Current generation: cache.r3.large , cache.r3.xlarge , cache.r3.2xlarge , cache.r3.4xlarge , cache.r3.8xlarge
Previous generation: cache.m2.xlarge , cache.m2.2xlarge , cache.m2.4xlarge | entailment |
def create_replication_group(ReplicationGroupId=None, ReplicationGroupDescription=None, PrimaryClusterId=None, AutomaticFailoverEnabled=None, NumCacheClusters=None, PreferredCacheClusterAZs=None, NumNodeGroups=None, ReplicasPerNodeGroup=None, NodeGroupConfiguration=None, CacheNodeType=None, Engine=None, EngineVersion=None, CacheParameterGroupName=None, CacheSubnetGroupName=None, CacheSecurityGroupNames=None, SecurityGroupIds=None, Tags=None, SnapshotArns=None, SnapshotName=None, PreferredMaintenanceWindow=None, Port=None, NotificationTopicArn=None, AutoMinorVersionUpgrade=None, SnapshotRetentionLimit=None, SnapshotWindow=None, AuthToken=None):
"""
Creates a Redis (cluster mode disabled) or a Redis (cluster mode enabled) replication group.
A Redis (cluster mode disabled) replication group is a collection of cache clusters, where one of the cache clusters is a read/write primary and the others are read-only replicas. Writes to the primary are asynchronously propagated to the replicas.
A Redis (cluster mode enabled) replication group is a collection of 1 to 15 node groups (shards). Each node group (shard) has one read/write primary node and up to 5 read-only replica nodes. Writes to the primary are asynchronously propagated to the replicas. Redis (cluster mode enabled) replication groups partition the data across node groups (shards).
When a Redis (cluster mode disabled) replication group has been successfully created, you can add one or more read replicas to it, up to a total of 5 read replicas. You cannot alter a Redis (cluster mode enabled) replication group after it has been created. However, if you need to increase or decrease the number of node groups (console: shards), you can avail yourself of ElastiCache for Redis' enhanced backup and restore. For more information, see Restoring From a Backup with Cluster Resizing in the ElastiCache User Guide .
See also: AWS API Documentation
:example: response = client.create_replication_group(
ReplicationGroupId='string',
ReplicationGroupDescription='string',
PrimaryClusterId='string',
AutomaticFailoverEnabled=True|False,
NumCacheClusters=123,
PreferredCacheClusterAZs=[
'string',
],
NumNodeGroups=123,
ReplicasPerNodeGroup=123,
NodeGroupConfiguration=[
{
'Slots': 'string',
'ReplicaCount': 123,
'PrimaryAvailabilityZone': 'string',
'ReplicaAvailabilityZones': [
'string',
]
},
],
CacheNodeType='string',
Engine='string',
EngineVersion='string',
CacheParameterGroupName='string',
CacheSubnetGroupName='string',
CacheSecurityGroupNames=[
'string',
],
SecurityGroupIds=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
SnapshotArns=[
'string',
],
SnapshotName='string',
PreferredMaintenanceWindow='string',
Port=123,
NotificationTopicArn='string',
AutoMinorVersionUpgrade=True|False,
SnapshotRetentionLimit=123,
SnapshotWindow='string',
AuthToken='string'
)
:type ReplicationGroupId: string
:param ReplicationGroupId: [REQUIRED]
The replication group identifier. This parameter is stored as a lowercase string.
Constraints:
A name must contain from 1 to 20 alphanumeric characters or hyphens.
The first character must be a letter.
A name cannot end with a hyphen or contain two consecutive hyphens.
:type ReplicationGroupDescription: string
:param ReplicationGroupDescription: [REQUIRED]
A user-created description for the replication group.
:type PrimaryClusterId: string
:param PrimaryClusterId: The identifier of the cache cluster that serves as the primary for this replication group. This cache cluster must already exist and have a status of available .
This parameter is not required if NumCacheClusters , NumNodeGroups , or ReplicasPerNodeGroup is specified.
:type AutomaticFailoverEnabled: boolean
:param AutomaticFailoverEnabled: Specifies whether a read-only replica is automatically promoted to read/write primary if the existing primary fails.
If true , Multi-AZ is enabled for this replication group. If false , Multi-AZ is disabled for this replication group.
AutomaticFailoverEnabled must be enabled for Redis (cluster mode enabled) replication groups.
Default: false
Note
ElastiCache Multi-AZ replication groups is not supported on:
Redis versions earlier than 2.8.6.
Redis (cluster mode disabled): T1 and T2 node types. Redis (cluster mode enabled): T2 node types.
:type NumCacheClusters: integer
:param NumCacheClusters: The number of clusters this replication group initially has.
This parameter is not used if there is more than one node group (shard). You should use ReplicasPerNodeGroup instead.
If AutomaticFailoverEnabled is true , the value of this parameter must be at least 2. If AutomaticFailoverEnabled is false you can omit this parameter (it will default to 1), or you can explicitly set it to a value between 2 and 6.
The maximum permitted value for NumCacheClusters is 6 (primary plus 5 replicas).
:type PreferredCacheClusterAZs: list
:param PreferredCacheClusterAZs: A list of EC2 Availability Zones in which the replication group's cache clusters are created. The order of the Availability Zones in the list is the order in which clusters are allocated. The primary cluster is created in the first AZ in the list.
This parameter is not used if there is more than one node group (shard). You should use NodeGroupConfiguration instead.
Note
If you are creating your replication group in an Amazon VPC (recommended), you can only locate cache clusters in Availability Zones associated with the subnets in the selected subnet group.
The number of Availability Zones listed must equal the value of NumCacheClusters .
Default: system chosen Availability Zones.
(string) --
:type NumNodeGroups: integer
:param NumNodeGroups: An optional parameter that specifies the number of node groups (shards) for this Redis (cluster mode enabled) replication group. For Redis (cluster mode disabled) either omit this parameter or set it to 1.
Default: 1
:type ReplicasPerNodeGroup: integer
:param ReplicasPerNodeGroup: An optional parameter that specifies the number of replica nodes in each node group (shard). Valid values are 0 to 5.
:type NodeGroupConfiguration: list
:param NodeGroupConfiguration: A list of node group (shard) configuration options. Each node group (shard) configuration has the following: Slots, PrimaryAvailabilityZone, ReplicaAvailabilityZones, ReplicaCount.
If you're creating a Redis (cluster mode disabled) or a Redis (cluster mode enabled) replication group, you can use this parameter to individually configure each node group (shard), or you can omit this parameter.
(dict) --node group (shard) configuration options. Each node group (shard) configuration has the following: Slots , PrimaryAvailabilityZone , ReplicaAvailabilityZones , ReplicaCount .
Slots (string) --A string that specifies the keyspace for a particular node group. Keyspaces range from 0 to 16,383. The string is in the format startkey-endkey .
Example: '0-3999'
ReplicaCount (integer) --The number of read replica nodes in this node group (shard).
PrimaryAvailabilityZone (string) --The Availability Zone where the primary node of this node group (shard) is launched.
ReplicaAvailabilityZones (list) --A list of Availability Zones to be used for the read replicas. The number of Availability Zones in this list must match the value of ReplicaCount or ReplicasPerNodeGroup if not specified.
(string) --
:type CacheNodeType: string
:param CacheNodeType: The compute and memory capacity of the nodes in the node group (shard).
Valid node types are as follows:
General purpose:
Current generation: cache.t2.micro , cache.t2.small , cache.t2.medium , cache.m3.medium , cache.m3.large , cache.m3.xlarge , cache.m3.2xlarge , cache.m4.large , cache.m4.xlarge , cache.m4.2xlarge , cache.m4.4xlarge , cache.m4.10xlarge
Previous generation: cache.t1.micro , cache.m1.small , cache.m1.medium , cache.m1.large , cache.m1.xlarge
Compute optimized: cache.c1.xlarge
Memory optimized:
Current generation: cache.r3.large , cache.r3.xlarge , cache.r3.2xlarge , cache.r3.4xlarge , cache.r3.8xlarge
Previous generation: cache.m2.xlarge , cache.m2.2xlarge , cache.m2.4xlarge
Notes:
All T2 instances are created in an Amazon Virtual Private Cloud (Amazon VPC).
Redis backup/restore is not supported for Redis (cluster mode disabled) T1 and T2 instances. Backup/restore is supported on Redis (cluster mode enabled) T2 instances.
Redis Append-only files (AOF) functionality is not supported for T1 or T2 instances.
For a complete listing of node types and specifications, see Amazon ElastiCache Product Features and Details and either Cache Node Type-Specific Parameters for Memcached or Cache Node Type-Specific Parameters for Redis .
:type Engine: string
:param Engine: The name of the cache engine to be used for the cache clusters in this replication group.
:type EngineVersion: string
:param EngineVersion: The version number of the cache engine to be used for the cache clusters in this replication group. To view the supported cache engine versions, use the DescribeCacheEngineVersions operation.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version ) in the ElastiCache User Guide , but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing cache cluster or replication group and create it anew with the earlier engine version.
:type CacheParameterGroupName: string
:param CacheParameterGroupName: The name of the parameter group to associate with this replication group. If this argument is omitted, the default cache parameter group for the specified engine is used.
If you are running Redis version 3.2.4 or later, only one node group (shard), and want to use a default parameter group, we recommend that you specify the parameter group by name.
To create a Redis (cluster mode disabled) replication group, use CacheParameterGroupName=default.redis3.2 .
To create a Redis (cluster mode enabled) replication group, use CacheParameterGroupName=default.redis3.2.cluster.on .
:type CacheSubnetGroupName: string
:param CacheSubnetGroupName: The name of the cache subnet group to be used for the replication group.
Warning
If you're going to launch your cluster in an Amazon VPC, you need to create a subnet group before you start creating a cluster. For more information, see Subnets and Subnet Groups .
:type CacheSecurityGroupNames: list
:param CacheSecurityGroupNames: A list of cache security group names to associate with this replication group.
(string) --
:type SecurityGroupIds: list
:param SecurityGroupIds: One or more Amazon VPC security groups associated with this replication group.
Use this parameter only when you are creating a replication group in an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type Tags: list
:param Tags: A list of cost allocation tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value.
(dict) --A cost allocation Tag that can be added to an ElastiCache cluster or replication group. Tags are composed of a Key/Value pair. A tag with a null Value is permitted.
Key (string) --The key for the tag. May not be null.
Value (string) --The tag's value. May be null.
:type SnapshotArns: list
:param SnapshotArns: A list of Amazon Resource Names (ARN) that uniquely identify the Redis RDB snapshot files stored in Amazon S3. The snapshot files are used to populate the new replication group. The Amazon S3 object name in the ARN cannot contain any commas. The new replication group will have the number of node groups (console: shards) specified by the parameter NumNodeGroups or the number of node groups configured by NodeGroupConfiguration regardless of the number of ARNs specified here.
Note
This parameter is only valid if the Engine parameter is redis .
Example of an Amazon S3 ARN: arn:aws:s3:::my_bucket/snapshot1.rdb
(string) --
:type SnapshotName: string
:param SnapshotName: The name of a snapshot from which to restore data into the new replication group. The snapshot status changes to restoring while the new replication group is being created.
Note
This parameter is only valid if the Engine parameter is redis .
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: Specifies the weekly time range during which maintenance on the cache cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period. Valid values for ddd are:
Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for ddd are:
sun
mon
tue
wed
thu
fri
sat
Example: sun:23:00-mon:01:30
:type Port: integer
:param Port: The port number on which each member of the replication group accepts connections.
:type NotificationTopicArn: string
:param NotificationTopicArn: The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.
Note
The Amazon SNS topic owner must be the same as the cache cluster owner.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: This parameter is currently disabled.
:type SnapshotRetentionLimit: integer
:param SnapshotRetentionLimit: The number of days for which ElastiCache retains automatic snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.
Note
This parameter is only valid if the Engine parameter is redis .
Default: 0 (i.e., automatic backups are disabled for this cache cluster).
:type SnapshotWindow: string
:param SnapshotWindow: The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your node group (shard).
Example: 05:00-09:00
If you do not specify this parameter, ElastiCache automatically chooses an appropriate time range.
Note
This parameter is only valid if the Engine parameter is redis .
:type AuthToken: string
:param AuthToken:
Reserved parameter. The password used to access a password protected server.
Password constraints:
Must be only printable ASCII characters.
Must be at least 16 characters and no more than 128 characters in length.
Cannot contain any of the following characters: '/', ''', or '@'.
For more information, see AUTH password at Redis.
:rtype: dict
:return: {
'ReplicationGroup': {
'ReplicationGroupId': 'string',
'Description': 'string',
'Status': 'string',
'PendingModifiedValues': {
'PrimaryClusterId': 'string',
'AutomaticFailoverStatus': 'enabled'|'disabled'
},
'MemberClusters': [
'string',
],
'NodeGroups': [
{
'NodeGroupId': 'string',
'Status': 'string',
'PrimaryEndpoint': {
'Address': 'string',
'Port': 123
},
'Slots': 'string',
'NodeGroupMembers': [
{
'CacheClusterId': 'string',
'CacheNodeId': 'string',
'ReadEndpoint': {
'Address': 'string',
'Port': 123
},
'PreferredAvailabilityZone': 'string',
'CurrentRole': 'string'
},
]
},
],
'SnapshottingClusterId': 'string',
'AutomaticFailover': 'enabled'|'disabled'|'enabling'|'disabling',
'ConfigurationEndpoint': {
'Address': 'string',
'Port': 123
},
'SnapshotRetentionLimit': 123,
'SnapshotWindow': 'string',
'ClusterEnabled': True|False,
'CacheNodeType': 'string'
}
}
:returns:
Redis versions earlier than 2.8.6.
Redis (cluster mode disabled):T1 and T2 cache node types. Redis (cluster mode enabled): T1 node types.
"""
pass | Creates a Redis (cluster mode disabled) or a Redis (cluster mode enabled) replication group.
A Redis (cluster mode disabled) replication group is a collection of cache clusters, where one of the cache clusters is a read/write primary and the others are read-only replicas. Writes to the primary are asynchronously propagated to the replicas.
A Redis (cluster mode enabled) replication group is a collection of 1 to 15 node groups (shards). Each node group (shard) has one read/write primary node and up to 5 read-only replica nodes. Writes to the primary are asynchronously propagated to the replicas. Redis (cluster mode enabled) replication groups partition the data across node groups (shards).
When a Redis (cluster mode disabled) replication group has been successfully created, you can add one or more read replicas to it, up to a total of 5 read replicas. You cannot alter a Redis (cluster mode enabled) replication group after it has been created. However, if you need to increase or decrease the number of node groups (console: shards), you can avail yourself of ElastiCache for Redis' enhanced backup and restore. For more information, see Restoring From a Backup with Cluster Resizing in the ElastiCache User Guide .
See also: AWS API Documentation
:example: response = client.create_replication_group(
ReplicationGroupId='string',
ReplicationGroupDescription='string',
PrimaryClusterId='string',
AutomaticFailoverEnabled=True|False,
NumCacheClusters=123,
PreferredCacheClusterAZs=[
'string',
],
NumNodeGroups=123,
ReplicasPerNodeGroup=123,
NodeGroupConfiguration=[
{
'Slots': 'string',
'ReplicaCount': 123,
'PrimaryAvailabilityZone': 'string',
'ReplicaAvailabilityZones': [
'string',
]
},
],
CacheNodeType='string',
Engine='string',
EngineVersion='string',
CacheParameterGroupName='string',
CacheSubnetGroupName='string',
CacheSecurityGroupNames=[
'string',
],
SecurityGroupIds=[
'string',
],
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
SnapshotArns=[
'string',
],
SnapshotName='string',
PreferredMaintenanceWindow='string',
Port=123,
NotificationTopicArn='string',
AutoMinorVersionUpgrade=True|False,
SnapshotRetentionLimit=123,
SnapshotWindow='string',
AuthToken='string'
)
:type ReplicationGroupId: string
:param ReplicationGroupId: [REQUIRED]
The replication group identifier. This parameter is stored as a lowercase string.
Constraints:
A name must contain from 1 to 20 alphanumeric characters or hyphens.
The first character must be a letter.
A name cannot end with a hyphen or contain two consecutive hyphens.
:type ReplicationGroupDescription: string
:param ReplicationGroupDescription: [REQUIRED]
A user-created description for the replication group.
:type PrimaryClusterId: string
:param PrimaryClusterId: The identifier of the cache cluster that serves as the primary for this replication group. This cache cluster must already exist and have a status of available .
This parameter is not required if NumCacheClusters , NumNodeGroups , or ReplicasPerNodeGroup is specified.
:type AutomaticFailoverEnabled: boolean
:param AutomaticFailoverEnabled: Specifies whether a read-only replica is automatically promoted to read/write primary if the existing primary fails.
If true , Multi-AZ is enabled for this replication group. If false , Multi-AZ is disabled for this replication group.
AutomaticFailoverEnabled must be enabled for Redis (cluster mode enabled) replication groups.
Default: false
Note
ElastiCache Multi-AZ replication groups is not supported on:
Redis versions earlier than 2.8.6.
Redis (cluster mode disabled): T1 and T2 node types. Redis (cluster mode enabled): T2 node types.
:type NumCacheClusters: integer
:param NumCacheClusters: The number of clusters this replication group initially has.
This parameter is not used if there is more than one node group (shard). You should use ReplicasPerNodeGroup instead.
If AutomaticFailoverEnabled is true , the value of this parameter must be at least 2. If AutomaticFailoverEnabled is false you can omit this parameter (it will default to 1), or you can explicitly set it to a value between 2 and 6.
The maximum permitted value for NumCacheClusters is 6 (primary plus 5 replicas).
:type PreferredCacheClusterAZs: list
:param PreferredCacheClusterAZs: A list of EC2 Availability Zones in which the replication group's cache clusters are created. The order of the Availability Zones in the list is the order in which clusters are allocated. The primary cluster is created in the first AZ in the list.
This parameter is not used if there is more than one node group (shard). You should use NodeGroupConfiguration instead.
Note
If you are creating your replication group in an Amazon VPC (recommended), you can only locate cache clusters in Availability Zones associated with the subnets in the selected subnet group.
The number of Availability Zones listed must equal the value of NumCacheClusters .
Default: system chosen Availability Zones.
(string) --
:type NumNodeGroups: integer
:param NumNodeGroups: An optional parameter that specifies the number of node groups (shards) for this Redis (cluster mode enabled) replication group. For Redis (cluster mode disabled) either omit this parameter or set it to 1.
Default: 1
:type ReplicasPerNodeGroup: integer
:param ReplicasPerNodeGroup: An optional parameter that specifies the number of replica nodes in each node group (shard). Valid values are 0 to 5.
:type NodeGroupConfiguration: list
:param NodeGroupConfiguration: A list of node group (shard) configuration options. Each node group (shard) configuration has the following: Slots, PrimaryAvailabilityZone, ReplicaAvailabilityZones, ReplicaCount.
If you're creating a Redis (cluster mode disabled) or a Redis (cluster mode enabled) replication group, you can use this parameter to individually configure each node group (shard), or you can omit this parameter.
(dict) --node group (shard) configuration options. Each node group (shard) configuration has the following: Slots , PrimaryAvailabilityZone , ReplicaAvailabilityZones , ReplicaCount .
Slots (string) --A string that specifies the keyspace for a particular node group. Keyspaces range from 0 to 16,383. The string is in the format startkey-endkey .
Example: '0-3999'
ReplicaCount (integer) --The number of read replica nodes in this node group (shard).
PrimaryAvailabilityZone (string) --The Availability Zone where the primary node of this node group (shard) is launched.
ReplicaAvailabilityZones (list) --A list of Availability Zones to be used for the read replicas. The number of Availability Zones in this list must match the value of ReplicaCount or ReplicasPerNodeGroup if not specified.
(string) --
:type CacheNodeType: string
:param CacheNodeType: The compute and memory capacity of the nodes in the node group (shard).
Valid node types are as follows:
General purpose:
Current generation: cache.t2.micro , cache.t2.small , cache.t2.medium , cache.m3.medium , cache.m3.large , cache.m3.xlarge , cache.m3.2xlarge , cache.m4.large , cache.m4.xlarge , cache.m4.2xlarge , cache.m4.4xlarge , cache.m4.10xlarge
Previous generation: cache.t1.micro , cache.m1.small , cache.m1.medium , cache.m1.large , cache.m1.xlarge
Compute optimized: cache.c1.xlarge
Memory optimized:
Current generation: cache.r3.large , cache.r3.xlarge , cache.r3.2xlarge , cache.r3.4xlarge , cache.r3.8xlarge
Previous generation: cache.m2.xlarge , cache.m2.2xlarge , cache.m2.4xlarge
Notes:
All T2 instances are created in an Amazon Virtual Private Cloud (Amazon VPC).
Redis backup/restore is not supported for Redis (cluster mode disabled) T1 and T2 instances. Backup/restore is supported on Redis (cluster mode enabled) T2 instances.
Redis Append-only files (AOF) functionality is not supported for T1 or T2 instances.
For a complete listing of node types and specifications, see Amazon ElastiCache Product Features and Details and either Cache Node Type-Specific Parameters for Memcached or Cache Node Type-Specific Parameters for Redis .
:type Engine: string
:param Engine: The name of the cache engine to be used for the cache clusters in this replication group.
:type EngineVersion: string
:param EngineVersion: The version number of the cache engine to be used for the cache clusters in this replication group. To view the supported cache engine versions, use the DescribeCacheEngineVersions operation.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version ) in the ElastiCache User Guide , but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing cache cluster or replication group and create it anew with the earlier engine version.
:type CacheParameterGroupName: string
:param CacheParameterGroupName: The name of the parameter group to associate with this replication group. If this argument is omitted, the default cache parameter group for the specified engine is used.
If you are running Redis version 3.2.4 or later, only one node group (shard), and want to use a default parameter group, we recommend that you specify the parameter group by name.
To create a Redis (cluster mode disabled) replication group, use CacheParameterGroupName=default.redis3.2 .
To create a Redis (cluster mode enabled) replication group, use CacheParameterGroupName=default.redis3.2.cluster.on .
:type CacheSubnetGroupName: string
:param CacheSubnetGroupName: The name of the cache subnet group to be used for the replication group.
Warning
If you're going to launch your cluster in an Amazon VPC, you need to create a subnet group before you start creating a cluster. For more information, see Subnets and Subnet Groups .
:type CacheSecurityGroupNames: list
:param CacheSecurityGroupNames: A list of cache security group names to associate with this replication group.
(string) --
:type SecurityGroupIds: list
:param SecurityGroupIds: One or more Amazon VPC security groups associated with this replication group.
Use this parameter only when you are creating a replication group in an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type Tags: list
:param Tags: A list of cost allocation tags to be added to this resource. A tag is a key-value pair. A tag key must be accompanied by a tag value.
(dict) --A cost allocation Tag that can be added to an ElastiCache cluster or replication group. Tags are composed of a Key/Value pair. A tag with a null Value is permitted.
Key (string) --The key for the tag. May not be null.
Value (string) --The tag's value. May be null.
:type SnapshotArns: list
:param SnapshotArns: A list of Amazon Resource Names (ARN) that uniquely identify the Redis RDB snapshot files stored in Amazon S3. The snapshot files are used to populate the new replication group. The Amazon S3 object name in the ARN cannot contain any commas. The new replication group will have the number of node groups (console: shards) specified by the parameter NumNodeGroups or the number of node groups configured by NodeGroupConfiguration regardless of the number of ARNs specified here.
Note
This parameter is only valid if the Engine parameter is redis .
Example of an Amazon S3 ARN: arn:aws:s3:::my_bucket/snapshot1.rdb
(string) --
:type SnapshotName: string
:param SnapshotName: The name of a snapshot from which to restore data into the new replication group. The snapshot status changes to restoring while the new replication group is being created.
Note
This parameter is only valid if the Engine parameter is redis .
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: Specifies the weekly time range during which maintenance on the cache cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period. Valid values for ddd are:
Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for ddd are:
sun
mon
tue
wed
thu
fri
sat
Example: sun:23:00-mon:01:30
:type Port: integer
:param Port: The port number on which each member of the replication group accepts connections.
:type NotificationTopicArn: string
:param NotificationTopicArn: The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications are sent.
Note
The Amazon SNS topic owner must be the same as the cache cluster owner.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: This parameter is currently disabled.
:type SnapshotRetentionLimit: integer
:param SnapshotRetentionLimit: The number of days for which ElastiCache retains automatic snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.
Note
This parameter is only valid if the Engine parameter is redis .
Default: 0 (i.e., automatic backups are disabled for this cache cluster).
:type SnapshotWindow: string
:param SnapshotWindow: The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your node group (shard).
Example: 05:00-09:00
If you do not specify this parameter, ElastiCache automatically chooses an appropriate time range.
Note
This parameter is only valid if the Engine parameter is redis .
:type AuthToken: string
:param AuthToken:
Reserved parameter. The password used to access a password protected server.
Password constraints:
Must be only printable ASCII characters.
Must be at least 16 characters and no more than 128 characters in length.
Cannot contain any of the following characters: '/', ''', or '@'.
For more information, see AUTH password at Redis.
:rtype: dict
:return: {
'ReplicationGroup': {
'ReplicationGroupId': 'string',
'Description': 'string',
'Status': 'string',
'PendingModifiedValues': {
'PrimaryClusterId': 'string',
'AutomaticFailoverStatus': 'enabled'|'disabled'
},
'MemberClusters': [
'string',
],
'NodeGroups': [
{
'NodeGroupId': 'string',
'Status': 'string',
'PrimaryEndpoint': {
'Address': 'string',
'Port': 123
},
'Slots': 'string',
'NodeGroupMembers': [
{
'CacheClusterId': 'string',
'CacheNodeId': 'string',
'ReadEndpoint': {
'Address': 'string',
'Port': 123
},
'PreferredAvailabilityZone': 'string',
'CurrentRole': 'string'
},
]
},
],
'SnapshottingClusterId': 'string',
'AutomaticFailover': 'enabled'|'disabled'|'enabling'|'disabling',
'ConfigurationEndpoint': {
'Address': 'string',
'Port': 123
},
'SnapshotRetentionLimit': 123,
'SnapshotWindow': 'string',
'ClusterEnabled': True|False,
'CacheNodeType': 'string'
}
}
:returns:
Redis versions earlier than 2.8.6.
Redis (cluster mode disabled):T1 and T2 cache node types. Redis (cluster mode enabled): T1 node types. | entailment |
def modify_cache_cluster(CacheClusterId=None, NumCacheNodes=None, CacheNodeIdsToRemove=None, AZMode=None, NewAvailabilityZones=None, CacheSecurityGroupNames=None, SecurityGroupIds=None, PreferredMaintenanceWindow=None, NotificationTopicArn=None, CacheParameterGroupName=None, NotificationTopicStatus=None, ApplyImmediately=None, EngineVersion=None, AutoMinorVersionUpgrade=None, SnapshotRetentionLimit=None, SnapshotWindow=None, CacheNodeType=None):
"""
Modifies the settings for a cache cluster. You can use this operation to change one or more cluster configuration parameters by specifying the parameters and the new values.
See also: AWS API Documentation
:example: response = client.modify_cache_cluster(
CacheClusterId='string',
NumCacheNodes=123,
CacheNodeIdsToRemove=[
'string',
],
AZMode='single-az'|'cross-az',
NewAvailabilityZones=[
'string',
],
CacheSecurityGroupNames=[
'string',
],
SecurityGroupIds=[
'string',
],
PreferredMaintenanceWindow='string',
NotificationTopicArn='string',
CacheParameterGroupName='string',
NotificationTopicStatus='string',
ApplyImmediately=True|False,
EngineVersion='string',
AutoMinorVersionUpgrade=True|False,
SnapshotRetentionLimit=123,
SnapshotWindow='string',
CacheNodeType='string'
)
:type CacheClusterId: string
:param CacheClusterId: [REQUIRED]
The cache cluster identifier. This value is stored as a lowercase string.
:type NumCacheNodes: integer
:param NumCacheNodes: The number of cache nodes that the cache cluster should have. If the value for NumCacheNodes is greater than the sum of the number of current cache nodes and the number of cache nodes pending creation (which may be zero), more nodes are added. If the value is less than the number of existing cache nodes, nodes are removed. If the value is equal to the number of current cache nodes, any pending add or remove requests are canceled.
If you are removing cache nodes, you must use the CacheNodeIdsToRemove parameter to provide the IDs of the specific cache nodes to remove.
For clusters running Redis, this value must be 1. For clusters running Memcached, this value must be between 1 and 20.
Note
Adding or removing Memcached cache nodes can be applied immediately or as a pending operation (see ApplyImmediately ).
A pending operation to modify the number of cache nodes in a cluster during its maintenance window, whether by adding or removing nodes in accordance with the scale out architecture, is not queued. The customer's latest request to add or remove nodes to the cluster overrides any previous pending operations to modify the number of cache nodes in the cluster. For example, a request to remove 2 nodes would override a previous pending operation to remove 3 nodes. Similarly, a request to add 2 nodes would override a previous pending operation to remove 3 nodes and vice versa. As Memcached cache nodes may now be provisioned in different Availability Zones with flexible cache node placement, a request to add nodes does not automatically override a previous pending operation to add nodes. The customer can modify the previous pending operation to add more nodes or explicitly cancel the pending request and retry the new request. To cancel pending operations to modify the number of cache nodes in a cluster, use the ModifyCacheCluster request and set NumCacheNodes equal to the number of cache nodes currently in the cache cluster.
:type CacheNodeIdsToRemove: list
:param CacheNodeIdsToRemove: A list of cache node IDs to be removed. A node ID is a numeric identifier (0001, 0002, etc.). This parameter is only valid when NumCacheNodes is less than the existing number of cache nodes. The number of cache node IDs supplied in this parameter must match the difference between the existing number of cache nodes in the cluster or pending cache nodes, whichever is greater, and the value of NumCacheNodes in the request.
For example: If you have 3 active cache nodes, 7 pending cache nodes, and the number of cache nodes in this ModifyCacheCluser call is 5, you must list 2 (7 - 5) cache node IDs to remove.
(string) --
:type AZMode: string
:param AZMode: Specifies whether the new nodes in this Memcached cache cluster are all created in a single Availability Zone or created across multiple Availability Zones.
Valid values: single-az | cross-az .
This option is only supported for Memcached cache clusters.
Note
You cannot specify single-az if the Memcached cache cluster already has cache nodes in different Availability Zones. If cross-az is specified, existing Memcached nodes remain in their current Availability Zone.
Only newly created nodes are located in different Availability Zones. For instructions on how to move existing Memcached nodes to different Availability Zones, see the Availability Zone Considerations section of Cache Node Considerations for Memcached .
:type NewAvailabilityZones: list
:param NewAvailabilityZones: The list of Availability Zones where the new Memcached cache nodes are created.
This parameter is only valid when NumCacheNodes in the request is greater than the sum of the number of active cache nodes and the number of cache nodes pending creation (which may be zero). The number of Availability Zones supplied in this list must match the cache nodes being added in this request.
This option is only supported on Memcached clusters.
Scenarios:
Scenario 1: You have 3 active nodes and wish to add 2 nodes. Specify NumCacheNodes=5 (3 + 2) and optionally specify two Availability Zones for the two new nodes.
Scenario 2: You have 3 active nodes and 2 nodes pending creation (from the scenario 1 call) and want to add 1 more node. Specify NumCacheNodes=6 ((3 + 2) + 1) and optionally specify an Availability Zone for the new node.
Scenario 3: You want to cancel all pending operations. Specify NumCacheNodes=3 to cancel all pending operations.
The Availability Zone placement of nodes pending creation cannot be modified. If you wish to cancel any nodes pending creation, add 0 nodes by setting NumCacheNodes to the number of current nodes.
If cross-az is specified, existing Memcached nodes remain in their current Availability Zone. Only newly created nodes can be located in different Availability Zones. For guidance on how to move existing Memcached nodes to different Availability Zones, see the Availability Zone Considerations section of Cache Node Considerations for Memcached .
Impact of new add/remove requests upon pending requests
Scenario-1
Pending Action: Delete
New Request: Delete
Result: The new delete, pending or immediate, replaces the pending delete.
Scenario-2
Pending Action: Delete
New Request: Create
Result: The new create, pending or immediate, replaces the pending delete.
Scenario-3
Pending Action: Create
New Request: Delete
Result: The new delete, pending or immediate, replaces the pending create.
Scenario-4
Pending Action: Create
New Request: Create
Result: The new create is added to the pending create.
Warning
Important: If the new create request is Apply Immediately - Yes , all creates are performed immediately. If the new create request is Apply Immediately - No , all creates are pending.
(string) --
:type CacheSecurityGroupNames: list
:param CacheSecurityGroupNames: A list of cache security group names to authorize on this cache cluster. This change is asynchronously applied as soon as possible.
You can use this parameter only with clusters that are created outside of an Amazon Virtual Private Cloud (Amazon VPC).
Constraints: Must contain no more than 255 alphanumeric characters. Must not be 'Default'.
(string) --
:type SecurityGroupIds: list
:param SecurityGroupIds: Specifies the VPC Security Groups associated with the cache cluster.
This parameter can be used only with clusters that are created in an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for ddd are:
sun
mon
tue
wed
thu
fri
sat
Example: sun:23:00-mon:01:30
:type NotificationTopicArn: string
:param NotificationTopicArn: The Amazon Resource Name (ARN) of the Amazon SNS topic to which notifications are sent.
Note
The Amazon SNS topic owner must be same as the cache cluster owner.
:type CacheParameterGroupName: string
:param CacheParameterGroupName: The name of the cache parameter group to apply to this cache cluster. This change is asynchronously applied as soon as possible for parameters when the ApplyImmediately parameter is specified as true for this request.
:type NotificationTopicStatus: string
:param NotificationTopicStatus: The status of the Amazon SNS notification topic. Notifications are sent only if the status is active .
Valid values: active | inactive
:type ApplyImmediately: boolean
:param ApplyImmediately: If true , this parameter causes the modifications in this request and any pending modifications to be applied, asynchronously and as soon as possible, regardless of the PreferredMaintenanceWindow setting for the cache cluster.
If false , changes to the cache cluster are applied on the next maintenance reboot, or the next failure reboot, whichever occurs first.
Warning
If you perform a ModifyCacheCluster before a pending modification is applied, the pending modification is replaced by the newer modification.
Valid values: true | false
Default: false
:type EngineVersion: string
:param EngineVersion: The upgraded version of the cache engine to be run on the cache nodes.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version ), but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing cache cluster and create it anew with the earlier engine version.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: This parameter is currently disabled.
:type SnapshotRetentionLimit: integer
:param SnapshotRetentionLimit: The number of days for which ElastiCache retains automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.
Note
If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off.
:type SnapshotWindow: string
:param SnapshotWindow: The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your cache cluster.
:type CacheNodeType: string
:param CacheNodeType: A valid cache node type that you want to scale this cache cluster up to.
:rtype: dict
:return: {
'CacheCluster': {
'CacheClusterId': 'string',
'ConfigurationEndpoint': {
'Address': 'string',
'Port': 123
},
'ClientDownloadLandingPage': 'string',
'CacheNodeType': 'string',
'Engine': 'string',
'EngineVersion': 'string',
'CacheClusterStatus': 'string',
'NumCacheNodes': 123,
'PreferredAvailabilityZone': 'string',
'CacheClusterCreateTime': datetime(2015, 1, 1),
'PreferredMaintenanceWindow': 'string',
'PendingModifiedValues': {
'NumCacheNodes': 123,
'CacheNodeIdsToRemove': [
'string',
],
'EngineVersion': 'string',
'CacheNodeType': 'string'
},
'NotificationConfiguration': {
'TopicArn': 'string',
'TopicStatus': 'string'
},
'CacheSecurityGroups': [
{
'CacheSecurityGroupName': 'string',
'Status': 'string'
},
],
'CacheParameterGroup': {
'CacheParameterGroupName': 'string',
'ParameterApplyStatus': 'string',
'CacheNodeIdsToReboot': [
'string',
]
},
'CacheSubnetGroupName': 'string',
'CacheNodes': [
{
'CacheNodeId': 'string',
'CacheNodeStatus': 'string',
'CacheNodeCreateTime': datetime(2015, 1, 1),
'Endpoint': {
'Address': 'string',
'Port': 123
},
'ParameterGroupStatus': 'string',
'SourceCacheNodeId': 'string',
'CustomerAvailabilityZone': 'string'
},
],
'AutoMinorVersionUpgrade': True|False,
'SecurityGroups': [
{
'SecurityGroupId': 'string',
'Status': 'string'
},
],
'ReplicationGroupId': 'string',
'SnapshotRetentionLimit': 123,
'SnapshotWindow': 'string'
}
}
:returns:
General purpose:
Current generation: cache.t2.micro , cache.t2.small , cache.t2.medium , cache.m3.medium , cache.m3.large , cache.m3.xlarge , cache.m3.2xlarge , cache.m4.large , cache.m4.xlarge , cache.m4.2xlarge , cache.m4.4xlarge , cache.m4.10xlarge
Previous generation: cache.t1.micro , cache.m1.small , cache.m1.medium , cache.m1.large , cache.m1.xlarge
Compute optimized: cache.c1.xlarge
Memory optimized:
Current generation: cache.r3.large , cache.r3.xlarge , cache.r3.2xlarge , cache.r3.4xlarge , cache.r3.8xlarge
Previous generation: cache.m2.xlarge , cache.m2.2xlarge , cache.m2.4xlarge
"""
pass | Modifies the settings for a cache cluster. You can use this operation to change one or more cluster configuration parameters by specifying the parameters and the new values.
See also: AWS API Documentation
:example: response = client.modify_cache_cluster(
CacheClusterId='string',
NumCacheNodes=123,
CacheNodeIdsToRemove=[
'string',
],
AZMode='single-az'|'cross-az',
NewAvailabilityZones=[
'string',
],
CacheSecurityGroupNames=[
'string',
],
SecurityGroupIds=[
'string',
],
PreferredMaintenanceWindow='string',
NotificationTopicArn='string',
CacheParameterGroupName='string',
NotificationTopicStatus='string',
ApplyImmediately=True|False,
EngineVersion='string',
AutoMinorVersionUpgrade=True|False,
SnapshotRetentionLimit=123,
SnapshotWindow='string',
CacheNodeType='string'
)
:type CacheClusterId: string
:param CacheClusterId: [REQUIRED]
The cache cluster identifier. This value is stored as a lowercase string.
:type NumCacheNodes: integer
:param NumCacheNodes: The number of cache nodes that the cache cluster should have. If the value for NumCacheNodes is greater than the sum of the number of current cache nodes and the number of cache nodes pending creation (which may be zero), more nodes are added. If the value is less than the number of existing cache nodes, nodes are removed. If the value is equal to the number of current cache nodes, any pending add or remove requests are canceled.
If you are removing cache nodes, you must use the CacheNodeIdsToRemove parameter to provide the IDs of the specific cache nodes to remove.
For clusters running Redis, this value must be 1. For clusters running Memcached, this value must be between 1 and 20.
Note
Adding or removing Memcached cache nodes can be applied immediately or as a pending operation (see ApplyImmediately ).
A pending operation to modify the number of cache nodes in a cluster during its maintenance window, whether by adding or removing nodes in accordance with the scale out architecture, is not queued. The customer's latest request to add or remove nodes to the cluster overrides any previous pending operations to modify the number of cache nodes in the cluster. For example, a request to remove 2 nodes would override a previous pending operation to remove 3 nodes. Similarly, a request to add 2 nodes would override a previous pending operation to remove 3 nodes and vice versa. As Memcached cache nodes may now be provisioned in different Availability Zones with flexible cache node placement, a request to add nodes does not automatically override a previous pending operation to add nodes. The customer can modify the previous pending operation to add more nodes or explicitly cancel the pending request and retry the new request. To cancel pending operations to modify the number of cache nodes in a cluster, use the ModifyCacheCluster request and set NumCacheNodes equal to the number of cache nodes currently in the cache cluster.
:type CacheNodeIdsToRemove: list
:param CacheNodeIdsToRemove: A list of cache node IDs to be removed. A node ID is a numeric identifier (0001, 0002, etc.). This parameter is only valid when NumCacheNodes is less than the existing number of cache nodes. The number of cache node IDs supplied in this parameter must match the difference between the existing number of cache nodes in the cluster or pending cache nodes, whichever is greater, and the value of NumCacheNodes in the request.
For example: If you have 3 active cache nodes, 7 pending cache nodes, and the number of cache nodes in this ModifyCacheCluser call is 5, you must list 2 (7 - 5) cache node IDs to remove.
(string) --
:type AZMode: string
:param AZMode: Specifies whether the new nodes in this Memcached cache cluster are all created in a single Availability Zone or created across multiple Availability Zones.
Valid values: single-az | cross-az .
This option is only supported for Memcached cache clusters.
Note
You cannot specify single-az if the Memcached cache cluster already has cache nodes in different Availability Zones. If cross-az is specified, existing Memcached nodes remain in their current Availability Zone.
Only newly created nodes are located in different Availability Zones. For instructions on how to move existing Memcached nodes to different Availability Zones, see the Availability Zone Considerations section of Cache Node Considerations for Memcached .
:type NewAvailabilityZones: list
:param NewAvailabilityZones: The list of Availability Zones where the new Memcached cache nodes are created.
This parameter is only valid when NumCacheNodes in the request is greater than the sum of the number of active cache nodes and the number of cache nodes pending creation (which may be zero). The number of Availability Zones supplied in this list must match the cache nodes being added in this request.
This option is only supported on Memcached clusters.
Scenarios:
Scenario 1: You have 3 active nodes and wish to add 2 nodes. Specify NumCacheNodes=5 (3 + 2) and optionally specify two Availability Zones for the two new nodes.
Scenario 2: You have 3 active nodes and 2 nodes pending creation (from the scenario 1 call) and want to add 1 more node. Specify NumCacheNodes=6 ((3 + 2) + 1) and optionally specify an Availability Zone for the new node.
Scenario 3: You want to cancel all pending operations. Specify NumCacheNodes=3 to cancel all pending operations.
The Availability Zone placement of nodes pending creation cannot be modified. If you wish to cancel any nodes pending creation, add 0 nodes by setting NumCacheNodes to the number of current nodes.
If cross-az is specified, existing Memcached nodes remain in their current Availability Zone. Only newly created nodes can be located in different Availability Zones. For guidance on how to move existing Memcached nodes to different Availability Zones, see the Availability Zone Considerations section of Cache Node Considerations for Memcached .
Impact of new add/remove requests upon pending requests
Scenario-1
Pending Action: Delete
New Request: Delete
Result: The new delete, pending or immediate, replaces the pending delete.
Scenario-2
Pending Action: Delete
New Request: Create
Result: The new create, pending or immediate, replaces the pending delete.
Scenario-3
Pending Action: Create
New Request: Delete
Result: The new delete, pending or immediate, replaces the pending create.
Scenario-4
Pending Action: Create
New Request: Create
Result: The new create is added to the pending create.
Warning
Important: If the new create request is Apply Immediately - Yes , all creates are performed immediately. If the new create request is Apply Immediately - No , all creates are pending.
(string) --
:type CacheSecurityGroupNames: list
:param CacheSecurityGroupNames: A list of cache security group names to authorize on this cache cluster. This change is asynchronously applied as soon as possible.
You can use this parameter only with clusters that are created outside of an Amazon Virtual Private Cloud (Amazon VPC).
Constraints: Must contain no more than 255 alphanumeric characters. Must not be 'Default'.
(string) --
:type SecurityGroupIds: list
:param SecurityGroupIds: Specifies the VPC Security Groups associated with the cache cluster.
This parameter can be used only with clusters that are created in an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for ddd are:
sun
mon
tue
wed
thu
fri
sat
Example: sun:23:00-mon:01:30
:type NotificationTopicArn: string
:param NotificationTopicArn: The Amazon Resource Name (ARN) of the Amazon SNS topic to which notifications are sent.
Note
The Amazon SNS topic owner must be same as the cache cluster owner.
:type CacheParameterGroupName: string
:param CacheParameterGroupName: The name of the cache parameter group to apply to this cache cluster. This change is asynchronously applied as soon as possible for parameters when the ApplyImmediately parameter is specified as true for this request.
:type NotificationTopicStatus: string
:param NotificationTopicStatus: The status of the Amazon SNS notification topic. Notifications are sent only if the status is active .
Valid values: active | inactive
:type ApplyImmediately: boolean
:param ApplyImmediately: If true , this parameter causes the modifications in this request and any pending modifications to be applied, asynchronously and as soon as possible, regardless of the PreferredMaintenanceWindow setting for the cache cluster.
If false , changes to the cache cluster are applied on the next maintenance reboot, or the next failure reboot, whichever occurs first.
Warning
If you perform a ModifyCacheCluster before a pending modification is applied, the pending modification is replaced by the newer modification.
Valid values: true | false
Default: false
:type EngineVersion: string
:param EngineVersion: The upgraded version of the cache engine to be run on the cache nodes.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version ), but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing cache cluster and create it anew with the earlier engine version.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: This parameter is currently disabled.
:type SnapshotRetentionLimit: integer
:param SnapshotRetentionLimit: The number of days for which ElastiCache retains automatic cache cluster snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.
Note
If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off.
:type SnapshotWindow: string
:param SnapshotWindow: The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of your cache cluster.
:type CacheNodeType: string
:param CacheNodeType: A valid cache node type that you want to scale this cache cluster up to.
:rtype: dict
:return: {
'CacheCluster': {
'CacheClusterId': 'string',
'ConfigurationEndpoint': {
'Address': 'string',
'Port': 123
},
'ClientDownloadLandingPage': 'string',
'CacheNodeType': 'string',
'Engine': 'string',
'EngineVersion': 'string',
'CacheClusterStatus': 'string',
'NumCacheNodes': 123,
'PreferredAvailabilityZone': 'string',
'CacheClusterCreateTime': datetime(2015, 1, 1),
'PreferredMaintenanceWindow': 'string',
'PendingModifiedValues': {
'NumCacheNodes': 123,
'CacheNodeIdsToRemove': [
'string',
],
'EngineVersion': 'string',
'CacheNodeType': 'string'
},
'NotificationConfiguration': {
'TopicArn': 'string',
'TopicStatus': 'string'
},
'CacheSecurityGroups': [
{
'CacheSecurityGroupName': 'string',
'Status': 'string'
},
],
'CacheParameterGroup': {
'CacheParameterGroupName': 'string',
'ParameterApplyStatus': 'string',
'CacheNodeIdsToReboot': [
'string',
]
},
'CacheSubnetGroupName': 'string',
'CacheNodes': [
{
'CacheNodeId': 'string',
'CacheNodeStatus': 'string',
'CacheNodeCreateTime': datetime(2015, 1, 1),
'Endpoint': {
'Address': 'string',
'Port': 123
},
'ParameterGroupStatus': 'string',
'SourceCacheNodeId': 'string',
'CustomerAvailabilityZone': 'string'
},
],
'AutoMinorVersionUpgrade': True|False,
'SecurityGroups': [
{
'SecurityGroupId': 'string',
'Status': 'string'
},
],
'ReplicationGroupId': 'string',
'SnapshotRetentionLimit': 123,
'SnapshotWindow': 'string'
}
}
:returns:
General purpose:
Current generation: cache.t2.micro , cache.t2.small , cache.t2.medium , cache.m3.medium , cache.m3.large , cache.m3.xlarge , cache.m3.2xlarge , cache.m4.large , cache.m4.xlarge , cache.m4.2xlarge , cache.m4.4xlarge , cache.m4.10xlarge
Previous generation: cache.t1.micro , cache.m1.small , cache.m1.medium , cache.m1.large , cache.m1.xlarge
Compute optimized: cache.c1.xlarge
Memory optimized:
Current generation: cache.r3.large , cache.r3.xlarge , cache.r3.2xlarge , cache.r3.4xlarge , cache.r3.8xlarge
Previous generation: cache.m2.xlarge , cache.m2.2xlarge , cache.m2.4xlarge | entailment |
def modify_replication_group(ReplicationGroupId=None, ReplicationGroupDescription=None, PrimaryClusterId=None, SnapshottingClusterId=None, AutomaticFailoverEnabled=None, CacheSecurityGroupNames=None, SecurityGroupIds=None, PreferredMaintenanceWindow=None, NotificationTopicArn=None, CacheParameterGroupName=None, NotificationTopicStatus=None, ApplyImmediately=None, EngineVersion=None, AutoMinorVersionUpgrade=None, SnapshotRetentionLimit=None, SnapshotWindow=None, CacheNodeType=None, NodeGroupId=None):
"""
Modifies the settings for a replication group.
See also: AWS API Documentation
:example: response = client.modify_replication_group(
ReplicationGroupId='string',
ReplicationGroupDescription='string',
PrimaryClusterId='string',
SnapshottingClusterId='string',
AutomaticFailoverEnabled=True|False,
CacheSecurityGroupNames=[
'string',
],
SecurityGroupIds=[
'string',
],
PreferredMaintenanceWindow='string',
NotificationTopicArn='string',
CacheParameterGroupName='string',
NotificationTopicStatus='string',
ApplyImmediately=True|False,
EngineVersion='string',
AutoMinorVersionUpgrade=True|False,
SnapshotRetentionLimit=123,
SnapshotWindow='string',
CacheNodeType='string',
NodeGroupId='string'
)
:type ReplicationGroupId: string
:param ReplicationGroupId: [REQUIRED]
The identifier of the replication group to modify.
:type ReplicationGroupDescription: string
:param ReplicationGroupDescription: A description for the replication group. Maximum length is 255 characters.
:type PrimaryClusterId: string
:param PrimaryClusterId: For replication groups with a single primary, if this parameter is specified, ElastiCache promotes the specified cluster in the specified replication group to the primary role. The nodes of all other clusters in the replication group are read replicas.
:type SnapshottingClusterId: string
:param SnapshottingClusterId: The cache cluster ID that is used as the daily snapshot source for the replication group. This parameter cannot be set for Redis (cluster mode enabled) replication groups.
:type AutomaticFailoverEnabled: boolean
:param AutomaticFailoverEnabled: Determines whether a read replica is automatically promoted to read/write primary if the existing primary encounters a failure.
Valid values: true | false
Note
ElastiCache Multi-AZ replication groups are not supported on:
Redis versions earlier than 2.8.6.
Redis (cluster mode disabled):T1 and T2 cache node types. Redis (cluster mode enabled): T1 node types.
:type CacheSecurityGroupNames: list
:param CacheSecurityGroupNames: A list of cache security group names to authorize for the clusters in this replication group. This change is asynchronously applied as soon as possible.
This parameter can be used only with replication group containing cache clusters running outside of an Amazon Virtual Private Cloud (Amazon VPC).
Constraints: Must contain no more than 255 alphanumeric characters. Must not be Default .
(string) --
:type SecurityGroupIds: list
:param SecurityGroupIds: Specifies the VPC Security Groups associated with the cache clusters in the replication group.
This parameter can be used only with replication group containing cache clusters running in an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for ddd are:
sun
mon
tue
wed
thu
fri
sat
Example: sun:23:00-mon:01:30
:type NotificationTopicArn: string
:param NotificationTopicArn: The Amazon Resource Name (ARN) of the Amazon SNS topic to which notifications are sent.
Note
The Amazon SNS topic owner must be same as the replication group owner.
:type CacheParameterGroupName: string
:param CacheParameterGroupName: The name of the cache parameter group to apply to all of the clusters in this replication group. This change is asynchronously applied as soon as possible for parameters when the ApplyImmediately parameter is specified as true for this request.
:type NotificationTopicStatus: string
:param NotificationTopicStatus: The status of the Amazon SNS notification topic for the replication group. Notifications are sent only if the status is active .
Valid values: active | inactive
:type ApplyImmediately: boolean
:param ApplyImmediately: If true , this parameter causes the modifications in this request and any pending modifications to be applied, asynchronously and as soon as possible, regardless of the PreferredMaintenanceWindow setting for the replication group.
If false , changes to the nodes in the replication group are applied on the next maintenance reboot, or the next failure reboot, whichever occurs first.
Valid values: true | false
Default: false
:type EngineVersion: string
:param EngineVersion: The upgraded version of the cache engine to be run on the cache clusters in the replication group.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version ), but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing replication group and create it anew with the earlier engine version.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: This parameter is currently disabled.
:type SnapshotRetentionLimit: integer
:param SnapshotRetentionLimit: The number of days for which ElastiCache retains automatic node group (shard) snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.
Important If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off.
:type SnapshotWindow: string
:param SnapshotWindow: The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of the node group (shard) specified by SnapshottingClusterId .
Example: 05:00-09:00
If you do not specify this parameter, ElastiCache automatically chooses an appropriate time range.
:type CacheNodeType: string
:param CacheNodeType: A valid cache node type that you want to scale this replication group to.
:type NodeGroupId: string
:param NodeGroupId: The name of the Node Group (called shard in the console).
:rtype: dict
:return: {
'ReplicationGroup': {
'ReplicationGroupId': 'string',
'Description': 'string',
'Status': 'string',
'PendingModifiedValues': {
'PrimaryClusterId': 'string',
'AutomaticFailoverStatus': 'enabled'|'disabled'
},
'MemberClusters': [
'string',
],
'NodeGroups': [
{
'NodeGroupId': 'string',
'Status': 'string',
'PrimaryEndpoint': {
'Address': 'string',
'Port': 123
},
'Slots': 'string',
'NodeGroupMembers': [
{
'CacheClusterId': 'string',
'CacheNodeId': 'string',
'ReadEndpoint': {
'Address': 'string',
'Port': 123
},
'PreferredAvailabilityZone': 'string',
'CurrentRole': 'string'
},
]
},
],
'SnapshottingClusterId': 'string',
'AutomaticFailover': 'enabled'|'disabled'|'enabling'|'disabling',
'ConfigurationEndpoint': {
'Address': 'string',
'Port': 123
},
'SnapshotRetentionLimit': 123,
'SnapshotWindow': 'string',
'ClusterEnabled': True|False,
'CacheNodeType': 'string'
}
}
:returns:
Redis versions earlier than 2.8.6.
Redis (cluster mode disabled):T1 and T2 cache node types. Redis (cluster mode enabled): T1 node types.
"""
pass | Modifies the settings for a replication group.
See also: AWS API Documentation
:example: response = client.modify_replication_group(
ReplicationGroupId='string',
ReplicationGroupDescription='string',
PrimaryClusterId='string',
SnapshottingClusterId='string',
AutomaticFailoverEnabled=True|False,
CacheSecurityGroupNames=[
'string',
],
SecurityGroupIds=[
'string',
],
PreferredMaintenanceWindow='string',
NotificationTopicArn='string',
CacheParameterGroupName='string',
NotificationTopicStatus='string',
ApplyImmediately=True|False,
EngineVersion='string',
AutoMinorVersionUpgrade=True|False,
SnapshotRetentionLimit=123,
SnapshotWindow='string',
CacheNodeType='string',
NodeGroupId='string'
)
:type ReplicationGroupId: string
:param ReplicationGroupId: [REQUIRED]
The identifier of the replication group to modify.
:type ReplicationGroupDescription: string
:param ReplicationGroupDescription: A description for the replication group. Maximum length is 255 characters.
:type PrimaryClusterId: string
:param PrimaryClusterId: For replication groups with a single primary, if this parameter is specified, ElastiCache promotes the specified cluster in the specified replication group to the primary role. The nodes of all other clusters in the replication group are read replicas.
:type SnapshottingClusterId: string
:param SnapshottingClusterId: The cache cluster ID that is used as the daily snapshot source for the replication group. This parameter cannot be set for Redis (cluster mode enabled) replication groups.
:type AutomaticFailoverEnabled: boolean
:param AutomaticFailoverEnabled: Determines whether a read replica is automatically promoted to read/write primary if the existing primary encounters a failure.
Valid values: true | false
Note
ElastiCache Multi-AZ replication groups are not supported on:
Redis versions earlier than 2.8.6.
Redis (cluster mode disabled):T1 and T2 cache node types. Redis (cluster mode enabled): T1 node types.
:type CacheSecurityGroupNames: list
:param CacheSecurityGroupNames: A list of cache security group names to authorize for the clusters in this replication group. This change is asynchronously applied as soon as possible.
This parameter can be used only with replication group containing cache clusters running outside of an Amazon Virtual Private Cloud (Amazon VPC).
Constraints: Must contain no more than 255 alphanumeric characters. Must not be Default .
(string) --
:type SecurityGroupIds: list
:param SecurityGroupIds: Specifies the VPC Security Groups associated with the cache clusters in the replication group.
This parameter can be used only with replication group containing cache clusters running in an Amazon Virtual Private Cloud (Amazon VPC).
(string) --
:type PreferredMaintenanceWindow: string
:param PreferredMaintenanceWindow: Specifies the weekly time range during which maintenance on the cluster is performed. It is specified as a range in the format ddd:hh24:mi-ddd:hh24:mi (24H Clock UTC). The minimum maintenance window is a 60 minute period.
Valid values for ddd are:
sun
mon
tue
wed
thu
fri
sat
Example: sun:23:00-mon:01:30
:type NotificationTopicArn: string
:param NotificationTopicArn: The Amazon Resource Name (ARN) of the Amazon SNS topic to which notifications are sent.
Note
The Amazon SNS topic owner must be same as the replication group owner.
:type CacheParameterGroupName: string
:param CacheParameterGroupName: The name of the cache parameter group to apply to all of the clusters in this replication group. This change is asynchronously applied as soon as possible for parameters when the ApplyImmediately parameter is specified as true for this request.
:type NotificationTopicStatus: string
:param NotificationTopicStatus: The status of the Amazon SNS notification topic for the replication group. Notifications are sent only if the status is active .
Valid values: active | inactive
:type ApplyImmediately: boolean
:param ApplyImmediately: If true , this parameter causes the modifications in this request and any pending modifications to be applied, asynchronously and as soon as possible, regardless of the PreferredMaintenanceWindow setting for the replication group.
If false , changes to the nodes in the replication group are applied on the next maintenance reboot, or the next failure reboot, whichever occurs first.
Valid values: true | false
Default: false
:type EngineVersion: string
:param EngineVersion: The upgraded version of the cache engine to be run on the cache clusters in the replication group.
Important: You can upgrade to a newer engine version (see Selecting a Cache Engine and Version ), but you cannot downgrade to an earlier engine version. If you want to use an earlier engine version, you must delete the existing replication group and create it anew with the earlier engine version.
:type AutoMinorVersionUpgrade: boolean
:param AutoMinorVersionUpgrade: This parameter is currently disabled.
:type SnapshotRetentionLimit: integer
:param SnapshotRetentionLimit: The number of days for which ElastiCache retains automatic node group (shard) snapshots before deleting them. For example, if you set SnapshotRetentionLimit to 5, a snapshot that was taken today is retained for 5 days before being deleted.
Important If the value of SnapshotRetentionLimit is set to zero (0), backups are turned off.
:type SnapshotWindow: string
:param SnapshotWindow: The daily time range (in UTC) during which ElastiCache begins taking a daily snapshot of the node group (shard) specified by SnapshottingClusterId .
Example: 05:00-09:00
If you do not specify this parameter, ElastiCache automatically chooses an appropriate time range.
:type CacheNodeType: string
:param CacheNodeType: A valid cache node type that you want to scale this replication group to.
:type NodeGroupId: string
:param NodeGroupId: The name of the Node Group (called shard in the console).
:rtype: dict
:return: {
'ReplicationGroup': {
'ReplicationGroupId': 'string',
'Description': 'string',
'Status': 'string',
'PendingModifiedValues': {
'PrimaryClusterId': 'string',
'AutomaticFailoverStatus': 'enabled'|'disabled'
},
'MemberClusters': [
'string',
],
'NodeGroups': [
{
'NodeGroupId': 'string',
'Status': 'string',
'PrimaryEndpoint': {
'Address': 'string',
'Port': 123
},
'Slots': 'string',
'NodeGroupMembers': [
{
'CacheClusterId': 'string',
'CacheNodeId': 'string',
'ReadEndpoint': {
'Address': 'string',
'Port': 123
},
'PreferredAvailabilityZone': 'string',
'CurrentRole': 'string'
},
]
},
],
'SnapshottingClusterId': 'string',
'AutomaticFailover': 'enabled'|'disabled'|'enabling'|'disabling',
'ConfigurationEndpoint': {
'Address': 'string',
'Port': 123
},
'SnapshotRetentionLimit': 123,
'SnapshotWindow': 'string',
'ClusterEnabled': True|False,
'CacheNodeType': 'string'
}
}
:returns:
Redis versions earlier than 2.8.6.
Redis (cluster mode disabled):T1 and T2 cache node types. Redis (cluster mode enabled): T1 node types. | entailment |
def run_job_flow(Name=None, LogUri=None, AdditionalInfo=None, AmiVersion=None, ReleaseLabel=None, Instances=None, Steps=None, BootstrapActions=None, SupportedProducts=None, NewSupportedProducts=None, Applications=None, Configurations=None, VisibleToAllUsers=None, JobFlowRole=None, ServiceRole=None, Tags=None, SecurityConfiguration=None, AutoScalingRole=None, ScaleDownBehavior=None):
"""
RunJobFlow creates and starts running a new cluster (job flow). The cluster runs the steps specified. After the steps complete, the cluster stops and the HDFS partition is lost. To prevent loss of data, configure the last step of the job flow to store results in Amazon S3. If the JobFlowInstancesConfig KeepJobFlowAliveWhenNoSteps parameter is set to TRUE , the cluster transitions to the WAITING state rather than shutting down after the steps have completed.
For additional protection, you can set the JobFlowInstancesConfig TerminationProtected parameter to TRUE to lock the cluster and prevent it from being terminated by API call, user intervention, or in the event of a job flow error.
A maximum of 256 steps are allowed in each job flow.
If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps to process your data. You can bypass the 256-step limitation in various ways, including using the SSH shell to connect to the master node and submitting queries directly to the software running on the master node, such as Hive and Hadoop. For more information on how to do this, see Add More than 256 Steps to a Cluster in the Amazon EMR Management Guide .
For long running clusters, we recommend that you periodically store your results.
See also: AWS API Documentation
:example: response = client.run_job_flow(
Name='string',
LogUri='string',
AdditionalInfo='string',
AmiVersion='string',
ReleaseLabel='string',
Instances={
'MasterInstanceType': 'string',
'SlaveInstanceType': 'string',
'InstanceCount': 123,
'InstanceGroups': [
{
'Name': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceRole': 'MASTER'|'CORE'|'TASK',
'BidPrice': 'string',
'InstanceType': 'string',
'InstanceCount': 123,
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
],
'EbsConfiguration': {
'EbsBlockDeviceConfigs': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'VolumesPerInstance': 123
},
],
'EbsOptimized': True|False
},
'AutoScalingPolicy': {
'Constraints': {
'MinCapacity': 123,
'MaxCapacity': 123
},
'Rules': [
{
'Name': 'string',
'Description': 'string',
'Action': {
'Market': 'ON_DEMAND'|'SPOT',
'SimpleScalingPolicyConfiguration': {
'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
'ScalingAdjustment': 123,
'CoolDown': 123
}
},
'Trigger': {
'CloudWatchAlarmDefinition': {
'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
'EvaluationPeriods': 123,
'MetricName': 'string',
'Namespace': 'string',
'Period': 123,
'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
'Threshold': 123.0,
'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
'Dimensions': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
},
]
}
},
],
'InstanceFleets': [
{
'Name': 'string',
'InstanceFleetType': 'MASTER'|'CORE'|'TASK',
'TargetOnDemandCapacity': 123,
'TargetSpotCapacity': 123,
'InstanceTypeConfigs': [
{
'InstanceType': 'string',
'WeightedCapacity': 123,
'BidPrice': 'string',
'BidPriceAsPercentageOfOnDemandPrice': 123.0,
'EbsConfiguration': {
'EbsBlockDeviceConfigs': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'VolumesPerInstance': 123
},
],
'EbsOptimized': True|False
},
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
},
],
'LaunchSpecifications': {
'SpotSpecification': {
'TimeoutDurationMinutes': 123,
'TimeoutAction': 'SWITCH_TO_ON_DEMAND'|'TERMINATE_CLUSTER',
'BlockDurationMinutes': 123
}
}
},
],
'Ec2KeyName': 'string',
'Placement': {
'AvailabilityZone': 'string',
'AvailabilityZones': [
'string',
]
},
'KeepJobFlowAliveWhenNoSteps': True|False,
'TerminationProtected': True|False,
'HadoopVersion': 'string',
'Ec2SubnetId': 'string',
'Ec2SubnetIds': [
'string',
],
'EmrManagedMasterSecurityGroup': 'string',
'EmrManagedSlaveSecurityGroup': 'string',
'ServiceAccessSecurityGroup': 'string',
'AdditionalMasterSecurityGroups': [
'string',
],
'AdditionalSlaveSecurityGroups': [
'string',
]
},
Steps=[
{
'Name': 'string',
'ActionOnFailure': 'TERMINATE_JOB_FLOW'|'TERMINATE_CLUSTER'|'CANCEL_AND_WAIT'|'CONTINUE',
'HadoopJarStep': {
'Properties': [
{
'Key': 'string',
'Value': 'string'
},
],
'Jar': 'string',
'MainClass': 'string',
'Args': [
'string',
]
}
},
],
BootstrapActions=[
{
'Name': 'string',
'ScriptBootstrapAction': {
'Path': 'string',
'Args': [
'string',
]
}
},
],
SupportedProducts=[
'string',
],
NewSupportedProducts=[
{
'Name': 'string',
'Args': [
'string',
]
},
],
Applications=[
{
'Name': 'string',
'Version': 'string',
'Args': [
'string',
],
'AdditionalInfo': {
'string': 'string'
}
},
],
Configurations=[
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
],
VisibleToAllUsers=True|False,
JobFlowRole='string',
ServiceRole='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
SecurityConfiguration='string',
AutoScalingRole='string',
ScaleDownBehavior='TERMINATE_AT_INSTANCE_HOUR'|'TERMINATE_AT_TASK_COMPLETION'
)
:type Name: string
:param Name: [REQUIRED]
The name of the job flow.
:type LogUri: string
:param LogUri: The location in Amazon S3 to write the log files of the job flow. If a value is not provided, logs are not created.
:type AdditionalInfo: string
:param AdditionalInfo: A JSON string for selecting additional features.
:type AmiVersion: string
:param AmiVersion:
Note
For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and greater, use ReleaseLabel.
The version of the Amazon Machine Image (AMI) to use when launching Amazon EC2 instances in the job flow. The following values are valid:
The version number of the AMI to use, for example, '2.0.'
If the AMI supports multiple versions of Hadoop (for example, AMI 1.0 supports both Hadoop 0.18 and 0.20) you can use the JobFlowInstancesConfig HadoopVersion parameter to modify the version of Hadoop from the defaults shown above.
For details about the AMI versions currently supported by Amazon Elastic MapReduce, see AMI Versions Supported in Elastic MapReduce in the Amazon Elastic MapReduce Developer Guide.
Note
Previously, the EMR AMI version API parameter options allowed you to use latest for the latest AMI version rather than specify a numerical value. Some regions no longer support this deprecated option as they only have a newer release label version of EMR, which requires you to specify an EMR release label release (EMR 4.x or later).
:type ReleaseLabel: string
:param ReleaseLabel:
Note
Amazon EMR releases 4.x or later.
The release label for the Amazon EMR release. For Amazon EMR 3.x and 2.x AMIs, use amiVersion instead instead of ReleaseLabel.
:type Instances: dict
:param Instances: [REQUIRED]
A specification of the number and type of Amazon EC2 instances.
MasterInstanceType (string) --The EC2 instance type of the master node.
SlaveInstanceType (string) --The EC2 instance type of the slave nodes.
InstanceCount (integer) --The number of EC2 instances in the cluster.
InstanceGroups (list) --Configuration for the instance groups in a cluster.
(dict) --Configuration defining a new instance group.
Name (string) --Friendly name given to the instance group.
Market (string) --Market type of the EC2 instances used to create a cluster node.
InstanceRole (string) -- [REQUIRED]The role of the instance group in the cluster.
BidPrice (string) --Bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
InstanceType (string) -- [REQUIRED]The EC2 instance type for all instances in the instance group.
InstanceCount (integer) -- [REQUIRED]Target number of instances for the instance group.
Configurations (list) --
Note
Amazon EMR releases 4.x or later.
The list of configurations supplied for an EMR cluster instance group. You can specify a separate configuration for each instance group (master, core, and task).
(dict) --
Note
Amazon EMR releases 4.x or later.
An optional configuration specification to be used when provisioning cluster instances, which can include configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification, properties, and optional nested configurations. A classification refers to an application-specific configuration file. Properties are the settings you want to change in that file. For more information, see Configuring Applications .
Classification (string) --The classification within a configuration.
Configurations (list) --A list of additional configurations to apply within a configuration object.
Properties (dict) --A set of properties specified within a configuration classification.
(string) --
(string) --
EbsConfiguration (dict) --EBS configurations that will be attached to each EC2 instance in the instance group.
EbsBlockDeviceConfigs (list) --An array of Amazon EBS volume specifications attached to a cluster instance.
(dict) --Configuration of requested EBS block device associated with the instance group with count of volumes that will be associated to every instance.
VolumeSpecification (dict) -- [REQUIRED]EBS volume specifications such as volume type, IOPS, and size (GiB) that will be requested for the EBS volume attached to an EC2 instance in the cluster.
VolumeType (string) -- [REQUIRED]The volume type. Volume types supported are gp2, io1, standard.
Iops (integer) --The number of I/O operations per second (IOPS) that the volume supports.
SizeInGB (integer) -- [REQUIRED]The volume size, in gibibytes (GiB). This can be a number from 1 - 1024. If the volume type is EBS-optimized, the minimum value is 10.
VolumesPerInstance (integer) --Number of EBS volumes with a specific volume configuration that will be associated with every instance in the instance group
EbsOptimized (boolean) --Indicates whether an Amazon EBS volume is EBS-optimized.
AutoScalingPolicy (dict) --An automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster. The automatic scaling policy defines how an instance group dynamically adds and terminates EC2 instances in response to the value of a CloudWatch metric. See PutAutoScalingPolicy .
Constraints (dict) -- [REQUIRED]The upper and lower EC2 instance limits for an automatic scaling policy. Automatic scaling activity will not cause an instance group to grow above or below these limits.
MinCapacity (integer) -- [REQUIRED]The lower boundary of EC2 instances in an instance group below which scaling activities are not allowed to shrink. Scale-in activities will not terminate instances below this boundary.
MaxCapacity (integer) -- [REQUIRED]The upper boundary of EC2 instances in an instance group beyond which scaling activities are not allowed to grow. Scale-out activities will not add instances beyond this boundary.
Rules (list) -- [REQUIRED]The scale-in and scale-out rules that comprise the automatic scaling policy.
(dict) --A scale-in or scale-out rule that defines scaling activity, including the CloudWatch metric alarm that triggers activity, how EC2 instances are added or removed, and the periodicity of adjustments. The automatic scaling policy for an instance group can comprise one or more automatic scaling rules.
Name (string) -- [REQUIRED]The name used to identify an automatic scaling rule. Rule names must be unique within a scaling policy.
Description (string) --A friendly, more verbose description of the automatic scaling rule.
Action (dict) -- [REQUIRED]The conditions that trigger an automatic scaling activity.
Market (string) --Not available for instance groups. Instance groups use the market type specified for the group.
SimpleScalingPolicyConfiguration (dict) -- [REQUIRED]The type of adjustment the automatic scaling activity makes when triggered, and the periodicity of the adjustment.
AdjustmentType (string) --The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or terminated (if ScalingAdjustment is a negative number) each time the scaling activity is triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that the EC2 instance count increments or decrements by ScalingAdjustment , which should be expressed as an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments or decrements by the percentage specified by ScalingAdjustment , which should be expressed as a decimal. For example, 0.20 indicates an increase in 20% increments of cluster capacity. EXACT_CAPACITY indicates the scaling activity results in an instance group with the number of EC2 instances specified by ScalingAdjustment , which should be expressed as a positive integer.
ScalingAdjustment (integer) -- [REQUIRED]The amount by which to scale in or scale out, based on the specified AdjustmentType . A positive value adds to the instance group's EC2 instance count while a negative number removes instances. If AdjustmentType is set to EXACT_CAPACITY , the number should only be a positive integer. If AdjustmentType is set to PERCENT_CHANGE_IN_CAPACITY , the value should express the percentage as a decimal. For example, -0.20 indicates a decrease in 20% increments of cluster capacity.
CoolDown (integer) --The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start. The default value is 0.
Trigger (dict) -- [REQUIRED]The CloudWatch alarm definition that determines when automatic scaling activity is triggered.
CloudWatchAlarmDefinition (dict) -- [REQUIRED]The definition of a CloudWatch metric alarm. When the defined alarm conditions are met along with other trigger parameters, scaling activity begins.
ComparisonOperator (string) -- [REQUIRED]Determines how the metric specified by MetricName is compared to the value specified by Threshold .
EvaluationPeriods (integer) --The number of periods, expressed in seconds using Period , during which the alarm condition must exist before the alarm triggers automatic scaling activity. The default value is 1 .
MetricName (string) -- [REQUIRED]The name of the CloudWatch metric that is watched to determine an alarm condition.
Namespace (string) --The namespace for the CloudWatch metric. The default is AWS/ElasticMapReduce .
Period (integer) -- [REQUIRED]The period, in seconds, over which the statistic is applied. EMR CloudWatch metrics are emitted every five minutes (300 seconds), so if an EMR CloudWatch metric is specified, specify 300 .
Statistic (string) --The statistic to apply to the metric associated with the alarm. The default is AVERAGE .
Threshold (float) -- [REQUIRED]The value against which the specified statistic is compared.
Unit (string) --The unit of measure associated with the CloudWatch metric being watched. The value specified for Unit must correspond to the units specified in the CloudWatch metric.
Dimensions (list) --A CloudWatch metric dimension.
(dict) --A CloudWatch dimension, which is specified using a Key (known as a Name in CloudWatch), Value pair. By default, Amazon EMR uses one dimension whose Key is JobFlowID and Value is a variable representing the cluster ID, which is ${emr.clusterId} . This enables the rule to bootstrap when the cluster ID becomes available.
Key (string) --The dimension name.
Value (string) --The dimension value.
InstanceFleets (list) --
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
Describes the EC2 instances and instance configurations for clusters that use the instance fleet configuration.
(dict) --The configuration that defines an instance fleet.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
Name (string) --The friendly name of the instance fleet.
InstanceFleetType (string) -- [REQUIRED]The node type that the instance fleet hosts. Valid values are MASTER,CORE,and TASK.
TargetOnDemandCapacity (integer) --The target capacity of On-Demand units for the instance fleet, which determines how many On-Demand instances to provision. When the instance fleet launches, Amazon EMR tries to provision On-Demand instances as specified by InstanceTypeConfig . Each instance configuration has a specified WeightedCapacity . When an On-Demand instance is provisioned, the WeightedCapacity units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a WeightedCapacity of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.
Note
If not specified or set to 0, only Spot instances are provisioned for the instance fleet using TargetSpotCapacity . At least one of TargetSpotCapacity and TargetOnDemandCapacity should be greater than 0. For a master instance fleet, only one of TargetSpotCapacity and TargetOnDemandCapacity can be specified, and its value must be 1.
TargetSpotCapacity (integer) --The target capacity of Spot units for the instance fleet, which determines how many Spot instances to provision. When the instance fleet launches, Amazon EMR tries to provision Spot instances as specified by InstanceTypeConfig . Each instance configuration has a specified WeightedCapacity . When a Spot instance is provisioned, the WeightedCapacity units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a WeightedCapacity of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.
Note
If not specified or set to 0, only On-Demand instances are provisioned for the instance fleet. At least one of TargetSpotCapacity and TargetOnDemandCapacity should be greater than 0. For a master instance fleet, only one of TargetSpotCapacity and TargetOnDemandCapacity can be specified, and its value must be 1.
InstanceTypeConfigs (list) --The instance type configurations that define the EC2 instances in the instance fleet.
(dict) --An instance type configuration for each instance type in an instance fleet, which determines the EC2 instances Amazon EMR attempts to provision to fulfill On-Demand and Spot target capacities. There can be a maximum of 5 instance type configurations in a fleet.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
InstanceType (string) -- [REQUIRED]An EC2 instance type, such as m3.xlarge .
WeightedCapacity (integer) --The number of units that a provisioned instance of this type provides toward fulfilling the target capacities defined in InstanceFleetConfig . This value is 1 for a master instance fleet, and must be greater than 0 for core and task instance fleets.
BidPrice (string) --The bid price for each EC2 Spot instance type as defined by InstanceType . Expressed in USD. If neither BidPrice nor BidPriceAsPercentageOfOnDemandPrice is provided, BidPriceAsPercentageOfOnDemandPrice defaults to 100%.
BidPriceAsPercentageOfOnDemandPrice (float) --The bid price, as a percentage of On-Demand price, for each EC2 Spot instance as defined by InstanceType . Expressed as a number between 0 and 1000 (for example, 20 specifies 20%). If neither BidPrice nor BidPriceAsPercentageOfOnDemandPrice is provided, BidPriceAsPercentageOfOnDemandPrice defaults to 100%.
EbsConfiguration (dict) --The configuration of Amazon Elastic Block Storage (EBS) attached to each instance as defined by InstanceType .
EbsBlockDeviceConfigs (list) --An array of Amazon EBS volume specifications attached to a cluster instance.
(dict) --Configuration of requested EBS block device associated with the instance group with count of volumes that will be associated to every instance.
VolumeSpecification (dict) -- [REQUIRED]EBS volume specifications such as volume type, IOPS, and size (GiB) that will be requested for the EBS volume attached to an EC2 instance in the cluster.
VolumeType (string) -- [REQUIRED]The volume type. Volume types supported are gp2, io1, standard.
Iops (integer) --The number of I/O operations per second (IOPS) that the volume supports.
SizeInGB (integer) -- [REQUIRED]The volume size, in gibibytes (GiB). This can be a number from 1 - 1024. If the volume type is EBS-optimized, the minimum value is 10.
VolumesPerInstance (integer) --Number of EBS volumes with a specific volume configuration that will be associated with every instance in the instance group
EbsOptimized (boolean) --Indicates whether an Amazon EBS volume is EBS-optimized.
Configurations (list) --A configuration classification that applies when provisioning cluster instances, which can include configurations for applications and software that run on the cluster.
(dict) --
Note
Amazon EMR releases 4.x or later.
An optional configuration specification to be used when provisioning cluster instances, which can include configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification, properties, and optional nested configurations. A classification refers to an application-specific configuration file. Properties are the settings you want to change in that file. For more information, see Configuring Applications .
Classification (string) --The classification within a configuration.
Configurations (list) --A list of additional configurations to apply within a configuration object.
Properties (dict) --A set of properties specified within a configuration classification.
(string) --
(string) --
LaunchSpecifications (dict) --The launch specification for the instance fleet.
SpotSpecification (dict) -- [REQUIRED]The launch specification for Spot instances in the fleet, which determines the defined duration and provisioning timeout behavior.
TimeoutDurationMinutes (integer) -- [REQUIRED]The spot provisioning timeout period in minutes. If Spot instances are not provisioned within this time period, the TimeOutAction is taken. Minimum value is 5 and maximum value is 1440. The timeout applies only during initial provisioning, when the cluster is first created.
TimeoutAction (string) -- [REQUIRED]The action to take when TargetSpotCapacity has not been fulfilled when the TimeoutDurationMinutes has expired. Spot instances are not uprovisioned within the Spot provisioining timeout. Valid values are TERMINATE_CLUSTER and SWITCH_TO_ON_DEMAND to fulfill the remaining capacity.
BlockDurationMinutes (integer) --The defined duration for Spot instances (also known as Spot blocks) in minutes. When specified, the Spot instance does not terminate before the defined duration expires, and defined duration pricing for Spot instances applies. Valid values are 60, 120, 180, 240, 300, or 360. The duration period starts as soon as a Spot instance receives its instance ID. At the end of the duration, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates.
Ec2KeyName (string) --The name of the EC2 key pair that can be used to ssh to the master node as the user called 'hadoop.'
Placement (dict) --The Availability Zone in which the cluster runs.
AvailabilityZone (string) --The Amazon EC2 Availability Zone for the cluster. AvailabilityZone is used for uniform instance groups, while AvailabilityZones (plural) is used for instance fleets.
AvailabilityZones (list) --When multiple Availability Zones are specified, Amazon EMR evaluates them and launches instances in the optimal Availability Zone. AvailabilityZones is used for instance fleets, while AvailabilityZone (singular) is used for uniform instance groups.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
(string) --
KeepJobFlowAliveWhenNoSteps (boolean) --Specifies whether the cluster should remain available after completing all steps.
TerminationProtected (boolean) --Specifies whether to lock the cluster to prevent the Amazon EC2 instances from being terminated by API call, user intervention, or in the event of a job-flow error.
HadoopVersion (string) --The Hadoop version for the cluster. Valid inputs are '0.18' (deprecated), '0.20' (deprecated), '0.20.205' (deprecated), '1.0.3', '2.2.0', or '2.4.0'. If you do not set this value, the default of 0.18 is used, unless the AmiVersion parameter is set in the RunJobFlow call, in which case the default version of Hadoop for that AMI version is used.
Ec2SubnetId (string) --Applies to clusters that use the uniform instance group configuration. To launch the cluster in Amazon Virtual Private Cloud (Amazon VPC), set this parameter to the identifier of the Amazon VPC subnet where you want the cluster to launch. If you do not specify this value, the cluster launches in the normal Amazon Web Services cloud, outside of an Amazon VPC, if the account launching the cluster supports EC2 Classic networks in the region where the cluster launches.
Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus you cannot specify the cc1.4xlarge instance type for clusters launched in an Amazon VPC.
Ec2SubnetIds (list) --Applies to clusters that use the instance fleet configuration. When multiple EC2 subnet IDs are specified, Amazon EMR evaluates them and launches instances in the optimal subnet.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
(string) --
EmrManagedMasterSecurityGroup (string) --The identifier of the Amazon EC2 security group for the master node.
EmrManagedSlaveSecurityGroup (string) --The identifier of the Amazon EC2 security group for the slave nodes.
ServiceAccessSecurityGroup (string) --The identifier of the Amazon EC2 security group for the Amazon EMR service to access clusters in VPC private subnets.
AdditionalMasterSecurityGroups (list) --A list of additional Amazon EC2 security group IDs for the master node.
(string) --
AdditionalSlaveSecurityGroups (list) --A list of additional Amazon EC2 security group IDs for the slave nodes.
(string) --
:type Steps: list
:param Steps: A list of steps to run.
(dict) --Specification of a cluster (job flow) step.
Name (string) -- [REQUIRED]The name of the step.
ActionOnFailure (string) --The action to take if the step fails.
HadoopJarStep (dict) -- [REQUIRED]The JAR file used for the step.
Properties (list) --A list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.
(dict) --A key value pair.
Key (string) --The unique identifier of a key value pair.
Value (string) --The value part of the identified key.
Jar (string) -- [REQUIRED]A path to a JAR file run during the step.
MainClass (string) --The name of the main class in the specified Java file. If not specified, the JAR file should specify a Main-Class in its manifest file.
Args (list) --A list of command line arguments passed to the JAR file's main function when executed.
(string) --
:type BootstrapActions: list
:param BootstrapActions: A list of bootstrap actions to run before Hadoop starts on the cluster nodes.
(dict) --Configuration of a bootstrap action.
Name (string) -- [REQUIRED]The name of the bootstrap action.
ScriptBootstrapAction (dict) -- [REQUIRED]The script run by the bootstrap action.
Path (string) -- [REQUIRED]Location of the script to run during a bootstrap action. Can be either a location in Amazon S3 or on a local file system.
Args (list) --A list of command line arguments to pass to the bootstrap action script.
(string) --
:type SupportedProducts: list
:param SupportedProducts:
Note
For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and greater, use Applications.
A list of strings that indicates third-party software to use. For more information, see Use Third Party Applications with Amazon EMR . Currently supported values are:
'mapr-m3' - launch the job flow using MapR M3 Edition.
'mapr-m5' - launch the job flow using MapR M5 Edition.
(string) --
:type NewSupportedProducts: list
:param NewSupportedProducts:
Note
For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and greater, use Applications.
A list of strings that indicates third-party software to use with the job flow that accepts a user argument list. EMR accepts and forwards the argument list to the corresponding installation script as bootstrap action arguments. For more information, see 'Launch a Job Flow on the MapR Distribution for Hadoop' in the Amazon EMR Developer Guide . Supported values are:
'mapr-m3' - launch the cluster using MapR M3 Edition.
'mapr-m5' - launch the cluster using MapR M5 Edition.
'mapr' with the user arguments specifying '--edition,m3' or '--edition,m5' - launch the job flow using MapR M3 or M5 Edition respectively.
'mapr-m7' - launch the cluster using MapR M7 Edition.
'hunk' - launch the cluster with the Hunk Big Data Analtics Platform.
'hue'- launch the cluster with Hue installed.
'spark' - launch the cluster with Apache Spark installed.
'ganglia' - launch the cluster with the Ganglia Monitoring System installed.
(dict) --The list of supported product configurations which allow user-supplied arguments. EMR accepts these arguments and forwards them to the corresponding installation script as bootstrap action arguments.
Name (string) --The name of the product configuration.
Args (list) --The list of user-supplied arguments.
(string) --
:type Applications: list
:param Applications:
Note
Amazon EMR releases 4.x or later.
A list of applications for the cluster. Valid values are: 'Hadoop', 'Hive', 'Mahout', 'Pig', and 'Spark.' They are case insensitive.
(dict) --An application is any Amazon or third-party software that you can add to the cluster. This structure contains a list of strings that indicates the software to use with the cluster and accepts a user argument list. Amazon EMR accepts and forwards the argument list to the corresponding installation script as bootstrap action argument. For more information, see Using the MapR Distribution for Hadoop . Currently supported values are:
'mapr-m3' - launch the cluster using MapR M3 Edition.
'mapr-m5' - launch the cluster using MapR M5 Edition.
'mapr' with the user arguments specifying '--edition,m3' or '--edition,m5' - launch the cluster using MapR M3 or M5 Edition, respectively.
Note
In Amazon EMR releases 4.0 and greater, the only accepted parameter is the application name. To pass arguments to applications, you supply a configuration for each application.
Name (string) --The name of the application.
Version (string) --The version of the application.
Args (list) --Arguments for Amazon EMR to pass to the application.
(string) --
AdditionalInfo (dict) --This option is for advanced users only. This is meta information about third-party applications that third-party vendors use for testing purposes.
(string) --
(string) --
:type Configurations: list
:param Configurations:
Note
Amazon EMR releases 4.x or later.
The list of configurations supplied for the EMR cluster you are creating.
(dict) --
Note
Amazon EMR releases 4.x or later.
An optional configuration specification to be used when provisioning cluster instances, which can include configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification, properties, and optional nested configurations. A classification refers to an application-specific configuration file. Properties are the settings you want to change in that file. For more information, see Configuring Applications .
Classification (string) --The classification within a configuration.
Configurations (list) --A list of additional configurations to apply within a configuration object.
Properties (dict) --A set of properties specified within a configuration classification.
(string) --
(string) --
:type VisibleToAllUsers: boolean
:param VisibleToAllUsers: Whether the cluster is visible to all IAM users of the AWS account associated with the cluster. If this value is set to true , all IAM users of that AWS account can view and (if they have the proper policy permissions set) manage the cluster. If it is set to false , only the IAM user that created the cluster can view and manage it.
:type JobFlowRole: string
:param JobFlowRole: Also called instance profile and EC2 role. An IAM role for an EMR cluster. The EC2 instances of the cluster assume this role. The default role is EMR_EC2_DefaultRole . In order to use the default role, you must have already created it using the CLI or console.
:type ServiceRole: string
:param ServiceRole: The IAM role that will be assumed by the Amazon EMR service to access AWS resources on your behalf.
:type Tags: list
:param Tags: A list of tags to associate with a cluster and propagate to Amazon EC2 instances.
(dict) --A key/value pair containing user-defined metadata that you can associate with an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For more information, see Tagging Amazon EMR Resources .
Key (string) --A user-defined key, which is the minimum required information for a valid tag. For more information, see Tagging Amazon EMR Resources .
Value (string) --A user-defined value, which is optional in a tag. For more information, see Tagging Amazon EMR Resources .
:type SecurityConfiguration: string
:param SecurityConfiguration: The name of a security configuration to apply to the cluster.
:type AutoScalingRole: string
:param AutoScalingRole: An IAM role for automatic scaling policies. The default role is EMR_AutoScaling_DefaultRole . The IAM role provides permissions that the automatic scaling feature requires to launch and terminate EC2 instances in an instance group.
:type ScaleDownBehavior: string
:param ScaleDownBehavior: Specifies the way that individual Amazon EC2 instances terminate when an automatic scale-in activity occurs or an instance group is resized. TERMINATE_AT_INSTANCE_HOUR indicates that Amazon EMR terminates nodes at the instance-hour boundary, regardless of when the request to terminate the instance was submitted. This option is only available with Amazon EMR 5.1.0 and later and is the default for clusters created using that version. TERMINATE_AT_TASK_COMPLETION indicates that Amazon EMR blacklists and drains tasks from nodes before terminating the Amazon EC2 instances, regardless of the instance-hour boundary. With either behavior, Amazon EMR removes the least active nodes first and blocks instance termination if it could lead to HDFS corruption. TERMINATE_AT_TASK_COMPLETION available only in Amazon EMR version 4.1.0 and later, and is the default for versions of Amazon EMR earlier than 5.1.0.
:rtype: dict
:return: {
'JobFlowId': 'string'
}
"""
pass | RunJobFlow creates and starts running a new cluster (job flow). The cluster runs the steps specified. After the steps complete, the cluster stops and the HDFS partition is lost. To prevent loss of data, configure the last step of the job flow to store results in Amazon S3. If the JobFlowInstancesConfig KeepJobFlowAliveWhenNoSteps parameter is set to TRUE , the cluster transitions to the WAITING state rather than shutting down after the steps have completed.
For additional protection, you can set the JobFlowInstancesConfig TerminationProtected parameter to TRUE to lock the cluster and prevent it from being terminated by API call, user intervention, or in the event of a job flow error.
A maximum of 256 steps are allowed in each job flow.
If your cluster is long-running (such as a Hive data warehouse) or complex, you may require more than 256 steps to process your data. You can bypass the 256-step limitation in various ways, including using the SSH shell to connect to the master node and submitting queries directly to the software running on the master node, such as Hive and Hadoop. For more information on how to do this, see Add More than 256 Steps to a Cluster in the Amazon EMR Management Guide .
For long running clusters, we recommend that you periodically store your results.
See also: AWS API Documentation
:example: response = client.run_job_flow(
Name='string',
LogUri='string',
AdditionalInfo='string',
AmiVersion='string',
ReleaseLabel='string',
Instances={
'MasterInstanceType': 'string',
'SlaveInstanceType': 'string',
'InstanceCount': 123,
'InstanceGroups': [
{
'Name': 'string',
'Market': 'ON_DEMAND'|'SPOT',
'InstanceRole': 'MASTER'|'CORE'|'TASK',
'BidPrice': 'string',
'InstanceType': 'string',
'InstanceCount': 123,
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
],
'EbsConfiguration': {
'EbsBlockDeviceConfigs': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'VolumesPerInstance': 123
},
],
'EbsOptimized': True|False
},
'AutoScalingPolicy': {
'Constraints': {
'MinCapacity': 123,
'MaxCapacity': 123
},
'Rules': [
{
'Name': 'string',
'Description': 'string',
'Action': {
'Market': 'ON_DEMAND'|'SPOT',
'SimpleScalingPolicyConfiguration': {
'AdjustmentType': 'CHANGE_IN_CAPACITY'|'PERCENT_CHANGE_IN_CAPACITY'|'EXACT_CAPACITY',
'ScalingAdjustment': 123,
'CoolDown': 123
}
},
'Trigger': {
'CloudWatchAlarmDefinition': {
'ComparisonOperator': 'GREATER_THAN_OR_EQUAL'|'GREATER_THAN'|'LESS_THAN'|'LESS_THAN_OR_EQUAL',
'EvaluationPeriods': 123,
'MetricName': 'string',
'Namespace': 'string',
'Period': 123,
'Statistic': 'SAMPLE_COUNT'|'AVERAGE'|'SUM'|'MINIMUM'|'MAXIMUM',
'Threshold': 123.0,
'Unit': 'NONE'|'SECONDS'|'MICRO_SECONDS'|'MILLI_SECONDS'|'BYTES'|'KILO_BYTES'|'MEGA_BYTES'|'GIGA_BYTES'|'TERA_BYTES'|'BITS'|'KILO_BITS'|'MEGA_BITS'|'GIGA_BITS'|'TERA_BITS'|'PERCENT'|'COUNT'|'BYTES_PER_SECOND'|'KILO_BYTES_PER_SECOND'|'MEGA_BYTES_PER_SECOND'|'GIGA_BYTES_PER_SECOND'|'TERA_BYTES_PER_SECOND'|'BITS_PER_SECOND'|'KILO_BITS_PER_SECOND'|'MEGA_BITS_PER_SECOND'|'GIGA_BITS_PER_SECOND'|'TERA_BITS_PER_SECOND'|'COUNT_PER_SECOND',
'Dimensions': [
{
'Key': 'string',
'Value': 'string'
},
]
}
}
},
]
}
},
],
'InstanceFleets': [
{
'Name': 'string',
'InstanceFleetType': 'MASTER'|'CORE'|'TASK',
'TargetOnDemandCapacity': 123,
'TargetSpotCapacity': 123,
'InstanceTypeConfigs': [
{
'InstanceType': 'string',
'WeightedCapacity': 123,
'BidPrice': 'string',
'BidPriceAsPercentageOfOnDemandPrice': 123.0,
'EbsConfiguration': {
'EbsBlockDeviceConfigs': [
{
'VolumeSpecification': {
'VolumeType': 'string',
'Iops': 123,
'SizeInGB': 123
},
'VolumesPerInstance': 123
},
],
'EbsOptimized': True|False
},
'Configurations': [
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
]
},
],
'LaunchSpecifications': {
'SpotSpecification': {
'TimeoutDurationMinutes': 123,
'TimeoutAction': 'SWITCH_TO_ON_DEMAND'|'TERMINATE_CLUSTER',
'BlockDurationMinutes': 123
}
}
},
],
'Ec2KeyName': 'string',
'Placement': {
'AvailabilityZone': 'string',
'AvailabilityZones': [
'string',
]
},
'KeepJobFlowAliveWhenNoSteps': True|False,
'TerminationProtected': True|False,
'HadoopVersion': 'string',
'Ec2SubnetId': 'string',
'Ec2SubnetIds': [
'string',
],
'EmrManagedMasterSecurityGroup': 'string',
'EmrManagedSlaveSecurityGroup': 'string',
'ServiceAccessSecurityGroup': 'string',
'AdditionalMasterSecurityGroups': [
'string',
],
'AdditionalSlaveSecurityGroups': [
'string',
]
},
Steps=[
{
'Name': 'string',
'ActionOnFailure': 'TERMINATE_JOB_FLOW'|'TERMINATE_CLUSTER'|'CANCEL_AND_WAIT'|'CONTINUE',
'HadoopJarStep': {
'Properties': [
{
'Key': 'string',
'Value': 'string'
},
],
'Jar': 'string',
'MainClass': 'string',
'Args': [
'string',
]
}
},
],
BootstrapActions=[
{
'Name': 'string',
'ScriptBootstrapAction': {
'Path': 'string',
'Args': [
'string',
]
}
},
],
SupportedProducts=[
'string',
],
NewSupportedProducts=[
{
'Name': 'string',
'Args': [
'string',
]
},
],
Applications=[
{
'Name': 'string',
'Version': 'string',
'Args': [
'string',
],
'AdditionalInfo': {
'string': 'string'
}
},
],
Configurations=[
{
'Classification': 'string',
'Configurations': {'... recursive ...'},
'Properties': {
'string': 'string'
}
},
],
VisibleToAllUsers=True|False,
JobFlowRole='string',
ServiceRole='string',
Tags=[
{
'Key': 'string',
'Value': 'string'
},
],
SecurityConfiguration='string',
AutoScalingRole='string',
ScaleDownBehavior='TERMINATE_AT_INSTANCE_HOUR'|'TERMINATE_AT_TASK_COMPLETION'
)
:type Name: string
:param Name: [REQUIRED]
The name of the job flow.
:type LogUri: string
:param LogUri: The location in Amazon S3 to write the log files of the job flow. If a value is not provided, logs are not created.
:type AdditionalInfo: string
:param AdditionalInfo: A JSON string for selecting additional features.
:type AmiVersion: string
:param AmiVersion:
Note
For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and greater, use ReleaseLabel.
The version of the Amazon Machine Image (AMI) to use when launching Amazon EC2 instances in the job flow. The following values are valid:
The version number of the AMI to use, for example, '2.0.'
If the AMI supports multiple versions of Hadoop (for example, AMI 1.0 supports both Hadoop 0.18 and 0.20) you can use the JobFlowInstancesConfig HadoopVersion parameter to modify the version of Hadoop from the defaults shown above.
For details about the AMI versions currently supported by Amazon Elastic MapReduce, see AMI Versions Supported in Elastic MapReduce in the Amazon Elastic MapReduce Developer Guide.
Note
Previously, the EMR AMI version API parameter options allowed you to use latest for the latest AMI version rather than specify a numerical value. Some regions no longer support this deprecated option as they only have a newer release label version of EMR, which requires you to specify an EMR release label release (EMR 4.x or later).
:type ReleaseLabel: string
:param ReleaseLabel:
Note
Amazon EMR releases 4.x or later.
The release label for the Amazon EMR release. For Amazon EMR 3.x and 2.x AMIs, use amiVersion instead instead of ReleaseLabel.
:type Instances: dict
:param Instances: [REQUIRED]
A specification of the number and type of Amazon EC2 instances.
MasterInstanceType (string) --The EC2 instance type of the master node.
SlaveInstanceType (string) --The EC2 instance type of the slave nodes.
InstanceCount (integer) --The number of EC2 instances in the cluster.
InstanceGroups (list) --Configuration for the instance groups in a cluster.
(dict) --Configuration defining a new instance group.
Name (string) --Friendly name given to the instance group.
Market (string) --Market type of the EC2 instances used to create a cluster node.
InstanceRole (string) -- [REQUIRED]The role of the instance group in the cluster.
BidPrice (string) --Bid price for each EC2 instance in the instance group when launching nodes as Spot Instances, expressed in USD.
InstanceType (string) -- [REQUIRED]The EC2 instance type for all instances in the instance group.
InstanceCount (integer) -- [REQUIRED]Target number of instances for the instance group.
Configurations (list) --
Note
Amazon EMR releases 4.x or later.
The list of configurations supplied for an EMR cluster instance group. You can specify a separate configuration for each instance group (master, core, and task).
(dict) --
Note
Amazon EMR releases 4.x or later.
An optional configuration specification to be used when provisioning cluster instances, which can include configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification, properties, and optional nested configurations. A classification refers to an application-specific configuration file. Properties are the settings you want to change in that file. For more information, see Configuring Applications .
Classification (string) --The classification within a configuration.
Configurations (list) --A list of additional configurations to apply within a configuration object.
Properties (dict) --A set of properties specified within a configuration classification.
(string) --
(string) --
EbsConfiguration (dict) --EBS configurations that will be attached to each EC2 instance in the instance group.
EbsBlockDeviceConfigs (list) --An array of Amazon EBS volume specifications attached to a cluster instance.
(dict) --Configuration of requested EBS block device associated with the instance group with count of volumes that will be associated to every instance.
VolumeSpecification (dict) -- [REQUIRED]EBS volume specifications such as volume type, IOPS, and size (GiB) that will be requested for the EBS volume attached to an EC2 instance in the cluster.
VolumeType (string) -- [REQUIRED]The volume type. Volume types supported are gp2, io1, standard.
Iops (integer) --The number of I/O operations per second (IOPS) that the volume supports.
SizeInGB (integer) -- [REQUIRED]The volume size, in gibibytes (GiB). This can be a number from 1 - 1024. If the volume type is EBS-optimized, the minimum value is 10.
VolumesPerInstance (integer) --Number of EBS volumes with a specific volume configuration that will be associated with every instance in the instance group
EbsOptimized (boolean) --Indicates whether an Amazon EBS volume is EBS-optimized.
AutoScalingPolicy (dict) --An automatic scaling policy for a core instance group or task instance group in an Amazon EMR cluster. The automatic scaling policy defines how an instance group dynamically adds and terminates EC2 instances in response to the value of a CloudWatch metric. See PutAutoScalingPolicy .
Constraints (dict) -- [REQUIRED]The upper and lower EC2 instance limits for an automatic scaling policy. Automatic scaling activity will not cause an instance group to grow above or below these limits.
MinCapacity (integer) -- [REQUIRED]The lower boundary of EC2 instances in an instance group below which scaling activities are not allowed to shrink. Scale-in activities will not terminate instances below this boundary.
MaxCapacity (integer) -- [REQUIRED]The upper boundary of EC2 instances in an instance group beyond which scaling activities are not allowed to grow. Scale-out activities will not add instances beyond this boundary.
Rules (list) -- [REQUIRED]The scale-in and scale-out rules that comprise the automatic scaling policy.
(dict) --A scale-in or scale-out rule that defines scaling activity, including the CloudWatch metric alarm that triggers activity, how EC2 instances are added or removed, and the periodicity of adjustments. The automatic scaling policy for an instance group can comprise one or more automatic scaling rules.
Name (string) -- [REQUIRED]The name used to identify an automatic scaling rule. Rule names must be unique within a scaling policy.
Description (string) --A friendly, more verbose description of the automatic scaling rule.
Action (dict) -- [REQUIRED]The conditions that trigger an automatic scaling activity.
Market (string) --Not available for instance groups. Instance groups use the market type specified for the group.
SimpleScalingPolicyConfiguration (dict) -- [REQUIRED]The type of adjustment the automatic scaling activity makes when triggered, and the periodicity of the adjustment.
AdjustmentType (string) --The way in which EC2 instances are added (if ScalingAdjustment is a positive number) or terminated (if ScalingAdjustment is a negative number) each time the scaling activity is triggered. CHANGE_IN_CAPACITY is the default. CHANGE_IN_CAPACITY indicates that the EC2 instance count increments or decrements by ScalingAdjustment , which should be expressed as an integer. PERCENT_CHANGE_IN_CAPACITY indicates the instance count increments or decrements by the percentage specified by ScalingAdjustment , which should be expressed as a decimal. For example, 0.20 indicates an increase in 20% increments of cluster capacity. EXACT_CAPACITY indicates the scaling activity results in an instance group with the number of EC2 instances specified by ScalingAdjustment , which should be expressed as a positive integer.
ScalingAdjustment (integer) -- [REQUIRED]The amount by which to scale in or scale out, based on the specified AdjustmentType . A positive value adds to the instance group's EC2 instance count while a negative number removes instances. If AdjustmentType is set to EXACT_CAPACITY , the number should only be a positive integer. If AdjustmentType is set to PERCENT_CHANGE_IN_CAPACITY , the value should express the percentage as a decimal. For example, -0.20 indicates a decrease in 20% increments of cluster capacity.
CoolDown (integer) --The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start. The default value is 0.
Trigger (dict) -- [REQUIRED]The CloudWatch alarm definition that determines when automatic scaling activity is triggered.
CloudWatchAlarmDefinition (dict) -- [REQUIRED]The definition of a CloudWatch metric alarm. When the defined alarm conditions are met along with other trigger parameters, scaling activity begins.
ComparisonOperator (string) -- [REQUIRED]Determines how the metric specified by MetricName is compared to the value specified by Threshold .
EvaluationPeriods (integer) --The number of periods, expressed in seconds using Period , during which the alarm condition must exist before the alarm triggers automatic scaling activity. The default value is 1 .
MetricName (string) -- [REQUIRED]The name of the CloudWatch metric that is watched to determine an alarm condition.
Namespace (string) --The namespace for the CloudWatch metric. The default is AWS/ElasticMapReduce .
Period (integer) -- [REQUIRED]The period, in seconds, over which the statistic is applied. EMR CloudWatch metrics are emitted every five minutes (300 seconds), so if an EMR CloudWatch metric is specified, specify 300 .
Statistic (string) --The statistic to apply to the metric associated with the alarm. The default is AVERAGE .
Threshold (float) -- [REQUIRED]The value against which the specified statistic is compared.
Unit (string) --The unit of measure associated with the CloudWatch metric being watched. The value specified for Unit must correspond to the units specified in the CloudWatch metric.
Dimensions (list) --A CloudWatch metric dimension.
(dict) --A CloudWatch dimension, which is specified using a Key (known as a Name in CloudWatch), Value pair. By default, Amazon EMR uses one dimension whose Key is JobFlowID and Value is a variable representing the cluster ID, which is ${emr.clusterId} . This enables the rule to bootstrap when the cluster ID becomes available.
Key (string) --The dimension name.
Value (string) --The dimension value.
InstanceFleets (list) --
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
Describes the EC2 instances and instance configurations for clusters that use the instance fleet configuration.
(dict) --The configuration that defines an instance fleet.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
Name (string) --The friendly name of the instance fleet.
InstanceFleetType (string) -- [REQUIRED]The node type that the instance fleet hosts. Valid values are MASTER,CORE,and TASK.
TargetOnDemandCapacity (integer) --The target capacity of On-Demand units for the instance fleet, which determines how many On-Demand instances to provision. When the instance fleet launches, Amazon EMR tries to provision On-Demand instances as specified by InstanceTypeConfig . Each instance configuration has a specified WeightedCapacity . When an On-Demand instance is provisioned, the WeightedCapacity units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a WeightedCapacity of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.
Note
If not specified or set to 0, only Spot instances are provisioned for the instance fleet using TargetSpotCapacity . At least one of TargetSpotCapacity and TargetOnDemandCapacity should be greater than 0. For a master instance fleet, only one of TargetSpotCapacity and TargetOnDemandCapacity can be specified, and its value must be 1.
TargetSpotCapacity (integer) --The target capacity of Spot units for the instance fleet, which determines how many Spot instances to provision. When the instance fleet launches, Amazon EMR tries to provision Spot instances as specified by InstanceTypeConfig . Each instance configuration has a specified WeightedCapacity . When a Spot instance is provisioned, the WeightedCapacity units count toward the target capacity. Amazon EMR provisions instances until the target capacity is totally fulfilled, even if this results in an overage. For example, if there are 2 units remaining to fulfill capacity, and Amazon EMR can only provision an instance with a WeightedCapacity of 5 units, the instance is provisioned, and the target capacity is exceeded by 3 units.
Note
If not specified or set to 0, only On-Demand instances are provisioned for the instance fleet. At least one of TargetSpotCapacity and TargetOnDemandCapacity should be greater than 0. For a master instance fleet, only one of TargetSpotCapacity and TargetOnDemandCapacity can be specified, and its value must be 1.
InstanceTypeConfigs (list) --The instance type configurations that define the EC2 instances in the instance fleet.
(dict) --An instance type configuration for each instance type in an instance fleet, which determines the EC2 instances Amazon EMR attempts to provision to fulfill On-Demand and Spot target capacities. There can be a maximum of 5 instance type configurations in a fleet.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
InstanceType (string) -- [REQUIRED]An EC2 instance type, such as m3.xlarge .
WeightedCapacity (integer) --The number of units that a provisioned instance of this type provides toward fulfilling the target capacities defined in InstanceFleetConfig . This value is 1 for a master instance fleet, and must be greater than 0 for core and task instance fleets.
BidPrice (string) --The bid price for each EC2 Spot instance type as defined by InstanceType . Expressed in USD. If neither BidPrice nor BidPriceAsPercentageOfOnDemandPrice is provided, BidPriceAsPercentageOfOnDemandPrice defaults to 100%.
BidPriceAsPercentageOfOnDemandPrice (float) --The bid price, as a percentage of On-Demand price, for each EC2 Spot instance as defined by InstanceType . Expressed as a number between 0 and 1000 (for example, 20 specifies 20%). If neither BidPrice nor BidPriceAsPercentageOfOnDemandPrice is provided, BidPriceAsPercentageOfOnDemandPrice defaults to 100%.
EbsConfiguration (dict) --The configuration of Amazon Elastic Block Storage (EBS) attached to each instance as defined by InstanceType .
EbsBlockDeviceConfigs (list) --An array of Amazon EBS volume specifications attached to a cluster instance.
(dict) --Configuration of requested EBS block device associated with the instance group with count of volumes that will be associated to every instance.
VolumeSpecification (dict) -- [REQUIRED]EBS volume specifications such as volume type, IOPS, and size (GiB) that will be requested for the EBS volume attached to an EC2 instance in the cluster.
VolumeType (string) -- [REQUIRED]The volume type. Volume types supported are gp2, io1, standard.
Iops (integer) --The number of I/O operations per second (IOPS) that the volume supports.
SizeInGB (integer) -- [REQUIRED]The volume size, in gibibytes (GiB). This can be a number from 1 - 1024. If the volume type is EBS-optimized, the minimum value is 10.
VolumesPerInstance (integer) --Number of EBS volumes with a specific volume configuration that will be associated with every instance in the instance group
EbsOptimized (boolean) --Indicates whether an Amazon EBS volume is EBS-optimized.
Configurations (list) --A configuration classification that applies when provisioning cluster instances, which can include configurations for applications and software that run on the cluster.
(dict) --
Note
Amazon EMR releases 4.x or later.
An optional configuration specification to be used when provisioning cluster instances, which can include configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification, properties, and optional nested configurations. A classification refers to an application-specific configuration file. Properties are the settings you want to change in that file. For more information, see Configuring Applications .
Classification (string) --The classification within a configuration.
Configurations (list) --A list of additional configurations to apply within a configuration object.
Properties (dict) --A set of properties specified within a configuration classification.
(string) --
(string) --
LaunchSpecifications (dict) --The launch specification for the instance fleet.
SpotSpecification (dict) -- [REQUIRED]The launch specification for Spot instances in the fleet, which determines the defined duration and provisioning timeout behavior.
TimeoutDurationMinutes (integer) -- [REQUIRED]The spot provisioning timeout period in minutes. If Spot instances are not provisioned within this time period, the TimeOutAction is taken. Minimum value is 5 and maximum value is 1440. The timeout applies only during initial provisioning, when the cluster is first created.
TimeoutAction (string) -- [REQUIRED]The action to take when TargetSpotCapacity has not been fulfilled when the TimeoutDurationMinutes has expired. Spot instances are not uprovisioned within the Spot provisioining timeout. Valid values are TERMINATE_CLUSTER and SWITCH_TO_ON_DEMAND to fulfill the remaining capacity.
BlockDurationMinutes (integer) --The defined duration for Spot instances (also known as Spot blocks) in minutes. When specified, the Spot instance does not terminate before the defined duration expires, and defined duration pricing for Spot instances applies. Valid values are 60, 120, 180, 240, 300, or 360. The duration period starts as soon as a Spot instance receives its instance ID. At the end of the duration, Amazon EC2 marks the Spot instance for termination and provides a Spot instance termination notice, which gives the instance a two-minute warning before it terminates.
Ec2KeyName (string) --The name of the EC2 key pair that can be used to ssh to the master node as the user called 'hadoop.'
Placement (dict) --The Availability Zone in which the cluster runs.
AvailabilityZone (string) --The Amazon EC2 Availability Zone for the cluster. AvailabilityZone is used for uniform instance groups, while AvailabilityZones (plural) is used for instance fleets.
AvailabilityZones (list) --When multiple Availability Zones are specified, Amazon EMR evaluates them and launches instances in the optimal Availability Zone. AvailabilityZones is used for instance fleets, while AvailabilityZone (singular) is used for uniform instance groups.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
(string) --
KeepJobFlowAliveWhenNoSteps (boolean) --Specifies whether the cluster should remain available after completing all steps.
TerminationProtected (boolean) --Specifies whether to lock the cluster to prevent the Amazon EC2 instances from being terminated by API call, user intervention, or in the event of a job-flow error.
HadoopVersion (string) --The Hadoop version for the cluster. Valid inputs are '0.18' (deprecated), '0.20' (deprecated), '0.20.205' (deprecated), '1.0.3', '2.2.0', or '2.4.0'. If you do not set this value, the default of 0.18 is used, unless the AmiVersion parameter is set in the RunJobFlow call, in which case the default version of Hadoop for that AMI version is used.
Ec2SubnetId (string) --Applies to clusters that use the uniform instance group configuration. To launch the cluster in Amazon Virtual Private Cloud (Amazon VPC), set this parameter to the identifier of the Amazon VPC subnet where you want the cluster to launch. If you do not specify this value, the cluster launches in the normal Amazon Web Services cloud, outside of an Amazon VPC, if the account launching the cluster supports EC2 Classic networks in the region where the cluster launches.
Amazon VPC currently does not support cluster compute quadruple extra large (cc1.4xlarge) instances. Thus you cannot specify the cc1.4xlarge instance type for clusters launched in an Amazon VPC.
Ec2SubnetIds (list) --Applies to clusters that use the instance fleet configuration. When multiple EC2 subnet IDs are specified, Amazon EMR evaluates them and launches instances in the optimal subnet.
Note
The instance fleet configuration is available only in Amazon EMR versions 4.8.0 and later, excluding 5.0.x versions.
(string) --
EmrManagedMasterSecurityGroup (string) --The identifier of the Amazon EC2 security group for the master node.
EmrManagedSlaveSecurityGroup (string) --The identifier of the Amazon EC2 security group for the slave nodes.
ServiceAccessSecurityGroup (string) --The identifier of the Amazon EC2 security group for the Amazon EMR service to access clusters in VPC private subnets.
AdditionalMasterSecurityGroups (list) --A list of additional Amazon EC2 security group IDs for the master node.
(string) --
AdditionalSlaveSecurityGroups (list) --A list of additional Amazon EC2 security group IDs for the slave nodes.
(string) --
:type Steps: list
:param Steps: A list of steps to run.
(dict) --Specification of a cluster (job flow) step.
Name (string) -- [REQUIRED]The name of the step.
ActionOnFailure (string) --The action to take if the step fails.
HadoopJarStep (dict) -- [REQUIRED]The JAR file used for the step.
Properties (list) --A list of Java properties that are set when the step runs. You can use these properties to pass key value pairs to your main function.
(dict) --A key value pair.
Key (string) --The unique identifier of a key value pair.
Value (string) --The value part of the identified key.
Jar (string) -- [REQUIRED]A path to a JAR file run during the step.
MainClass (string) --The name of the main class in the specified Java file. If not specified, the JAR file should specify a Main-Class in its manifest file.
Args (list) --A list of command line arguments passed to the JAR file's main function when executed.
(string) --
:type BootstrapActions: list
:param BootstrapActions: A list of bootstrap actions to run before Hadoop starts on the cluster nodes.
(dict) --Configuration of a bootstrap action.
Name (string) -- [REQUIRED]The name of the bootstrap action.
ScriptBootstrapAction (dict) -- [REQUIRED]The script run by the bootstrap action.
Path (string) -- [REQUIRED]Location of the script to run during a bootstrap action. Can be either a location in Amazon S3 or on a local file system.
Args (list) --A list of command line arguments to pass to the bootstrap action script.
(string) --
:type SupportedProducts: list
:param SupportedProducts:
Note
For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and greater, use Applications.
A list of strings that indicates third-party software to use. For more information, see Use Third Party Applications with Amazon EMR . Currently supported values are:
'mapr-m3' - launch the job flow using MapR M3 Edition.
'mapr-m5' - launch the job flow using MapR M5 Edition.
(string) --
:type NewSupportedProducts: list
:param NewSupportedProducts:
Note
For Amazon EMR releases 3.x and 2.x. For Amazon EMR releases 4.x and greater, use Applications.
A list of strings that indicates third-party software to use with the job flow that accepts a user argument list. EMR accepts and forwards the argument list to the corresponding installation script as bootstrap action arguments. For more information, see 'Launch a Job Flow on the MapR Distribution for Hadoop' in the Amazon EMR Developer Guide . Supported values are:
'mapr-m3' - launch the cluster using MapR M3 Edition.
'mapr-m5' - launch the cluster using MapR M5 Edition.
'mapr' with the user arguments specifying '--edition,m3' or '--edition,m5' - launch the job flow using MapR M3 or M5 Edition respectively.
'mapr-m7' - launch the cluster using MapR M7 Edition.
'hunk' - launch the cluster with the Hunk Big Data Analtics Platform.
'hue'- launch the cluster with Hue installed.
'spark' - launch the cluster with Apache Spark installed.
'ganglia' - launch the cluster with the Ganglia Monitoring System installed.
(dict) --The list of supported product configurations which allow user-supplied arguments. EMR accepts these arguments and forwards them to the corresponding installation script as bootstrap action arguments.
Name (string) --The name of the product configuration.
Args (list) --The list of user-supplied arguments.
(string) --
:type Applications: list
:param Applications:
Note
Amazon EMR releases 4.x or later.
A list of applications for the cluster. Valid values are: 'Hadoop', 'Hive', 'Mahout', 'Pig', and 'Spark.' They are case insensitive.
(dict) --An application is any Amazon or third-party software that you can add to the cluster. This structure contains a list of strings that indicates the software to use with the cluster and accepts a user argument list. Amazon EMR accepts and forwards the argument list to the corresponding installation script as bootstrap action argument. For more information, see Using the MapR Distribution for Hadoop . Currently supported values are:
'mapr-m3' - launch the cluster using MapR M3 Edition.
'mapr-m5' - launch the cluster using MapR M5 Edition.
'mapr' with the user arguments specifying '--edition,m3' or '--edition,m5' - launch the cluster using MapR M3 or M5 Edition, respectively.
Note
In Amazon EMR releases 4.0 and greater, the only accepted parameter is the application name. To pass arguments to applications, you supply a configuration for each application.
Name (string) --The name of the application.
Version (string) --The version of the application.
Args (list) --Arguments for Amazon EMR to pass to the application.
(string) --
AdditionalInfo (dict) --This option is for advanced users only. This is meta information about third-party applications that third-party vendors use for testing purposes.
(string) --
(string) --
:type Configurations: list
:param Configurations:
Note
Amazon EMR releases 4.x or later.
The list of configurations supplied for the EMR cluster you are creating.
(dict) --
Note
Amazon EMR releases 4.x or later.
An optional configuration specification to be used when provisioning cluster instances, which can include configurations for applications and software bundled with Amazon EMR. A configuration consists of a classification, properties, and optional nested configurations. A classification refers to an application-specific configuration file. Properties are the settings you want to change in that file. For more information, see Configuring Applications .
Classification (string) --The classification within a configuration.
Configurations (list) --A list of additional configurations to apply within a configuration object.
Properties (dict) --A set of properties specified within a configuration classification.
(string) --
(string) --
:type VisibleToAllUsers: boolean
:param VisibleToAllUsers: Whether the cluster is visible to all IAM users of the AWS account associated with the cluster. If this value is set to true , all IAM users of that AWS account can view and (if they have the proper policy permissions set) manage the cluster. If it is set to false , only the IAM user that created the cluster can view and manage it.
:type JobFlowRole: string
:param JobFlowRole: Also called instance profile and EC2 role. An IAM role for an EMR cluster. The EC2 instances of the cluster assume this role. The default role is EMR_EC2_DefaultRole . In order to use the default role, you must have already created it using the CLI or console.
:type ServiceRole: string
:param ServiceRole: The IAM role that will be assumed by the Amazon EMR service to access AWS resources on your behalf.
:type Tags: list
:param Tags: A list of tags to associate with a cluster and propagate to Amazon EC2 instances.
(dict) --A key/value pair containing user-defined metadata that you can associate with an Amazon EMR resource. Tags make it easier to associate clusters in various ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For more information, see Tagging Amazon EMR Resources .
Key (string) --A user-defined key, which is the minimum required information for a valid tag. For more information, see Tagging Amazon EMR Resources .
Value (string) --A user-defined value, which is optional in a tag. For more information, see Tagging Amazon EMR Resources .
:type SecurityConfiguration: string
:param SecurityConfiguration: The name of a security configuration to apply to the cluster.
:type AutoScalingRole: string
:param AutoScalingRole: An IAM role for automatic scaling policies. The default role is EMR_AutoScaling_DefaultRole . The IAM role provides permissions that the automatic scaling feature requires to launch and terminate EC2 instances in an instance group.
:type ScaleDownBehavior: string
:param ScaleDownBehavior: Specifies the way that individual Amazon EC2 instances terminate when an automatic scale-in activity occurs or an instance group is resized. TERMINATE_AT_INSTANCE_HOUR indicates that Amazon EMR terminates nodes at the instance-hour boundary, regardless of when the request to terminate the instance was submitted. This option is only available with Amazon EMR 5.1.0 and later and is the default for clusters created using that version. TERMINATE_AT_TASK_COMPLETION indicates that Amazon EMR blacklists and drains tasks from nodes before terminating the Amazon EC2 instances, regardless of the instance-hour boundary. With either behavior, Amazon EMR removes the least active nodes first and blocks instance termination if it could lead to HDFS corruption. TERMINATE_AT_TASK_COMPLETION available only in Amazon EMR version 4.1.0 and later, and is the default for versions of Amazon EMR earlier than 5.1.0.
:rtype: dict
:return: {
'JobFlowId': 'string'
} | entailment |
def describe_batch_predictions(FilterVariable=None, EQ=None, GT=None, LT=None, GE=None, LE=None, NE=None, Prefix=None, SortOrder=None, NextToken=None, Limit=None):
"""
Returns a list of BatchPrediction operations that match the search criteria in the request.
See also: AWS API Documentation
:example: response = client.describe_batch_predictions(
FilterVariable='CreatedAt'|'LastUpdatedAt'|'Status'|'Name'|'IAMUser'|'MLModelId'|'DataSourceId'|'DataURI',
EQ='string',
GT='string',
LT='string',
GE='string',
LE='string',
NE='string',
Prefix='string',
SortOrder='asc'|'dsc',
NextToken='string',
Limit=123
)
:type FilterVariable: string
:param FilterVariable: Use one of the following variables to filter a list of BatchPrediction :
CreatedAt - Sets the search criteria to the BatchPrediction creation date.
Status - Sets the search criteria to the BatchPrediction status.
Name - Sets the search criteria to the contents of the BatchPrediction **** Name .
IAMUser - Sets the search criteria to the user account that invoked the BatchPrediction creation.
MLModelId - Sets the search criteria to the MLModel used in the BatchPrediction .
DataSourceId - Sets the search criteria to the DataSource used in the BatchPrediction .
DataURI - Sets the search criteria to the data file(s) used in the BatchPrediction . The URL can identify either a file or an Amazon Simple Storage Solution (Amazon S3) bucket or directory.
:type EQ: string
:param EQ: The equal to operator. The BatchPrediction results will have FilterVariable values that exactly match the value specified with EQ .
:type GT: string
:param GT: The greater than operator. The BatchPrediction results will have FilterVariable values that are greater than the value specified with GT .
:type LT: string
:param LT: The less than operator. The BatchPrediction results will have FilterVariable values that are less than the value specified with LT .
:type GE: string
:param GE: The greater than or equal to operator. The BatchPrediction results will have FilterVariable values that are greater than or equal to the value specified with GE .
:type LE: string
:param LE: The less than or equal to operator. The BatchPrediction results will have FilterVariable values that are less than or equal to the value specified with LE .
:type NE: string
:param NE: The not equal to operator. The BatchPrediction results will have FilterVariable values not equal to the value specified with NE .
:type Prefix: string
:param Prefix: A string that is found at the beginning of a variable, such as Name or Id .
For example, a Batch Prediction operation could have the Name 2014-09-09-HolidayGiftMailer . To search for this BatchPrediction , select Name for the FilterVariable and any of the following strings for the Prefix :
2014-09
2014-09-09
2014-09-09-Holiday
:type SortOrder: string
:param SortOrder: A two-value parameter that determines the sequence of the resulting list of MLModel s.
asc - Arranges the list in ascending order (A-Z, 0-9).
dsc - Arranges the list in descending order (Z-A, 9-0).
Results are sorted by FilterVariable .
:type NextToken: string
:param NextToken: An ID of the page in the paginated results.
:type Limit: integer
:param Limit: The number of pages of information to include in the result. The range of acceptable values is 1 through 100 . The default value is 100 .
:rtype: dict
:return: {
'Results': [
{
'BatchPredictionId': 'string',
'MLModelId': 'string',
'BatchPredictionDataSourceId': 'string',
'InputDataLocationS3': 'string',
'CreatedByIamUser': 'string',
'CreatedAt': datetime(2015, 1, 1),
'LastUpdatedAt': datetime(2015, 1, 1),
'Name': 'string',
'Status': 'PENDING'|'INPROGRESS'|'FAILED'|'COMPLETED'|'DELETED',
'OutputUri': 'string',
'Message': 'string',
'ComputeTime': 123,
'FinishedAt': datetime(2015, 1, 1),
'StartedAt': datetime(2015, 1, 1),
'TotalRecordCount': 123,
'InvalidRecordCount': 123
},
],
'NextToken': 'string'
}
:returns:
PENDING - Amazon Machine Learning (Amazon ML) submitted a request to generate predictions for a batch of observations.
INPROGRESS - The process is underway.
FAILED - The request to perform a batch prediction did not run to completion. It is not usable.
COMPLETED - The batch prediction process completed successfully.
DELETED - The BatchPrediction is marked as deleted. It is not usable.
"""
pass | Returns a list of BatchPrediction operations that match the search criteria in the request.
See also: AWS API Documentation
:example: response = client.describe_batch_predictions(
FilterVariable='CreatedAt'|'LastUpdatedAt'|'Status'|'Name'|'IAMUser'|'MLModelId'|'DataSourceId'|'DataURI',
EQ='string',
GT='string',
LT='string',
GE='string',
LE='string',
NE='string',
Prefix='string',
SortOrder='asc'|'dsc',
NextToken='string',
Limit=123
)
:type FilterVariable: string
:param FilterVariable: Use one of the following variables to filter a list of BatchPrediction :
CreatedAt - Sets the search criteria to the BatchPrediction creation date.
Status - Sets the search criteria to the BatchPrediction status.
Name - Sets the search criteria to the contents of the BatchPrediction **** Name .
IAMUser - Sets the search criteria to the user account that invoked the BatchPrediction creation.
MLModelId - Sets the search criteria to the MLModel used in the BatchPrediction .
DataSourceId - Sets the search criteria to the DataSource used in the BatchPrediction .
DataURI - Sets the search criteria to the data file(s) used in the BatchPrediction . The URL can identify either a file or an Amazon Simple Storage Solution (Amazon S3) bucket or directory.
:type EQ: string
:param EQ: The equal to operator. The BatchPrediction results will have FilterVariable values that exactly match the value specified with EQ .
:type GT: string
:param GT: The greater than operator. The BatchPrediction results will have FilterVariable values that are greater than the value specified with GT .
:type LT: string
:param LT: The less than operator. The BatchPrediction results will have FilterVariable values that are less than the value specified with LT .
:type GE: string
:param GE: The greater than or equal to operator. The BatchPrediction results will have FilterVariable values that are greater than or equal to the value specified with GE .
:type LE: string
:param LE: The less than or equal to operator. The BatchPrediction results will have FilterVariable values that are less than or equal to the value specified with LE .
:type NE: string
:param NE: The not equal to operator. The BatchPrediction results will have FilterVariable values not equal to the value specified with NE .
:type Prefix: string
:param Prefix: A string that is found at the beginning of a variable, such as Name or Id .
For example, a Batch Prediction operation could have the Name 2014-09-09-HolidayGiftMailer . To search for this BatchPrediction , select Name for the FilterVariable and any of the following strings for the Prefix :
2014-09
2014-09-09
2014-09-09-Holiday
:type SortOrder: string
:param SortOrder: A two-value parameter that determines the sequence of the resulting list of MLModel s.
asc - Arranges the list in ascending order (A-Z, 0-9).
dsc - Arranges the list in descending order (Z-A, 9-0).
Results are sorted by FilterVariable .
:type NextToken: string
:param NextToken: An ID of the page in the paginated results.
:type Limit: integer
:param Limit: The number of pages of information to include in the result. The range of acceptable values is 1 through 100 . The default value is 100 .
:rtype: dict
:return: {
'Results': [
{
'BatchPredictionId': 'string',
'MLModelId': 'string',
'BatchPredictionDataSourceId': 'string',
'InputDataLocationS3': 'string',
'CreatedByIamUser': 'string',
'CreatedAt': datetime(2015, 1, 1),
'LastUpdatedAt': datetime(2015, 1, 1),
'Name': 'string',
'Status': 'PENDING'|'INPROGRESS'|'FAILED'|'COMPLETED'|'DELETED',
'OutputUri': 'string',
'Message': 'string',
'ComputeTime': 123,
'FinishedAt': datetime(2015, 1, 1),
'StartedAt': datetime(2015, 1, 1),
'TotalRecordCount': 123,
'InvalidRecordCount': 123
},
],
'NextToken': 'string'
}
:returns:
PENDING - Amazon Machine Learning (Amazon ML) submitted a request to generate predictions for a batch of observations.
INPROGRESS - The process is underway.
FAILED - The request to perform a batch prediction did not run to completion. It is not usable.
COMPLETED - The batch prediction process completed successfully.
DELETED - The BatchPrediction is marked as deleted. It is not usable. | entailment |
def delete_item(TableName=None, Key=None, Expected=None, ConditionalOperator=None, ReturnValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, ConditionExpression=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None):
"""
Deletes a single item in a table by primary key. You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value.
In addition to deleting an item, you can also return the item's attribute values in the same operation, using the ReturnValues parameter.
Unless you specify conditions, the DeleteItem is an idempotent operation; running it multiple times on the same item or attribute does not result in an error response.
Conditional deletes are useful for deleting items only if specific conditions are met. If those conditions are met, DynamoDB performs the delete. Otherwise, the item is not deleted.
See also: AWS API Documentation
Examples
This example deletes an item from the Music table.
Expected Output:
:example: response = client.delete_item(
TableName='string',
Key={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
Expected={
'string': {
'Value': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
'Exists': True|False,
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH',
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
]
}
},
ConditionalOperator='AND'|'OR',
ReturnValues='NONE'|'ALL_OLD'|'UPDATED_OLD'|'ALL_NEW'|'UPDATED_NEW',
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
ReturnItemCollectionMetrics='SIZE'|'NONE',
ConditionExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
}
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table from which to delete the item.
:type Key: dict
:param Key: [REQUIRED]
A map of attribute names to AttributeValue objects, representing the primary key of the item to delete.
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type Expected: dict
:param Expected: This is a legacy parameter. Use ConditionExpresssion instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents a condition to be compared with an attribute value. This condition can be used with DeleteItem , PutItem or UpdateItem operations; if the comparison evaluates to true, the operation succeeds; if not, the operation fails. You can use ExpectedAttributeValue in one of two different ways:
Use AttributeValueList to specify one or more values to compare against an attribute. Use ComparisonOperator to specify how you want to perform the comparison. If the comparison evaluates to true, then the conditional operation succeeds.
Use Value to specify a value that DynamoDB will compare against an attribute. If the values match, then ExpectedAttributeValue evaluates to true and the conditional operation succeeds. Optionally, you can also set Exists to false, indicating that you do not expect to find the attribute value in the table. In this case, the conditional operation succeeds only if the comparison evaluates to false.
Value and Exists are incompatible with AttributeValueList and ComparisonOperator . Note that if you use both sets of parameters at once, DynamoDB will return a ValidationException exception.
Value (dict) --Represents the data for the expected attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
Exists (boolean) --Causes DynamoDB to evaluate the value before attempting a conditional operation:
If Exists is true , DynamoDB will check to see if that attribute value already exists in the table. If it is found, then the operation succeeds. If it is not found, the operation fails with a ConditionalCheckFailedException .
If Exists is false , DynamoDB assumes that the attribute value does not exist in the table. If in fact the value does not exist, then the assumption is valid and the operation succeeds. If the value is found, despite the assumption that it does not exist, the operation fails with a ConditionalCheckFailedException .
The default setting for Exists is true . If you supply a Value all by itself, DynamoDB assumes the attribute exists: You don't have to set Exists to true , because it is implied.
DynamoDB returns a ValidationException if:
Exists is true but there is no Value to check. (You expect a value to exist, but don't specify what that value is.)
Exists is false but you also provide a Value . (You cannot expect an attribute to have a value, while also expecting it not to exist.)
ComparisonOperator (string) --A comparator for evaluating attributes in the AttributeValueList . For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
For information on specifying data types in JSON, see JSON Data Format in the Amazon DynamoDB Developer Guide .
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ReturnValues: string
:param ReturnValues: Use ReturnValues if you want to get the item attributes as they appeared before they were deleted. For DeleteItem , the valid values are:
NONE - If ReturnValues is not specified, or if its value is NONE , then nothing is returned. (This setting is the default for ReturnValues .)
ALL_OLD - The content of the old item is returned.
Note
The ReturnValues parameter is used by several DynamoDB operations; however, DeleteItem does not recognize any values other than NONE or ALL_OLD .
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type ReturnItemCollectionMetrics: string
:param ReturnItemCollectionMetrics: Determines whether item collection metrics are returned. If set to SIZE , the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.
:type ConditionExpression: string
:param ConditionExpression: A condition that must be satisfied in order for a conditional DeleteItem to succeed.
An expression can contain any of the following:
Functions: attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size These function names are case-sensitive.
Comparison operators: = | | | | = | = | BETWEEN | IN
Logical operators: AND | OR | NOT
For more information on condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:rtype: dict
:return: {
'Attributes': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
},
'ItemCollectionMetrics': {
'ItemCollectionKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'SizeEstimateRangeGB': [
123.0,
]
}
}
:returns:
(string) --
"""
pass | Deletes a single item in a table by primary key. You can perform a conditional delete operation that deletes the item if it exists, or if it has an expected attribute value.
In addition to deleting an item, you can also return the item's attribute values in the same operation, using the ReturnValues parameter.
Unless you specify conditions, the DeleteItem is an idempotent operation; running it multiple times on the same item or attribute does not result in an error response.
Conditional deletes are useful for deleting items only if specific conditions are met. If those conditions are met, DynamoDB performs the delete. Otherwise, the item is not deleted.
See also: AWS API Documentation
Examples
This example deletes an item from the Music table.
Expected Output:
:example: response = client.delete_item(
TableName='string',
Key={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
Expected={
'string': {
'Value': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
'Exists': True|False,
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH',
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
]
}
},
ConditionalOperator='AND'|'OR',
ReturnValues='NONE'|'ALL_OLD'|'UPDATED_OLD'|'ALL_NEW'|'UPDATED_NEW',
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
ReturnItemCollectionMetrics='SIZE'|'NONE',
ConditionExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
}
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table from which to delete the item.
:type Key: dict
:param Key: [REQUIRED]
A map of attribute names to AttributeValue objects, representing the primary key of the item to delete.
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type Expected: dict
:param Expected: This is a legacy parameter. Use ConditionExpresssion instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents a condition to be compared with an attribute value. This condition can be used with DeleteItem , PutItem or UpdateItem operations; if the comparison evaluates to true, the operation succeeds; if not, the operation fails. You can use ExpectedAttributeValue in one of two different ways:
Use AttributeValueList to specify one or more values to compare against an attribute. Use ComparisonOperator to specify how you want to perform the comparison. If the comparison evaluates to true, then the conditional operation succeeds.
Use Value to specify a value that DynamoDB will compare against an attribute. If the values match, then ExpectedAttributeValue evaluates to true and the conditional operation succeeds. Optionally, you can also set Exists to false, indicating that you do not expect to find the attribute value in the table. In this case, the conditional operation succeeds only if the comparison evaluates to false.
Value and Exists are incompatible with AttributeValueList and ComparisonOperator . Note that if you use both sets of parameters at once, DynamoDB will return a ValidationException exception.
Value (dict) --Represents the data for the expected attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
Exists (boolean) --Causes DynamoDB to evaluate the value before attempting a conditional operation:
If Exists is true , DynamoDB will check to see if that attribute value already exists in the table. If it is found, then the operation succeeds. If it is not found, the operation fails with a ConditionalCheckFailedException .
If Exists is false , DynamoDB assumes that the attribute value does not exist in the table. If in fact the value does not exist, then the assumption is valid and the operation succeeds. If the value is found, despite the assumption that it does not exist, the operation fails with a ConditionalCheckFailedException .
The default setting for Exists is true . If you supply a Value all by itself, DynamoDB assumes the attribute exists: You don't have to set Exists to true , because it is implied.
DynamoDB returns a ValidationException if:
Exists is true but there is no Value to check. (You expect a value to exist, but don't specify what that value is.)
Exists is false but you also provide a Value . (You cannot expect an attribute to have a value, while also expecting it not to exist.)
ComparisonOperator (string) --A comparator for evaluating attributes in the AttributeValueList . For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
For information on specifying data types in JSON, see JSON Data Format in the Amazon DynamoDB Developer Guide .
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ReturnValues: string
:param ReturnValues: Use ReturnValues if you want to get the item attributes as they appeared before they were deleted. For DeleteItem , the valid values are:
NONE - If ReturnValues is not specified, or if its value is NONE , then nothing is returned. (This setting is the default for ReturnValues .)
ALL_OLD - The content of the old item is returned.
Note
The ReturnValues parameter is used by several DynamoDB operations; however, DeleteItem does not recognize any values other than NONE or ALL_OLD .
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type ReturnItemCollectionMetrics: string
:param ReturnItemCollectionMetrics: Determines whether item collection metrics are returned. If set to SIZE , the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.
:type ConditionExpression: string
:param ConditionExpression: A condition that must be satisfied in order for a conditional DeleteItem to succeed.
An expression can contain any of the following:
Functions: attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size These function names are case-sensitive.
Comparison operators: = | | | | = | = | BETWEEN | IN
Logical operators: AND | OR | NOT
For more information on condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:rtype: dict
:return: {
'Attributes': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
},
'ItemCollectionMetrics': {
'ItemCollectionKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'SizeEstimateRangeGB': [
123.0,
]
}
}
:returns:
(string) -- | entailment |
def put_item(TableName=None, Item=None, Expected=None, ReturnValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, ConditionalOperator=None, ConditionExpression=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None):
"""
Creates a new item, or replaces an old item with a new item. If an item that has the same primary key as the new item already exists in the specified table, the new item completely replaces the existing item. You can perform a conditional put operation (add a new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values.
In addition to putting an item, you can also return the item's attribute values in the same operation, using the ReturnValues parameter.
When you add an item, the primary key attribute(s) are the only required attributes. Attribute values cannot be null. String and Binary type attributes must have lengths greater than zero. Set type attributes cannot be empty. Requests with empty values will be rejected with a ValidationException exception.
For more information about PutItem , see Working with Items in the Amazon DynamoDB Developer Guide .
See also: AWS API Documentation
Examples
This example adds a new item to the Music table.
Expected Output:
:example: response = client.put_item(
TableName='string',
Item={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
Expected={
'string': {
'Value': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
'Exists': True|False,
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH',
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
]
}
},
ReturnValues='NONE'|'ALL_OLD'|'UPDATED_OLD'|'ALL_NEW'|'UPDATED_NEW',
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
ReturnItemCollectionMetrics='SIZE'|'NONE',
ConditionalOperator='AND'|'OR',
ConditionExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
}
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table to contain the item.
:type Item: dict
:param Item: [REQUIRED]
A map of attribute name/value pairs, one for each attribute. Only the primary key attributes are required; you can optionally provide other attribute name-value pairs for the item.
You must provide all of the attributes for the primary key. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide both values for both the partition key and the sort key.
If you specify any attributes that are part of an index key, then the data types for those attributes must match those of the schema in the table's attribute definition.
For more information about primary keys, see Primary Key in the Amazon DynamoDB Developer Guide .
Each element in the Item map is an AttributeValue object.
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type Expected: dict
:param Expected: This is a legacy parameter. Use ConditionExpresssion instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents a condition to be compared with an attribute value. This condition can be used with DeleteItem , PutItem or UpdateItem operations; if the comparison evaluates to true, the operation succeeds; if not, the operation fails. You can use ExpectedAttributeValue in one of two different ways:
Use AttributeValueList to specify one or more values to compare against an attribute. Use ComparisonOperator to specify how you want to perform the comparison. If the comparison evaluates to true, then the conditional operation succeeds.
Use Value to specify a value that DynamoDB will compare against an attribute. If the values match, then ExpectedAttributeValue evaluates to true and the conditional operation succeeds. Optionally, you can also set Exists to false, indicating that you do not expect to find the attribute value in the table. In this case, the conditional operation succeeds only if the comparison evaluates to false.
Value and Exists are incompatible with AttributeValueList and ComparisonOperator . Note that if you use both sets of parameters at once, DynamoDB will return a ValidationException exception.
Value (dict) --Represents the data for the expected attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
Exists (boolean) --Causes DynamoDB to evaluate the value before attempting a conditional operation:
If Exists is true , DynamoDB will check to see if that attribute value already exists in the table. If it is found, then the operation succeeds. If it is not found, the operation fails with a ConditionalCheckFailedException .
If Exists is false , DynamoDB assumes that the attribute value does not exist in the table. If in fact the value does not exist, then the assumption is valid and the operation succeeds. If the value is found, despite the assumption that it does not exist, the operation fails with a ConditionalCheckFailedException .
The default setting for Exists is true . If you supply a Value all by itself, DynamoDB assumes the attribute exists: You don't have to set Exists to true , because it is implied.
DynamoDB returns a ValidationException if:
Exists is true but there is no Value to check. (You expect a value to exist, but don't specify what that value is.)
Exists is false but you also provide a Value . (You cannot expect an attribute to have a value, while also expecting it not to exist.)
ComparisonOperator (string) --A comparator for evaluating attributes in the AttributeValueList . For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
For information on specifying data types in JSON, see JSON Data Format in the Amazon DynamoDB Developer Guide .
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ReturnValues: string
:param ReturnValues: Use ReturnValues if you want to get the item attributes as they appeared before they were updated with the PutItem request. For PutItem , the valid values are:
NONE - If ReturnValues is not specified, or if its value is NONE , then nothing is returned. (This setting is the default for ReturnValues .)
ALL_OLD - If PutItem overwrote an attribute name-value pair, then the content of the old item is returned.
Note
The ReturnValues parameter is used by several DynamoDB operations; however, PutItem does not recognize any values other than NONE or ALL_OLD .
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type ReturnItemCollectionMetrics: string
:param ReturnItemCollectionMetrics: Determines whether item collection metrics are returned. If set to SIZE , the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ConditionExpression: string
:param ConditionExpression: A condition that must be satisfied in order for a conditional PutItem operation to succeed.
An expression can contain any of the following:
Functions: attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size These function names are case-sensitive.
Comparison operators: = | | | | = | = | BETWEEN | IN
Logical operators: AND | OR | NOT
For more information on condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:rtype: dict
:return: {
'Attributes': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
},
'ItemCollectionMetrics': {
'ItemCollectionKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'SizeEstimateRangeGB': [
123.0,
]
}
}
:returns:
(string) --
"""
pass | Creates a new item, or replaces an old item with a new item. If an item that has the same primary key as the new item already exists in the specified table, the new item completely replaces the existing item. You can perform a conditional put operation (add a new item if one with the specified primary key doesn't exist), or replace an existing item if it has certain attribute values.
In addition to putting an item, you can also return the item's attribute values in the same operation, using the ReturnValues parameter.
When you add an item, the primary key attribute(s) are the only required attributes. Attribute values cannot be null. String and Binary type attributes must have lengths greater than zero. Set type attributes cannot be empty. Requests with empty values will be rejected with a ValidationException exception.
For more information about PutItem , see Working with Items in the Amazon DynamoDB Developer Guide .
See also: AWS API Documentation
Examples
This example adds a new item to the Music table.
Expected Output:
:example: response = client.put_item(
TableName='string',
Item={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
Expected={
'string': {
'Value': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
'Exists': True|False,
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH',
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
]
}
},
ReturnValues='NONE'|'ALL_OLD'|'UPDATED_OLD'|'ALL_NEW'|'UPDATED_NEW',
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
ReturnItemCollectionMetrics='SIZE'|'NONE',
ConditionalOperator='AND'|'OR',
ConditionExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
}
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table to contain the item.
:type Item: dict
:param Item: [REQUIRED]
A map of attribute name/value pairs, one for each attribute. Only the primary key attributes are required; you can optionally provide other attribute name-value pairs for the item.
You must provide all of the attributes for the primary key. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide both values for both the partition key and the sort key.
If you specify any attributes that are part of an index key, then the data types for those attributes must match those of the schema in the table's attribute definition.
For more information about primary keys, see Primary Key in the Amazon DynamoDB Developer Guide .
Each element in the Item map is an AttributeValue object.
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type Expected: dict
:param Expected: This is a legacy parameter. Use ConditionExpresssion instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents a condition to be compared with an attribute value. This condition can be used with DeleteItem , PutItem or UpdateItem operations; if the comparison evaluates to true, the operation succeeds; if not, the operation fails. You can use ExpectedAttributeValue in one of two different ways:
Use AttributeValueList to specify one or more values to compare against an attribute. Use ComparisonOperator to specify how you want to perform the comparison. If the comparison evaluates to true, then the conditional operation succeeds.
Use Value to specify a value that DynamoDB will compare against an attribute. If the values match, then ExpectedAttributeValue evaluates to true and the conditional operation succeeds. Optionally, you can also set Exists to false, indicating that you do not expect to find the attribute value in the table. In this case, the conditional operation succeeds only if the comparison evaluates to false.
Value and Exists are incompatible with AttributeValueList and ComparisonOperator . Note that if you use both sets of parameters at once, DynamoDB will return a ValidationException exception.
Value (dict) --Represents the data for the expected attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
Exists (boolean) --Causes DynamoDB to evaluate the value before attempting a conditional operation:
If Exists is true , DynamoDB will check to see if that attribute value already exists in the table. If it is found, then the operation succeeds. If it is not found, the operation fails with a ConditionalCheckFailedException .
If Exists is false , DynamoDB assumes that the attribute value does not exist in the table. If in fact the value does not exist, then the assumption is valid and the operation succeeds. If the value is found, despite the assumption that it does not exist, the operation fails with a ConditionalCheckFailedException .
The default setting for Exists is true . If you supply a Value all by itself, DynamoDB assumes the attribute exists: You don't have to set Exists to true , because it is implied.
DynamoDB returns a ValidationException if:
Exists is true but there is no Value to check. (You expect a value to exist, but don't specify what that value is.)
Exists is false but you also provide a Value . (You cannot expect an attribute to have a value, while also expecting it not to exist.)
ComparisonOperator (string) --A comparator for evaluating attributes in the AttributeValueList . For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
For information on specifying data types in JSON, see JSON Data Format in the Amazon DynamoDB Developer Guide .
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ReturnValues: string
:param ReturnValues: Use ReturnValues if you want to get the item attributes as they appeared before they were updated with the PutItem request. For PutItem , the valid values are:
NONE - If ReturnValues is not specified, or if its value is NONE , then nothing is returned. (This setting is the default for ReturnValues .)
ALL_OLD - If PutItem overwrote an attribute name-value pair, then the content of the old item is returned.
Note
The ReturnValues parameter is used by several DynamoDB operations; however, PutItem does not recognize any values other than NONE or ALL_OLD .
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type ReturnItemCollectionMetrics: string
:param ReturnItemCollectionMetrics: Determines whether item collection metrics are returned. If set to SIZE , the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ConditionExpression: string
:param ConditionExpression: A condition that must be satisfied in order for a conditional PutItem operation to succeed.
An expression can contain any of the following:
Functions: attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size These function names are case-sensitive.
Comparison operators: = | | | | = | = | BETWEEN | IN
Logical operators: AND | OR | NOT
For more information on condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:rtype: dict
:return: {
'Attributes': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
},
'ItemCollectionMetrics': {
'ItemCollectionKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'SizeEstimateRangeGB': [
123.0,
]
}
}
:returns:
(string) -- | entailment |
def query(TableName=None, IndexName=None, Select=None, AttributesToGet=None, Limit=None, ConsistentRead=None, KeyConditions=None, QueryFilter=None, ConditionalOperator=None, ScanIndexForward=None, ExclusiveStartKey=None, ReturnConsumedCapacity=None, ProjectionExpression=None, FilterExpression=None, KeyConditionExpression=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None):
"""
A Query operation uses the primary key of a table or a secondary index to directly access items from that table or index.
Use the KeyConditionExpression parameter to provide a specific value for the partition key. The Query operation will return all of the items from the table or index with that partition key value. You can optionally narrow the scope of the Query operation by specifying a sort key value and a comparison operator in KeyConditionExpression . You can use the ScanIndexForward parameter to get results in forward or reverse order, by sort key.
Queries that do not return results consume the minimum number of read capacity units for that type of read operation.
If the total number of items meeting the query criteria exceeds the result set size limit of 1 MB, the query stops and results are returned to the user with the LastEvaluatedKey element to continue the query in a subsequent operation. Unlike a Scan operation, a Query operation never returns both an empty result set and a LastEvaluatedKey value. LastEvaluatedKey is only provided if you have used the Limit parameter, or if the result set exceeds 1 MB (prior to applying a filter).
You can query a table, a local secondary index, or a global secondary index. For a query on a table or on a local secondary index, you can set the ConsistentRead parameter to true and obtain a strongly consistent result. Global secondary indexes support eventually consistent reads only, so do not specify ConsistentRead when querying a global secondary index.
See also: AWS API Documentation
Examples
This example queries items in the Music table. The table has a partition key and sort key (Artist and SongTitle), but this query only specifies the partition key value. It returns song titles by the artist named "No One You Know".
Expected Output:
:example: response = client.query(
TableName='string',
IndexName='string',
Select='ALL_ATTRIBUTES'|'ALL_PROJECTED_ATTRIBUTES'|'SPECIFIC_ATTRIBUTES'|'COUNT',
AttributesToGet=[
'string',
],
Limit=123,
ConsistentRead=True|False,
KeyConditions={
'string': {
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
],
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH'
}
},
QueryFilter={
'string': {
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
],
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH'
}
},
ConditionalOperator='AND'|'OR',
ScanIndexForward=True|False,
ExclusiveStartKey={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
ProjectionExpression='string',
FilterExpression='string',
KeyConditionExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
}
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table containing the requested items.
:type IndexName: string
:param IndexName: The name of an index to query. This index can be any local secondary index or global secondary index on the table. Note that if you use the IndexName parameter, you must also provide TableName.
:type Select: string
:param Select: The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
ALL_ATTRIBUTES - Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required.
ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifying ALL_ATTRIBUTES .
COUNT - Returns the number of matching items, rather than the matching items themselves.
SPECIFIC_ATTRIBUTES - Returns only the attributes listed in AttributesToGet . This return value is equivalent to specifying AttributesToGet without specifying any value for Select . If you query or scan a local secondary index and request only attributes that are projected into that index, the operation will read only the index and not the table. If any of the requested attributes are not projected into the local secondary index, DynamoDB will fetch each of these attributes from the parent table. This extra fetching incurs additional throughput cost and latency. If you query or scan a global secondary index, you can only request attributes that are projected into the index. Global secondary index queries cannot fetch attributes from the parent table.
If neither Select nor AttributesToGet are specified, DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both Select and AttributesToGet together in a single request, unless the value for Select is SPECIFIC_ATTRIBUTES . (This usage is equivalent to specifying AttributesToGet without any value for Select .)
Note
If you use the ProjectionExpression parameter, then the value for Select can only be SPECIFIC_ATTRIBUTES . Any other value for Select will return an error.
:type AttributesToGet: list
:param AttributesToGet: This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide .
(string) --
:type Limit: integer
:param Limit: The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer Guide .
:type ConsistentRead: boolean
:param ConsistentRead: Determines the read consistency model: If set to true , then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
Strongly consistent reads are not supported on global secondary indexes. If you query a global secondary index with ConsistentRead set to true , you will receive a ValidationException .
:type KeyConditions: dict
:param KeyConditions: This is a legacy parameter. Use KeyConditionExpression instead. For more information, see KeyConditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the selection criteria for a Query or Scan operation:
For a Query operation, Condition is used for specifying the KeyConditions to use when querying a table or an index. For KeyConditions , only the following comparison operators are supported: EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN Condition is also used in a QueryFilter , which evaluates the query results and returns only the desired values.
For a Scan operation, Condition is used in a ScanFilter , which evaluates the scan results and returns only the desired values.
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
ComparisonOperator (string) -- [REQUIRED]A comparator for evaluating attributes. For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
For usage examples of AttributeValueList and ComparisonOperator , see Legacy Conditional Parameters in the Amazon DynamoDB Developer Guide .
:type QueryFilter: dict
:param QueryFilter: This is a legacy parameter. Use FilterExpression instead. For more information, see QueryFilter in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the selection criteria for a Query or Scan operation:
For a Query operation, Condition is used for specifying the KeyConditions to use when querying a table or an index. For KeyConditions , only the following comparison operators are supported: EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN Condition is also used in a QueryFilter , which evaluates the query results and returns only the desired values.
For a Scan operation, Condition is used in a ScanFilter , which evaluates the scan results and returns only the desired values.
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
ComparisonOperator (string) -- [REQUIRED]A comparator for evaluating attributes. For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
For usage examples of AttributeValueList and ComparisonOperator , see Legacy Conditional Parameters in the Amazon DynamoDB Developer Guide .
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use FilterExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ScanIndexForward: boolean
:param ScanIndexForward: Specifies the order for index traversal: If true (default), the traversal is performed in ascending order; if false , the traversal is performed in descending order.
Items with the same partition key value are stored in sorted order by sort key. If the sort key data type is Number, the results are stored in numeric order. For type String, the results are stored in order of ASCII character code values. For type Binary, DynamoDB treats each byte of the binary data as unsigned.
If ScanIndexForward is true , DynamoDB returns the results in the order in which they are stored (by sort key value). This is the default behavior. If ScanIndexForward is false , DynamoDB reads the results in reverse order by sort key value, and then returns the results to the client.
:type ExclusiveStartKey: dict
:param ExclusiveStartKey: The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey in the previous operation.
The data type for ExclusiveStartKey must be String, Number or Binary. No set data types are allowed.
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type ProjectionExpression: string
:param ProjectionExpression: A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
:type FilterExpression: string
:param FilterExpression: A string that contains conditions that DynamoDB applies after the Query operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned.
A FilterExpression does not allow key attributes. You cannot define a filter expression based on a partition key or a sort key.
Note
A FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.
For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide .
:type KeyConditionExpression: string
:param KeyConditionExpression: The condition that specifies the key value(s) for items to be retrieved by the Query action.
The condition must perform an equality test on a single partition key value. The condition can also perform one of several comparison tests on a single sort key value. Query can use KeyConditionExpression to retrieve one item with a given partition key value and sort key value, or several items that have the same partition key value but different sort key values.
The partition key equality test is required, and must be specified in the following format:
partitionKeyName = :partitionkeyval
If you also want to provide a condition for the sort key, it must be combined using AND with the condition for the sort key. Following is an example, using the = comparison operator for the sort key:
partitionKeyName = :partitionkeyval AND sortKeyName = :sortkeyval
Valid comparisons for the sort key condition are as follows:
sortKeyName = :sortkeyval - true if the sort key value is equal to :sortkeyval .
sortKeyName ```` :sortkeyval - true if the sort key value is less than :sortkeyval .
sortKeyName = :sortkeyval - true if the sort key value is less than or equal to :sortkeyval .
sortKeyName ```` :sortkeyval - true if the sort key value is greater than :sortkeyval .
sortKeyName = :sortkeyval - true if the sort key value is greater than or equal to :sortkeyval .
sortKeyName BETWEEN :sortkeyval1 AND :sortkeyval2 - true if the sort key value is greater than or equal to :sortkeyval1 , and less than or equal to :sortkeyval2 .
begins_with ( sortKeyName , :sortkeyval ) - true if the sort key value begins with a particular operand. (You cannot use this function with a sort key that is of type Number.) Note that the function name begins_with is case-sensitive.
Use the ExpressionAttributeValues parameter to replace tokens such as :partitionval and :sortval with actual values at runtime.
You can optionally use the ExpressionAttributeNames parameter to replace the names of the partition key and sort key with placeholder tokens. This option might be necessary if an attribute name conflicts with a DynamoDB reserved word. For example, the following KeyConditionExpression parameter causes an error because Size is a reserved word:
Size = :myval
To work around this, define a placeholder (such a #S ) to represent the attribute name Size . KeyConditionExpression then is as follows:
#S = :myval
For a list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide .
For more information on ExpressionAttributeNames and ExpressionAttributeValues , see Using Placeholders for Attribute Names and Values in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:rtype: dict
:return: {
'Items': [
{
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
],
'Count': 123,
'ScannedCount': 123,
'LastEvaluatedKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
}
}
:returns:
(string) --
"""
pass | A Query operation uses the primary key of a table or a secondary index to directly access items from that table or index.
Use the KeyConditionExpression parameter to provide a specific value for the partition key. The Query operation will return all of the items from the table or index with that partition key value. You can optionally narrow the scope of the Query operation by specifying a sort key value and a comparison operator in KeyConditionExpression . You can use the ScanIndexForward parameter to get results in forward or reverse order, by sort key.
Queries that do not return results consume the minimum number of read capacity units for that type of read operation.
If the total number of items meeting the query criteria exceeds the result set size limit of 1 MB, the query stops and results are returned to the user with the LastEvaluatedKey element to continue the query in a subsequent operation. Unlike a Scan operation, a Query operation never returns both an empty result set and a LastEvaluatedKey value. LastEvaluatedKey is only provided if you have used the Limit parameter, or if the result set exceeds 1 MB (prior to applying a filter).
You can query a table, a local secondary index, or a global secondary index. For a query on a table or on a local secondary index, you can set the ConsistentRead parameter to true and obtain a strongly consistent result. Global secondary indexes support eventually consistent reads only, so do not specify ConsistentRead when querying a global secondary index.
See also: AWS API Documentation
Examples
This example queries items in the Music table. The table has a partition key and sort key (Artist and SongTitle), but this query only specifies the partition key value. It returns song titles by the artist named "No One You Know".
Expected Output:
:example: response = client.query(
TableName='string',
IndexName='string',
Select='ALL_ATTRIBUTES'|'ALL_PROJECTED_ATTRIBUTES'|'SPECIFIC_ATTRIBUTES'|'COUNT',
AttributesToGet=[
'string',
],
Limit=123,
ConsistentRead=True|False,
KeyConditions={
'string': {
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
],
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH'
}
},
QueryFilter={
'string': {
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
],
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH'
}
},
ConditionalOperator='AND'|'OR',
ScanIndexForward=True|False,
ExclusiveStartKey={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
ProjectionExpression='string',
FilterExpression='string',
KeyConditionExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
}
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table containing the requested items.
:type IndexName: string
:param IndexName: The name of an index to query. This index can be any local secondary index or global secondary index on the table. Note that if you use the IndexName parameter, you must also provide TableName.
:type Select: string
:param Select: The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
ALL_ATTRIBUTES - Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required.
ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifying ALL_ATTRIBUTES .
COUNT - Returns the number of matching items, rather than the matching items themselves.
SPECIFIC_ATTRIBUTES - Returns only the attributes listed in AttributesToGet . This return value is equivalent to specifying AttributesToGet without specifying any value for Select . If you query or scan a local secondary index and request only attributes that are projected into that index, the operation will read only the index and not the table. If any of the requested attributes are not projected into the local secondary index, DynamoDB will fetch each of these attributes from the parent table. This extra fetching incurs additional throughput cost and latency. If you query or scan a global secondary index, you can only request attributes that are projected into the index. Global secondary index queries cannot fetch attributes from the parent table.
If neither Select nor AttributesToGet are specified, DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both Select and AttributesToGet together in a single request, unless the value for Select is SPECIFIC_ATTRIBUTES . (This usage is equivalent to specifying AttributesToGet without any value for Select .)
Note
If you use the ProjectionExpression parameter, then the value for Select can only be SPECIFIC_ATTRIBUTES . Any other value for Select will return an error.
:type AttributesToGet: list
:param AttributesToGet: This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide .
(string) --
:type Limit: integer
:param Limit: The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer Guide .
:type ConsistentRead: boolean
:param ConsistentRead: Determines the read consistency model: If set to true , then the operation uses strongly consistent reads; otherwise, the operation uses eventually consistent reads.
Strongly consistent reads are not supported on global secondary indexes. If you query a global secondary index with ConsistentRead set to true , you will receive a ValidationException .
:type KeyConditions: dict
:param KeyConditions: This is a legacy parameter. Use KeyConditionExpression instead. For more information, see KeyConditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the selection criteria for a Query or Scan operation:
For a Query operation, Condition is used for specifying the KeyConditions to use when querying a table or an index. For KeyConditions , only the following comparison operators are supported: EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN Condition is also used in a QueryFilter , which evaluates the query results and returns only the desired values.
For a Scan operation, Condition is used in a ScanFilter , which evaluates the scan results and returns only the desired values.
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
ComparisonOperator (string) -- [REQUIRED]A comparator for evaluating attributes. For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
For usage examples of AttributeValueList and ComparisonOperator , see Legacy Conditional Parameters in the Amazon DynamoDB Developer Guide .
:type QueryFilter: dict
:param QueryFilter: This is a legacy parameter. Use FilterExpression instead. For more information, see QueryFilter in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the selection criteria for a Query or Scan operation:
For a Query operation, Condition is used for specifying the KeyConditions to use when querying a table or an index. For KeyConditions , only the following comparison operators are supported: EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN Condition is also used in a QueryFilter , which evaluates the query results and returns only the desired values.
For a Scan operation, Condition is used in a ScanFilter , which evaluates the scan results and returns only the desired values.
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
ComparisonOperator (string) -- [REQUIRED]A comparator for evaluating attributes. For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
For usage examples of AttributeValueList and ComparisonOperator , see Legacy Conditional Parameters in the Amazon DynamoDB Developer Guide .
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use FilterExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ScanIndexForward: boolean
:param ScanIndexForward: Specifies the order for index traversal: If true (default), the traversal is performed in ascending order; if false , the traversal is performed in descending order.
Items with the same partition key value are stored in sorted order by sort key. If the sort key data type is Number, the results are stored in numeric order. For type String, the results are stored in order of ASCII character code values. For type Binary, DynamoDB treats each byte of the binary data as unsigned.
If ScanIndexForward is true , DynamoDB returns the results in the order in which they are stored (by sort key value). This is the default behavior. If ScanIndexForward is false , DynamoDB reads the results in reverse order by sort key value, and then returns the results to the client.
:type ExclusiveStartKey: dict
:param ExclusiveStartKey: The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey in the previous operation.
The data type for ExclusiveStartKey must be String, Number or Binary. No set data types are allowed.
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type ProjectionExpression: string
:param ProjectionExpression: A string that identifies one or more attributes to retrieve from the table. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
:type FilterExpression: string
:param FilterExpression: A string that contains conditions that DynamoDB applies after the Query operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned.
A FilterExpression does not allow key attributes. You cannot define a filter expression based on a partition key or a sort key.
Note
A FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.
For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide .
:type KeyConditionExpression: string
:param KeyConditionExpression: The condition that specifies the key value(s) for items to be retrieved by the Query action.
The condition must perform an equality test on a single partition key value. The condition can also perform one of several comparison tests on a single sort key value. Query can use KeyConditionExpression to retrieve one item with a given partition key value and sort key value, or several items that have the same partition key value but different sort key values.
The partition key equality test is required, and must be specified in the following format:
partitionKeyName = :partitionkeyval
If you also want to provide a condition for the sort key, it must be combined using AND with the condition for the sort key. Following is an example, using the = comparison operator for the sort key:
partitionKeyName = :partitionkeyval AND sortKeyName = :sortkeyval
Valid comparisons for the sort key condition are as follows:
sortKeyName = :sortkeyval - true if the sort key value is equal to :sortkeyval .
sortKeyName ```` :sortkeyval - true if the sort key value is less than :sortkeyval .
sortKeyName = :sortkeyval - true if the sort key value is less than or equal to :sortkeyval .
sortKeyName ```` :sortkeyval - true if the sort key value is greater than :sortkeyval .
sortKeyName = :sortkeyval - true if the sort key value is greater than or equal to :sortkeyval .
sortKeyName BETWEEN :sortkeyval1 AND :sortkeyval2 - true if the sort key value is greater than or equal to :sortkeyval1 , and less than or equal to :sortkeyval2 .
begins_with ( sortKeyName , :sortkeyval ) - true if the sort key value begins with a particular operand. (You cannot use this function with a sort key that is of type Number.) Note that the function name begins_with is case-sensitive.
Use the ExpressionAttributeValues parameter to replace tokens such as :partitionval and :sortval with actual values at runtime.
You can optionally use the ExpressionAttributeNames parameter to replace the names of the partition key and sort key with placeholder tokens. This option might be necessary if an attribute name conflicts with a DynamoDB reserved word. For example, the following KeyConditionExpression parameter causes an error because Size is a reserved word:
Size = :myval
To work around this, define a placeholder (such a #S ) to represent the attribute name Size . KeyConditionExpression then is as follows:
#S = :myval
For a list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide .
For more information on ExpressionAttributeNames and ExpressionAttributeValues , see Using Placeholders for Attribute Names and Values in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:rtype: dict
:return: {
'Items': [
{
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
],
'Count': 123,
'ScannedCount': 123,
'LastEvaluatedKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
}
}
:returns:
(string) -- | entailment |
def scan(TableName=None, IndexName=None, AttributesToGet=None, Limit=None, Select=None, ScanFilter=None, ConditionalOperator=None, ExclusiveStartKey=None, ReturnConsumedCapacity=None, TotalSegments=None, Segment=None, ProjectionExpression=None, FilterExpression=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None, ConsistentRead=None):
"""
The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index. To have DynamoDB return fewer items, you can provide a FilterExpression operation.
If the total number of scanned items exceeds the maximum data set size limit of 1 MB, the scan stops and results are returned to the user as a LastEvaluatedKey value to continue the scan in a subsequent operation. The results also include the number of items exceeding the limit. A scan can result in no table data meeting the filter criteria.
By default, Scan operations proceed sequentially; however, for faster performance on a large table or secondary index, applications can request a parallel Scan operation by providing the Segment and TotalSegments parameters. For more information, see Parallel Scan in the Amazon DynamoDB Developer Guide .
By default, Scan uses eventually consistent reads when accessing the data in a table; therefore, the result set might not include the changes to data in the table immediately before the operation began. If you need a consistent copy of the data, as of the time that the Scan begins, you can set the ConsistentRead parameter to true .
See also: AWS API Documentation
Examples
This example scans the entire Music table, and then narrows the results to songs by the artist "No One You Know". For each item, only the album title and song title are returned.
Expected Output:
:example: response = client.scan(
TableName='string',
IndexName='string',
AttributesToGet=[
'string',
],
Limit=123,
Select='ALL_ATTRIBUTES'|'ALL_PROJECTED_ATTRIBUTES'|'SPECIFIC_ATTRIBUTES'|'COUNT',
ScanFilter={
'string': {
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
],
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH'
}
},
ConditionalOperator='AND'|'OR',
ExclusiveStartKey={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
TotalSegments=123,
Segment=123,
ProjectionExpression='string',
FilterExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
ConsistentRead=True|False
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table containing the requested items; or, if you provide IndexName , the name of the table to which that index belongs.
:type IndexName: string
:param IndexName: The name of a secondary index to scan. This index can be any local secondary index or global secondary index. Note that if you use the IndexName parameter, you must also provide TableName .
:type AttributesToGet: list
:param AttributesToGet: This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide .
(string) --
:type Limit: integer
:param Limit: The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer Guide .
:type Select: string
:param Select: The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
ALL_ATTRIBUTES - Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required.
ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifying ALL_ATTRIBUTES .
COUNT - Returns the number of matching items, rather than the matching items themselves.
SPECIFIC_ATTRIBUTES - Returns only the attributes listed in AttributesToGet . This return value is equivalent to specifying AttributesToGet without specifying any value for Select . If you query or scan a local secondary index and request only attributes that are projected into that index, the operation will read only the index and not the table. If any of the requested attributes are not projected into the local secondary index, DynamoDB will fetch each of these attributes from the parent table. This extra fetching incurs additional throughput cost and latency. If you query or scan a global secondary index, you can only request attributes that are projected into the index. Global secondary index queries cannot fetch attributes from the parent table.
If neither Select nor AttributesToGet are specified, DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both Select and AttributesToGet together in a single request, unless the value for Select is SPECIFIC_ATTRIBUTES . (This usage is equivalent to specifying AttributesToGet without any value for Select .)
Note
If you use the ProjectionExpression parameter, then the value for Select can only be SPECIFIC_ATTRIBUTES . Any other value for Select will return an error.
:type ScanFilter: dict
:param ScanFilter: This is a legacy parameter. Use FilterExpression instead. For more information, see ScanFilter in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the selection criteria for a Query or Scan operation:
For a Query operation, Condition is used for specifying the KeyConditions to use when querying a table or an index. For KeyConditions , only the following comparison operators are supported: EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN Condition is also used in a QueryFilter , which evaluates the query results and returns only the desired values.
For a Scan operation, Condition is used in a ScanFilter , which evaluates the scan results and returns only the desired values.
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
ComparisonOperator (string) -- [REQUIRED]A comparator for evaluating attributes. For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
For usage examples of AttributeValueList and ComparisonOperator , see Legacy Conditional Parameters in the Amazon DynamoDB Developer Guide .
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use FilterExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ExclusiveStartKey: dict
:param ExclusiveStartKey: The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey in the previous operation.
The data type for ExclusiveStartKey must be String, Number or Binary. No set data types are allowed.
In a parallel scan, a Scan request that includes ExclusiveStartKey must specify the same segment whose previous Scan returned the corresponding value of LastEvaluatedKey .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type TotalSegments: integer
:param TotalSegments: For a parallel Scan request, TotalSegments represents the total number of segments into which the Scan operation will be divided. The value of TotalSegments corresponds to the number of application workers that will perform the parallel scan. For example, if you want to use four application threads to scan a table or an index, specify a TotalSegments value of 4.
The value for TotalSegments must be greater than or equal to 1, and less than or equal to 1000000. If you specify a TotalSegments value of 1, the Scan operation will be sequential rather than parallel.
If you specify TotalSegments , you must also specify Segment .
:type Segment: integer
:param Segment: For a parallel Scan request, Segment identifies an individual segment to be scanned by an application worker.
Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four application threads to scan a table or an index, then the first thread specifies a Segment value of 0, the second thread specifies 1, and so on.
The value of LastEvaluatedKey returned from a parallel Scan request must be used as ExclusiveStartKey with the same segment ID in a subsequent Scan operation.
The value for Segment must be greater than or equal to 0, and less than the value provided for TotalSegments .
If you provide Segment , you must also provide TotalSegments .
:type ProjectionExpression: string
:param ProjectionExpression: A string that identifies one or more attributes to retrieve from the specified table or index. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
:type FilterExpression: string
:param FilterExpression: A string that contains conditions that DynamoDB applies after the Scan operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned.
Note
A FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.
For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ConsistentRead: boolean
:param ConsistentRead: A Boolean value that determines the read consistency model during the scan:
If ConsistentRead is false , then the data returned from Scan might not contain the results from other recently completed write operations (PutItem, UpdateItem or DeleteItem).
If ConsistentRead is true , then all of the write operations that completed before the Scan began are guaranteed to be contained in the Scan response.
The default setting for ConsistentRead is false .
The ConsistentRead parameter is not supported on global secondary indexes. If you scan a global secondary index with ConsistentRead set to true, you will receive a ValidationException .
:rtype: dict
:return: {
'Items': [
{
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
],
'Count': 123,
'ScannedCount': 123,
'LastEvaluatedKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
}
}
:returns:
(string) --
"""
pass | The Scan operation returns one or more items and item attributes by accessing every item in a table or a secondary index. To have DynamoDB return fewer items, you can provide a FilterExpression operation.
If the total number of scanned items exceeds the maximum data set size limit of 1 MB, the scan stops and results are returned to the user as a LastEvaluatedKey value to continue the scan in a subsequent operation. The results also include the number of items exceeding the limit. A scan can result in no table data meeting the filter criteria.
By default, Scan operations proceed sequentially; however, for faster performance on a large table or secondary index, applications can request a parallel Scan operation by providing the Segment and TotalSegments parameters. For more information, see Parallel Scan in the Amazon DynamoDB Developer Guide .
By default, Scan uses eventually consistent reads when accessing the data in a table; therefore, the result set might not include the changes to data in the table immediately before the operation began. If you need a consistent copy of the data, as of the time that the Scan begins, you can set the ConsistentRead parameter to true .
See also: AWS API Documentation
Examples
This example scans the entire Music table, and then narrows the results to songs by the artist "No One You Know". For each item, only the album title and song title are returned.
Expected Output:
:example: response = client.scan(
TableName='string',
IndexName='string',
AttributesToGet=[
'string',
],
Limit=123,
Select='ALL_ATTRIBUTES'|'ALL_PROJECTED_ATTRIBUTES'|'SPECIFIC_ATTRIBUTES'|'COUNT',
ScanFilter={
'string': {
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
],
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH'
}
},
ConditionalOperator='AND'|'OR',
ExclusiveStartKey={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
TotalSegments=123,
Segment=123,
ProjectionExpression='string',
FilterExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
ConsistentRead=True|False
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table containing the requested items; or, if you provide IndexName , the name of the table to which that index belongs.
:type IndexName: string
:param IndexName: The name of a secondary index to scan. This index can be any local secondary index or global secondary index. Note that if you use the IndexName parameter, you must also provide TableName .
:type AttributesToGet: list
:param AttributesToGet: This is a legacy parameter. Use ProjectionExpression instead. For more information, see AttributesToGet in the Amazon DynamoDB Developer Guide .
(string) --
:type Limit: integer
:param Limit: The maximum number of items to evaluate (not necessarily the number of matching items). If DynamoDB processes the number of items up to the limit while processing the results, it stops the operation and returns the matching values up to that point, and a key in LastEvaluatedKey to apply in a subsequent operation, so that you can pick up where you left off. Also, if the processed data set size exceeds 1 MB before DynamoDB reaches this limit, it stops the operation and returns the matching values up to the limit, and a key in LastEvaluatedKey to apply in a subsequent operation to continue the operation. For more information, see Query and Scan in the Amazon DynamoDB Developer Guide .
:type Select: string
:param Select: The attributes to be returned in the result. You can retrieve all item attributes, specific item attributes, the count of matching items, or in the case of an index, some or all of the attributes projected into the index.
ALL_ATTRIBUTES - Returns all of the item attributes from the specified table or index. If you query a local secondary index, then for each matching item in the index DynamoDB will fetch the entire item from the parent table. If the index is configured to project all item attributes, then all of the data can be obtained from the local secondary index, and no fetching is required.
ALL_PROJECTED_ATTRIBUTES - Allowed only when querying an index. Retrieves all attributes that have been projected into the index. If the index is configured to project all attributes, this return value is equivalent to specifying ALL_ATTRIBUTES .
COUNT - Returns the number of matching items, rather than the matching items themselves.
SPECIFIC_ATTRIBUTES - Returns only the attributes listed in AttributesToGet . This return value is equivalent to specifying AttributesToGet without specifying any value for Select . If you query or scan a local secondary index and request only attributes that are projected into that index, the operation will read only the index and not the table. If any of the requested attributes are not projected into the local secondary index, DynamoDB will fetch each of these attributes from the parent table. This extra fetching incurs additional throughput cost and latency. If you query or scan a global secondary index, you can only request attributes that are projected into the index. Global secondary index queries cannot fetch attributes from the parent table.
If neither Select nor AttributesToGet are specified, DynamoDB defaults to ALL_ATTRIBUTES when accessing a table, and ALL_PROJECTED_ATTRIBUTES when accessing an index. You cannot use both Select and AttributesToGet together in a single request, unless the value for Select is SPECIFIC_ATTRIBUTES . (This usage is equivalent to specifying AttributesToGet without any value for Select .)
Note
If you use the ProjectionExpression parameter, then the value for Select can only be SPECIFIC_ATTRIBUTES . Any other value for Select will return an error.
:type ScanFilter: dict
:param ScanFilter: This is a legacy parameter. Use FilterExpression instead. For more information, see ScanFilter in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the selection criteria for a Query or Scan operation:
For a Query operation, Condition is used for specifying the KeyConditions to use when querying a table or an index. For KeyConditions , only the following comparison operators are supported: EQ | LE | LT | GE | GT | BEGINS_WITH | BETWEEN Condition is also used in a QueryFilter , which evaluates the query results and returns only the desired values.
For a Scan operation, Condition is used in a ScanFilter , which evaluates the scan results and returns only the desired values.
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
ComparisonOperator (string) -- [REQUIRED]A comparator for evaluating attributes. For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
For usage examples of AttributeValueList and ComparisonOperator , see Legacy Conditional Parameters in the Amazon DynamoDB Developer Guide .
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use FilterExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ExclusiveStartKey: dict
:param ExclusiveStartKey: The primary key of the first item that this operation will evaluate. Use the value that was returned for LastEvaluatedKey in the previous operation.
The data type for ExclusiveStartKey must be String, Number or Binary. No set data types are allowed.
In a parallel scan, a Scan request that includes ExclusiveStartKey must specify the same segment whose previous Scan returned the corresponding value of LastEvaluatedKey .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type TotalSegments: integer
:param TotalSegments: For a parallel Scan request, TotalSegments represents the total number of segments into which the Scan operation will be divided. The value of TotalSegments corresponds to the number of application workers that will perform the parallel scan. For example, if you want to use four application threads to scan a table or an index, specify a TotalSegments value of 4.
The value for TotalSegments must be greater than or equal to 1, and less than or equal to 1000000. If you specify a TotalSegments value of 1, the Scan operation will be sequential rather than parallel.
If you specify TotalSegments , you must also specify Segment .
:type Segment: integer
:param Segment: For a parallel Scan request, Segment identifies an individual segment to be scanned by an application worker.
Segment IDs are zero-based, so the first segment is always 0. For example, if you want to use four application threads to scan a table or an index, then the first thread specifies a Segment value of 0, the second thread specifies 1, and so on.
The value of LastEvaluatedKey returned from a parallel Scan request must be used as ExclusiveStartKey with the same segment ID in a subsequent Scan operation.
The value for Segment must be greater than or equal to 0, and less than the value provided for TotalSegments .
If you provide Segment , you must also provide TotalSegments .
:type ProjectionExpression: string
:param ProjectionExpression: A string that identifies one or more attributes to retrieve from the specified table or index. These attributes can include scalars, sets, or elements of a JSON document. The attributes in the expression must be separated by commas.
If no attribute names are specified, then all attributes will be returned. If any of the requested attributes are not found, they will not appear in the result.
For more information, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
:type FilterExpression: string
:param FilterExpression: A string that contains conditions that DynamoDB applies after the Scan operation, but before the data is returned to you. Items that do not satisfy the FilterExpression criteria are not returned.
Note
A FilterExpression is applied after the items have already been read; the process of filtering does not consume any additional read capacity units.
For more information, see Filter Expressions in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ConsistentRead: boolean
:param ConsistentRead: A Boolean value that determines the read consistency model during the scan:
If ConsistentRead is false , then the data returned from Scan might not contain the results from other recently completed write operations (PutItem, UpdateItem or DeleteItem).
If ConsistentRead is true , then all of the write operations that completed before the Scan began are guaranteed to be contained in the Scan response.
The default setting for ConsistentRead is false .
The ConsistentRead parameter is not supported on global secondary indexes. If you scan a global secondary index with ConsistentRead set to true, you will receive a ValidationException .
:rtype: dict
:return: {
'Items': [
{
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
],
'Count': 123,
'ScannedCount': 123,
'LastEvaluatedKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
}
}
:returns:
(string) -- | entailment |
def update_item(TableName=None, Key=None, AttributeUpdates=None, Expected=None, ConditionalOperator=None, ReturnValues=None, ReturnConsumedCapacity=None, ReturnItemCollectionMetrics=None, UpdateExpression=None, ConditionExpression=None, ExpressionAttributeNames=None, ExpressionAttributeValues=None):
"""
Edits an existing item's attributes, or adds a new item to the table if it does not already exist. You can put, delete, or add attribute values. You can also perform a conditional update on an existing item (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has certain expected attribute values).
You can also return the item's attribute values in the same UpdateItem operation using the ReturnValues parameter.
See also: AWS API Documentation
Examples
This example updates an item in the Music table. It adds a new attribute (Year) and modifies the AlbumTitle attribute. All of the attributes in the item, as they appear after the update, are returned in the response.
Expected Output:
:example: response = client.update_item(
TableName='string',
Key={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
AttributeUpdates={
'string': {
'Value': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
'Action': 'ADD'|'PUT'|'DELETE'
}
},
Expected={
'string': {
'Value': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
'Exists': True|False,
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH',
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
]
}
},
ConditionalOperator='AND'|'OR',
ReturnValues='NONE'|'ALL_OLD'|'UPDATED_OLD'|'ALL_NEW'|'UPDATED_NEW',
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
ReturnItemCollectionMetrics='SIZE'|'NONE',
UpdateExpression='string',
ConditionExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
}
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table containing the item to update.
:type Key: dict
:param Key: [REQUIRED]
The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type AttributeUpdates: dict
:param AttributeUpdates: This is a legacy parameter. Use UpdateExpression instead. For more information, see AttributeUpdates in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --For the UpdateItem operation, represents the attributes to be modified, the action to perform on each, and the new value for each.
Note
You cannot use UpdateItem to update any primary key attributes. Instead, you will need to delete the item, and then use PutItem to create a new item with new attributes.
Attribute values cannot be null; string and binary type attributes must have lengths greater than zero; and set type attributes must not be empty. Requests with empty values will be rejected with a ValidationException exception.
Value (dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data TYpes in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
Action (string) --Specifies how to perform the update. Valid values are PUT (default), DELETE , and ADD . The behavior depends on whether the specified primary key already exists in the table.
If an item with the specified *Key* is found in the table:
PUT - Adds the specified attribute to the item. If the attribute already exists, it is replaced by the new value.
DELETE - If no value is specified, the attribute and its value are removed from the item. The data type of the specified value must match the existing value's data type. If a set of values is specified, then those values are subtracted from the old set. For example, if the attribute value was the set [a,b,c] and the DELETE action specified [a,c] , then the final attribute value would be [b] . Specifying an empty set is an error.
ADD - If the attribute does not already exist, then the attribute and its values are added to the item. If the attribute does exist, then the behavior of ADD depends on the data type of the attribute:
If the existing attribute is a number, and if Value is also a number, then the Value is mathematically added to the existing attribute. If Value is a negative number, then it is subtracted from the existing attribute.
Note
If you use ADD to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses 0 as the initial value. In addition, if you use ADD to update an existing item, and intend to increment or decrement an attribute value which does not yet exist, DynamoDB uses 0 as the initial value. For example, suppose that the item you want to update does not yet have an attribute named itemcount , but you decide to ADD the number 3 to this attribute anyway, even though it currently does not exist. DynamoDB will create the itemcount attribute, set its initial value to 0 , and finally add 3 to it. The result will be a new itemcount attribute in the item, with a value of 3 .
If the existing data type is a set, and if the Value is also a set, then the Value is added to the existing set. (This is a set operation, not mathematical addition.) For example, if the attribute value was the set [1,2] , and the ADD action specified [3] , then the final attribute value would be [1,2,3] . An error occurs if an Add action is specified for a set attribute and the attribute type specified does not match the existing set type. Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the Value must also be a set of strings. The same holds true for number sets and binary sets.
This action is only valid for an existing attribute whose data type is number or is a set. Do not use ADD for any other data types.
If no item with the specified *Key* is found:
PUT - DynamoDB creates a new item with the specified primary key, and then adds the attribute.
DELETE - Nothing happens; there is no attribute to delete.
ADD - DynamoDB creates an item with the supplied primary key and number (or set of numbers) for the attribute value. The only data types allowed are number and number set; no other data types can be specified.
:type Expected: dict
:param Expected: This is a legacy parameter. Use ConditionExpresssion instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents a condition to be compared with an attribute value. This condition can be used with DeleteItem , PutItem or UpdateItem operations; if the comparison evaluates to true, the operation succeeds; if not, the operation fails. You can use ExpectedAttributeValue in one of two different ways:
Use AttributeValueList to specify one or more values to compare against an attribute. Use ComparisonOperator to specify how you want to perform the comparison. If the comparison evaluates to true, then the conditional operation succeeds.
Use Value to specify a value that DynamoDB will compare against an attribute. If the values match, then ExpectedAttributeValue evaluates to true and the conditional operation succeeds. Optionally, you can also set Exists to false, indicating that you do not expect to find the attribute value in the table. In this case, the conditional operation succeeds only if the comparison evaluates to false.
Value and Exists are incompatible with AttributeValueList and ComparisonOperator . Note that if you use both sets of parameters at once, DynamoDB will return a ValidationException exception.
Value (dict) --Represents the data for the expected attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
Exists (boolean) --Causes DynamoDB to evaluate the value before attempting a conditional operation:
If Exists is true , DynamoDB will check to see if that attribute value already exists in the table. If it is found, then the operation succeeds. If it is not found, the operation fails with a ConditionalCheckFailedException .
If Exists is false , DynamoDB assumes that the attribute value does not exist in the table. If in fact the value does not exist, then the assumption is valid and the operation succeeds. If the value is found, despite the assumption that it does not exist, the operation fails with a ConditionalCheckFailedException .
The default setting for Exists is true . If you supply a Value all by itself, DynamoDB assumes the attribute exists: You don't have to set Exists to true , because it is implied.
DynamoDB returns a ValidationException if:
Exists is true but there is no Value to check. (You expect a value to exist, but don't specify what that value is.)
Exists is false but you also provide a Value . (You cannot expect an attribute to have a value, while also expecting it not to exist.)
ComparisonOperator (string) --A comparator for evaluating attributes in the AttributeValueList . For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
For information on specifying data types in JSON, see JSON Data Format in the Amazon DynamoDB Developer Guide .
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ReturnValues: string
:param ReturnValues: Use ReturnValues if you want to get the item attributes as they appeared either before or after they were updated. For UpdateItem , the valid values are:
NONE - If ReturnValues is not specified, or if its value is NONE , then nothing is returned. (This setting is the default for ReturnValues .)
ALL_OLD - Returns all of the attributes of the item, as they appeared before the UpdateItem operation.
UPDATED_OLD - Returns only the updated attributes, as they appeared before the UpdateItem operation.
ALL_NEW - Returns all of the attributes of the item, as they appear after the UpdateItem operation.
UPDATED_NEW - Returns only the updated attributes, as they appear after the UpdateItem operation.
There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No Read Capacity Units are consumed.
Values returned are strongly consistent
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type ReturnItemCollectionMetrics: string
:param ReturnItemCollectionMetrics: Determines whether item collection metrics are returned. If set to SIZE , the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.
:type UpdateExpression: string
:param UpdateExpression: An expression that defines one or more attributes to be updated, the action to be performed on them, and new value(s) for them.
The following action values are available for UpdateExpression .
SET - Adds one or more attributes and values to an item. If any of these attribute already exist, they are replaced by the new values. You can also use SET to add or subtract from an attribute that is of type Number. For example: SET myNum = myNum + :val SET supports the following functions:
if_not_exists (path, operand) - if the item does not contain an attribute at the specified path, then if_not_exists evaluates to operand; otherwise, it evaluates to path. You can use this function to avoid overwriting an attribute that may already be present in the item.
list_append (operand, operand) - evaluates to a list with a new element added to it. You can append the new element to the start or the end of the list by reversing the order of the operands.
These function names are case-sensitive.
REMOVE - Removes one or more attributes from an item.
ADD - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of ADD depends on the data type of the attribute:
If the existing attribute is a number, and if Value is also a number, then Value is mathematically added to the existing attribute. If Value is a negative number, then it is subtracted from the existing attribute.
Note
If you use ADD to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses 0 as the initial value. Similarly, if you use ADD for an existing item to increment or decrement an attribute value that doesn't exist before the update, DynamoDB uses 0 as the initial value. For example, suppose that the item you want to update doesn't have an attribute named itemcount , but you decide to ADD the number 3 to this attribute anyway. DynamoDB will create the itemcount attribute, set its initial value to 0 , and finally add 3 to it. The result will be a new itemcount attribute in the item, with a value of 3 .
If the existing data type is a set and if Value is also a set, then Value is added to the existing set. For example, if the attribute value is the set [1,2] , and the ADD action specified [3] , then the final attribute value is [1,2,3] . An error occurs if an ADD action is specified for a set attribute and the attribute type specified does not match the existing set type. Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the Value must also be a set of strings.
Warning
The ADD action only supports Number and set data types. In addition, ADD can only be used on top-level attributes, not nested attributes.
DELETE - Deletes an element from a set. If a set of values is specified, then those values are subtracted from the old set. For example, if the attribute value was the set [a,b,c] and the DELETE action specifies [a,c] , then the final attribute value is [b] . Specifying an empty set is an error.
Warning
The DELETE action only supports set data types. In addition, DELETE can only be used on top-level attributes, not nested attributes.
You can have many actions in a single expression, such as the following: SET a=:value1, b=:value2 DELETE :value3, :value4, :value5
For more information on update expressions, see Modifying Items and Attributes in the Amazon DynamoDB Developer Guide .
:type ConditionExpression: string
:param ConditionExpression: A condition that must be satisfied in order for a conditional update to succeed.
An expression can contain any of the following:
Functions: attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size These function names are case-sensitive.
Comparison operators: = | | | | = | = | BETWEEN | IN
Logical operators: AND | OR | NOT
For more information on condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:rtype: dict
:return: {
'Attributes': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
},
'ItemCollectionMetrics': {
'ItemCollectionKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'SizeEstimateRangeGB': [
123.0,
]
}
}
:returns:
(string) --
"""
pass | Edits an existing item's attributes, or adds a new item to the table if it does not already exist. You can put, delete, or add attribute values. You can also perform a conditional update on an existing item (insert a new attribute name-value pair if it doesn't exist, or replace an existing name-value pair if it has certain expected attribute values).
You can also return the item's attribute values in the same UpdateItem operation using the ReturnValues parameter.
See also: AWS API Documentation
Examples
This example updates an item in the Music table. It adds a new attribute (Year) and modifies the AlbumTitle attribute. All of the attributes in the item, as they appear after the update, are returned in the response.
Expected Output:
:example: response = client.update_item(
TableName='string',
Key={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
AttributeUpdates={
'string': {
'Value': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
'Action': 'ADD'|'PUT'|'DELETE'
}
},
Expected={
'string': {
'Value': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
'Exists': True|False,
'ComparisonOperator': 'EQ'|'NE'|'IN'|'LE'|'LT'|'GE'|'GT'|'BETWEEN'|'NOT_NULL'|'NULL'|'CONTAINS'|'NOT_CONTAINS'|'BEGINS_WITH',
'AttributeValueList': [
{
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
},
]
}
},
ConditionalOperator='AND'|'OR',
ReturnValues='NONE'|'ALL_OLD'|'UPDATED_OLD'|'ALL_NEW'|'UPDATED_NEW',
ReturnConsumedCapacity='INDEXES'|'TOTAL'|'NONE',
ReturnItemCollectionMetrics='SIZE'|'NONE',
UpdateExpression='string',
ConditionExpression='string',
ExpressionAttributeNames={
'string': 'string'
},
ExpressionAttributeValues={
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
}
)
:type TableName: string
:param TableName: [REQUIRED]
The name of the table containing the item to update.
:type Key: dict
:param Key: [REQUIRED]
The primary key of the item to be updated. Each element consists of an attribute name and a value for that attribute.
For the primary key, you must provide all of the attributes. For example, with a simple primary key, you only need to provide a value for the partition key. For a composite primary key, you must provide values for both the partition key and the sort key.
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type AttributeUpdates: dict
:param AttributeUpdates: This is a legacy parameter. Use UpdateExpression instead. For more information, see AttributeUpdates in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --For the UpdateItem operation, represents the attributes to be modified, the action to perform on each, and the new value for each.
Note
You cannot use UpdateItem to update any primary key attributes. Instead, you will need to delete the item, and then use PutItem to create a new item with new attributes.
Attribute values cannot be null; string and binary type attributes must have lengths greater than zero; and set type attributes must not be empty. Requests with empty values will be rejected with a ValidationException exception.
Value (dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data TYpes in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
Action (string) --Specifies how to perform the update. Valid values are PUT (default), DELETE , and ADD . The behavior depends on whether the specified primary key already exists in the table.
If an item with the specified *Key* is found in the table:
PUT - Adds the specified attribute to the item. If the attribute already exists, it is replaced by the new value.
DELETE - If no value is specified, the attribute and its value are removed from the item. The data type of the specified value must match the existing value's data type. If a set of values is specified, then those values are subtracted from the old set. For example, if the attribute value was the set [a,b,c] and the DELETE action specified [a,c] , then the final attribute value would be [b] . Specifying an empty set is an error.
ADD - If the attribute does not already exist, then the attribute and its values are added to the item. If the attribute does exist, then the behavior of ADD depends on the data type of the attribute:
If the existing attribute is a number, and if Value is also a number, then the Value is mathematically added to the existing attribute. If Value is a negative number, then it is subtracted from the existing attribute.
Note
If you use ADD to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses 0 as the initial value. In addition, if you use ADD to update an existing item, and intend to increment or decrement an attribute value which does not yet exist, DynamoDB uses 0 as the initial value. For example, suppose that the item you want to update does not yet have an attribute named itemcount , but you decide to ADD the number 3 to this attribute anyway, even though it currently does not exist. DynamoDB will create the itemcount attribute, set its initial value to 0 , and finally add 3 to it. The result will be a new itemcount attribute in the item, with a value of 3 .
If the existing data type is a set, and if the Value is also a set, then the Value is added to the existing set. (This is a set operation, not mathematical addition.) For example, if the attribute value was the set [1,2] , and the ADD action specified [3] , then the final attribute value would be [1,2,3] . An error occurs if an Add action is specified for a set attribute and the attribute type specified does not match the existing set type. Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the Value must also be a set of strings. The same holds true for number sets and binary sets.
This action is only valid for an existing attribute whose data type is number or is a set. Do not use ADD for any other data types.
If no item with the specified *Key* is found:
PUT - DynamoDB creates a new item with the specified primary key, and then adds the attribute.
DELETE - Nothing happens; there is no attribute to delete.
ADD - DynamoDB creates an item with the supplied primary key and number (or set of numbers) for the attribute value. The only data types allowed are number and number set; no other data types can be specified.
:type Expected: dict
:param Expected: This is a legacy parameter. Use ConditionExpresssion instead. For more information, see Expected in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents a condition to be compared with an attribute value. This condition can be used with DeleteItem , PutItem or UpdateItem operations; if the comparison evaluates to true, the operation succeeds; if not, the operation fails. You can use ExpectedAttributeValue in one of two different ways:
Use AttributeValueList to specify one or more values to compare against an attribute. Use ComparisonOperator to specify how you want to perform the comparison. If the comparison evaluates to true, then the conditional operation succeeds.
Use Value to specify a value that DynamoDB will compare against an attribute. If the values match, then ExpectedAttributeValue evaluates to true and the conditional operation succeeds. Optionally, you can also set Exists to false, indicating that you do not expect to find the attribute value in the table. In this case, the conditional operation succeeds only if the comparison evaluates to false.
Value and Exists are incompatible with AttributeValueList and ComparisonOperator . Note that if you use both sets of parameters at once, DynamoDB will return a ValidationException exception.
Value (dict) --Represents the data for the expected attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
Exists (boolean) --Causes DynamoDB to evaluate the value before attempting a conditional operation:
If Exists is true , DynamoDB will check to see if that attribute value already exists in the table. If it is found, then the operation succeeds. If it is not found, the operation fails with a ConditionalCheckFailedException .
If Exists is false , DynamoDB assumes that the attribute value does not exist in the table. If in fact the value does not exist, then the assumption is valid and the operation succeeds. If the value is found, despite the assumption that it does not exist, the operation fails with a ConditionalCheckFailedException .
The default setting for Exists is true . If you supply a Value all by itself, DynamoDB assumes the attribute exists: You don't have to set Exists to true , because it is implied.
DynamoDB returns a ValidationException if:
Exists is true but there is no Value to check. (You expect a value to exist, but don't specify what that value is.)
Exists is false but you also provide a Value . (You cannot expect an attribute to have a value, while also expecting it not to exist.)
ComparisonOperator (string) --A comparator for evaluating attributes in the AttributeValueList . For example, equals, greater than, less than, etc.
The following comparison operators are available:
EQ | NE | LE | LT | GE | GT | NOT_NULL | NULL | CONTAINS | NOT_CONTAINS | BEGINS_WITH | IN | BETWEEN
The following are descriptions of each comparison operator.
EQ : Equal. EQ is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue element of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
NE : Not equal. NE is supported for all data types, including lists and maps. AttributeValueList can contain only one AttributeValue of type String, Number, Binary, String Set, Number Set, or Binary Set. If an item contains an AttributeValue of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not equal {'NS':['6', '2', '1']} .
LE : Less than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
LT : Less than. AttributeValueList can contain only one AttributeValue of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GE : Greater than or equal. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
GT : Greater than. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not equal {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']} .
NOT_NULL : The attribute exists. NOT_NULL is supported for all data types, including lists and maps.
Note
This operator tests for the existence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NOT_NULL , the result is a Boolean true . This result is because the attribute 'a ' exists; its data type is not relevant to the NOT_NULL comparison operator.
NULL : The attribute does not exist. NULL is supported for all data types, including lists and maps.
Note
This operator tests for the nonexistence of an attribute, not its data type. If the data type of attribute 'a ' is null, and you evaluate it using NULL , the result is a Boolean false . This is because the attribute 'a ' exists; its data type is not relevant to the NULL comparison operator.
CONTAINS : Checks for a subsequence, or value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is of type String, then the operator checks for a substring match. If the target attribute of the comparison is of type Binary, then the operator looks for a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it finds an exact match with any member of the set. CONTAINS is supported for lists: When evaluating 'a CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
NOT_CONTAINS : Checks for absence of a subsequence, or absence of a value in a set. AttributeValueList can contain only one AttributeValue element of type String, Number, or Binary (not a set type). If the target attribute of the comparison is a String, then the operator checks for the absence of a substring match. If the target attribute of the comparison is Binary, then the operator checks for the absence of a subsequence of the target that matches the input. If the target attribute of the comparison is a set ('SS ', 'NS ', or 'BS '), then the operator evaluates to true if it does not find an exact match with any member of the set. NOT_CONTAINS is supported for lists: When evaluating 'a NOT CONTAINS b ', 'a ' can be a list; however, 'b ' cannot be a set, a map, or a list.
BEGINS_WITH : Checks for a prefix. AttributeValueList can contain only one AttributeValue of type String or Binary (not a Number or a set type). The target attribute of the comparison must be of type String or Binary (not a Number or a set type).
IN : Checks for matching elements in a list. AttributeValueList can contain one or more AttributeValue elements of type String, Number, or Binary. These attributes are compared against an existing attribute of an item. If any elements of the input are equal to the item attribute, the expression evaluates to true.
BETWEEN : Greater than or equal to the first value, and less than or equal to the second value. AttributeValueList must contain two AttributeValue elements of the same type, either String, Number, or Binary (not a set type). A target attribute matches if the target value is greater than, or equal to, the first element and less than, or equal to, the second element. If an item contains an AttributeValue element of a different type than the one provided in the request, the value does not match. For example, {'S':'6'} does not compare to {'N':'6'} . Also, {'N':'6'} does not compare to {'NS':['6', '2', '1']}
AttributeValueList (list) --One or more values to evaluate against the supplied attribute. The number of values in the list depends on the ComparisonOperator being used.
For type Number, value comparisons are numeric.
String value comparisons for greater than, equals, or less than are based on ASCII character code values. For example, a is greater than A , and a is greater than B . For a list of code values, see http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters .
For Binary, DynamoDB treats each byte of the binary data as unsigned when it compares binary values.
For information on specifying data types in JSON, see JSON Data Format in the Amazon DynamoDB Developer Guide .
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:type ConditionalOperator: string
:param ConditionalOperator: This is a legacy parameter. Use ConditionExpression instead. For more information, see ConditionalOperator in the Amazon DynamoDB Developer Guide .
:type ReturnValues: string
:param ReturnValues: Use ReturnValues if you want to get the item attributes as they appeared either before or after they were updated. For UpdateItem , the valid values are:
NONE - If ReturnValues is not specified, or if its value is NONE , then nothing is returned. (This setting is the default for ReturnValues .)
ALL_OLD - Returns all of the attributes of the item, as they appeared before the UpdateItem operation.
UPDATED_OLD - Returns only the updated attributes, as they appeared before the UpdateItem operation.
ALL_NEW - Returns all of the attributes of the item, as they appear after the UpdateItem operation.
UPDATED_NEW - Returns only the updated attributes, as they appear after the UpdateItem operation.
There is no additional cost associated with requesting a return value aside from the small network and processing overhead of receiving a larger response. No Read Capacity Units are consumed.
Values returned are strongly consistent
:type ReturnConsumedCapacity: string
:param ReturnConsumedCapacity: Determines the level of detail about provisioned throughput consumption that is returned in the response:
INDEXES - The response includes the aggregate ConsumedCapacity for the operation, together with ConsumedCapacity for each table and secondary index that was accessed. Note that some operations, such as GetItem and BatchGetItem , do not access any indexes at all. In these cases, specifying INDEXES will only return ConsumedCapacity information for table(s).
TOTAL - The response includes only the aggregate ConsumedCapacity for the operation.
NONE - No ConsumedCapacity details are included in the response.
:type ReturnItemCollectionMetrics: string
:param ReturnItemCollectionMetrics: Determines whether item collection metrics are returned. If set to SIZE , the response includes statistics about item collections, if any, that were modified during the operation are returned in the response. If set to NONE (the default), no statistics are returned.
:type UpdateExpression: string
:param UpdateExpression: An expression that defines one or more attributes to be updated, the action to be performed on them, and new value(s) for them.
The following action values are available for UpdateExpression .
SET - Adds one or more attributes and values to an item. If any of these attribute already exist, they are replaced by the new values. You can also use SET to add or subtract from an attribute that is of type Number. For example: SET myNum = myNum + :val SET supports the following functions:
if_not_exists (path, operand) - if the item does not contain an attribute at the specified path, then if_not_exists evaluates to operand; otherwise, it evaluates to path. You can use this function to avoid overwriting an attribute that may already be present in the item.
list_append (operand, operand) - evaluates to a list with a new element added to it. You can append the new element to the start or the end of the list by reversing the order of the operands.
These function names are case-sensitive.
REMOVE - Removes one or more attributes from an item.
ADD - Adds the specified value to the item, if the attribute does not already exist. If the attribute does exist, then the behavior of ADD depends on the data type of the attribute:
If the existing attribute is a number, and if Value is also a number, then Value is mathematically added to the existing attribute. If Value is a negative number, then it is subtracted from the existing attribute.
Note
If you use ADD to increment or decrement a number value for an item that doesn't exist before the update, DynamoDB uses 0 as the initial value. Similarly, if you use ADD for an existing item to increment or decrement an attribute value that doesn't exist before the update, DynamoDB uses 0 as the initial value. For example, suppose that the item you want to update doesn't have an attribute named itemcount , but you decide to ADD the number 3 to this attribute anyway. DynamoDB will create the itemcount attribute, set its initial value to 0 , and finally add 3 to it. The result will be a new itemcount attribute in the item, with a value of 3 .
If the existing data type is a set and if Value is also a set, then Value is added to the existing set. For example, if the attribute value is the set [1,2] , and the ADD action specified [3] , then the final attribute value is [1,2,3] . An error occurs if an ADD action is specified for a set attribute and the attribute type specified does not match the existing set type. Both sets must have the same primitive data type. For example, if the existing data type is a set of strings, the Value must also be a set of strings.
Warning
The ADD action only supports Number and set data types. In addition, ADD can only be used on top-level attributes, not nested attributes.
DELETE - Deletes an element from a set. If a set of values is specified, then those values are subtracted from the old set. For example, if the attribute value was the set [a,b,c] and the DELETE action specifies [a,c] , then the final attribute value is [b] . Specifying an empty set is an error.
Warning
The DELETE action only supports set data types. In addition, DELETE can only be used on top-level attributes, not nested attributes.
You can have many actions in a single expression, such as the following: SET a=:value1, b=:value2 DELETE :value3, :value4, :value5
For more information on update expressions, see Modifying Items and Attributes in the Amazon DynamoDB Developer Guide .
:type ConditionExpression: string
:param ConditionExpression: A condition that must be satisfied in order for a conditional update to succeed.
An expression can contain any of the following:
Functions: attribute_exists | attribute_not_exists | attribute_type | contains | begins_with | size These function names are case-sensitive.
Comparison operators: = | | | | = | = | BETWEEN | IN
Logical operators: AND | OR | NOT
For more information on condition expressions, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
:type ExpressionAttributeNames: dict
:param ExpressionAttributeNames: One or more substitution tokens for attribute names in an expression. The following are some use cases for using ExpressionAttributeNames :
To access an attribute whose name conflicts with a DynamoDB reserved word.
To create a placeholder for repeating occurrences of an attribute name in an expression.
To prevent special characters in an attribute name from being misinterpreted in an expression.
Use the # character in an expression to dereference an attribute name. For example, consider the following attribute name:
Percentile
The name of this attribute conflicts with a reserved word, so it cannot be used directly in an expression. (For the complete list of reserved words, see Reserved Words in the Amazon DynamoDB Developer Guide ). To work around this, you could specify the following for ExpressionAttributeNames :
{'#P':'Percentile'}
You could then use this substitution in an expression, as in this example:
#P = :val
Note
Tokens that begin with the : character are expression attribute values , which are placeholders for the actual value at runtime.
For more information on expression attribute names, see Accessing Item Attributes in the Amazon DynamoDB Developer Guide .
(string) --
(string) --
:type ExpressionAttributeValues: dict
:param ExpressionAttributeValues: One or more values that can be substituted in an expression.
Use the : (colon) character in an expression to dereference an attribute value. For example, suppose that you wanted to check whether the value of the ProductStatus attribute was one of the following:
Available | Backordered | Discontinued
You would first need to specify ExpressionAttributeValues as follows:
{ ':avail':{'S':'Available'}, ':back':{'S':'Backordered'}, ':disc':{'S':'Discontinued'} }
You could then use these values in an expression, such as this:
ProductStatus IN (:avail, :back, :disc)
For more information on expression attribute values, see Specifying Conditions in the Amazon DynamoDB Developer Guide .
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
S (string) --An attribute of type String. For example:
'S': 'Hello'
N (string) --An attribute of type Number. For example:
'N': '123.45'
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
B (bytes) --An attribute of type Binary. For example:
'B': 'dGhpcyB0ZXh0IGlzIGJhc2U2NC1lbmNvZGVk'
SS (list) --An attribute of type String Set. For example:
'SS': ['Giraffe', 'Hippo' ,'Zebra']
(string) --
NS (list) --An attribute of type Number Set. For example:
'NS': ['42.2', '-19', '7.5', '3.14']
Numbers are sent across the network to DynamoDB as strings, to maximize compatibility across languages and libraries. However, DynamoDB treats them as number type attributes for mathematical operations.
(string) --
BS (list) --An attribute of type Binary Set. For example:
'BS': ['U3Vubnk=', 'UmFpbnk=', 'U25vd3k=']
(bytes) --
M (dict) --An attribute of type Map. For example:
'M': {'Name': {'S': 'Joe'}, 'Age': {'N': '35'}}
(string) --
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
L (list) --An attribute of type List. For example:
'L': ['Cookies', 'Coffee', 3.14159]
(dict) --Represents the data for an attribute.
Each attribute value is described as a name-value pair. The name is the data type, and the value is the data itself.
For more information, see Data Types in the Amazon DynamoDB Developer Guide .
NULL (boolean) --An attribute of type Null. For example:
'NULL': true
BOOL (boolean) --An attribute of type Boolean. For example:
'BOOL': true
:rtype: dict
:return: {
'Attributes': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'ConsumedCapacity': {
'TableName': 'string',
'CapacityUnits': 123.0,
'Table': {
'CapacityUnits': 123.0
},
'LocalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
},
'GlobalSecondaryIndexes': {
'string': {
'CapacityUnits': 123.0
}
}
},
'ItemCollectionMetrics': {
'ItemCollectionKey': {
'string': {
'S': 'string',
'N': 'string',
'B': b'bytes',
'SS': [
'string',
],
'NS': [
'string',
],
'BS': [
b'bytes',
],
'M': {
'string': {'... recursive ...'}
},
'L': [
{'... recursive ...'},
],
'NULL': True|False,
'BOOL': True|False
}
},
'SizeEstimateRangeGB': [
123.0,
]
}
}
:returns:
(string) -- | entailment |
def create_service(cluster=None, serviceName=None, taskDefinition=None, loadBalancers=None, desiredCount=None, clientToken=None, role=None, deploymentConfiguration=None, placementConstraints=None, placementStrategy=None):
"""
Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount , Amazon ECS spawns another copy of the task in the specified cluster. To update an existing service, see UpdateService .
In addition to maintaining the desired count of tasks in your service, you can optionally run your service behind a load balancer. The load balancer distributes traffic across the tasks that are associated with the service. For more information, see Service Load Balancing in the Amazon EC2 Container Service Developer Guide .
You can optionally specify a deployment configuration for your service. During a deployment (which is triggered by changing the task definition or the desired count of a service with an UpdateService operation), the service scheduler uses the minimumHealthyPercent and maximumPercent parameters to determine the deployment strategy.
The minimumHealthyPercent represents a lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desiredCount (rounded up to the nearest integer). This parameter enables you to deploy without using additional cluster capacity. For example, if your service has a desiredCount of four tasks and a minimumHealthyPercent of 50%, the scheduler can stop two existing tasks to free up cluster capacity before starting two new tasks. Tasks for services that do not use a load balancer are considered healthy if they are in the RUNNING state. Tasks for services that do use a load balancer are considered healthy if they are in the RUNNING state and the container instance they are hosted on is reported as healthy by the load balancer. The default value for minimumHealthyPercent is 50% in the console and 100% for the AWS CLI, the AWS SDKs, and the APIs.
The maximumPercent parameter represents an upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount (rounded down to the nearest integer). This parameter enables you to define the deployment batch size. For example, if your service has a desiredCount of four tasks and a maximumPercent value of 200%, the scheduler can start four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available). The default value for maximumPercent is 200%.
When the service scheduler launches new tasks, it determines task placement in your cluster using the following logic:
See also: AWS API Documentation
Examples
This example creates a service in your default region called ecs-simple-service. The service uses the hello_world task definition and it maintains 10 copies of that task.
Expected Output:
This example creates a service in your default region called ecs-simple-service-elb. The service uses the ecs-demo task definition and it maintains 10 copies of that task. You must reference an existing load balancer in the same region by its name.
Expected Output:
:example: response = client.create_service(
cluster='string',
serviceName='string',
taskDefinition='string',
loadBalancers=[
{
'targetGroupArn': 'string',
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
desiredCount=123,
clientToken='string',
role='string',
deploymentConfiguration={
'maximumPercent': 123,
'minimumHealthyPercent': 123
},
placementConstraints=[
{
'type': 'distinctInstance'|'memberOf',
'expression': 'string'
},
],
placementStrategy=[
{
'type': 'random'|'spread'|'binpack',
'field': 'string'
},
]
)
:type cluster: string
:param cluster: The short name or full Amazon Resource Name (ARN) of the cluster on which to run your service. If you do not specify a cluster, the default cluster is assumed.
:type serviceName: string
:param serviceName: [REQUIRED]
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.
:type taskDefinition: string
:param taskDefinition: [REQUIRED]
The family and revision (family:revision ) or full Amazon Resource Name (ARN) of the task definition to run in your service. If a revision is not specified, the latest ACTIVE revision is used.
:type loadBalancers: list
:param loadBalancers: A load balancer object representing the load balancer to use with your service. Currently, you are limited to one load balancer or target group per service. After you create a service, the load balancer name or target group ARN, container name, and container port specified in the service definition are immutable.
For Elastic Load Balancing Classic load balancers, this object must contain the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance is registered with the load balancer specified here.
For Elastic Load Balancing Application load balancers, this object must contain the load balancer target group ARN, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance and port combination is registered as a target in the target group specified here.
(dict) --Details on a load balancer that is used with a service.
targetGroupArn (string) --The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group associated with a service.
loadBalancerName (string) --The name of a Classic load balancer.
containerName (string) --The name of the container (as it appears in a container definition) to associate with the load balancer.
containerPort (integer) --The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.
:type desiredCount: integer
:param desiredCount: [REQUIRED]
The number of instantiations of the specified task definition to place and keep running on your cluster.
:type clientToken: string
:param clientToken: Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 32 ASCII characters are allowed.
:type role: string
:param role: The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is required if you are using a load balancer with your service. If you specify the role parameter, you must also specify a load balancer object with the loadBalancers parameter.
If your specified role has a path other than / , then you must either specify the full role ARN (this is recommended) or prefix the role name with the path. For example, if a role with the name bar has a path of /foo/ then you would specify /foo/bar as the role name. For more information, see Friendly Names and Paths in the IAM User Guide .
:type deploymentConfiguration: dict
:param deploymentConfiguration: Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.
maximumPercent (integer) --The upper limit (as a percentage of the service's desiredCount ) of the number of tasks that are allowed in the RUNNING or PENDING state in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by maximumPercent /100, rounded down to the nearest integer value.
minimumHealthyPercent (integer) --The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain in the RUNNING state in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by minimumHealthyPercent /100, rounded up to the nearest integer value.
:type placementConstraints: list
:param placementConstraints: An array of placement constraint objects to use for tasks in your service. You can specify a maximum of 10 constraints per task (this limit includes constraints in the task definition and those specified at run time).
(dict) --An object representing a constraint on task placement. For more information, see Task Placement Constraints in the Amazon EC2 Container Service Developer Guide .
type (string) --The type of constraint. Use distinctInstance to ensure that each task in a particular group is running on a different container instance. Use memberOf to restrict selection to a group of valid candidates. Note that distinctInstance is not supported in task definitions.
expression (string) --A cluster query language expression to apply to the constraint. Note you cannot specify an expression if the constraint type is distinctInstance . For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide .
:type placementStrategy: list
:param placementStrategy: The placement strategy objects to use for tasks in your service. You can specify a maximum of 5 strategy rules per service.
(dict) --The task placement strategy for a task or service. For more information, see Task Placement Strategies in the Amazon EC2 Container Service Developer Guide .
type (string) --The type of placement strategy. The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).
field (string) --The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host , which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone . For the binpack placement strategy, valid values are cpu and memory . For the random placement strategy, this field is not used.
:rtype: dict
:return: {
'service': {
'serviceArn': 'string',
'serviceName': 'string',
'clusterArn': 'string',
'loadBalancers': [
{
'targetGroupArn': 'string',
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
'status': 'string',
'desiredCount': 123,
'runningCount': 123,
'pendingCount': 123,
'taskDefinition': 'string',
'deploymentConfiguration': {
'maximumPercent': 123,
'minimumHealthyPercent': 123
},
'deployments': [
{
'id': 'string',
'status': 'string',
'taskDefinition': 'string',
'desiredCount': 123,
'pendingCount': 123,
'runningCount': 123,
'createdAt': datetime(2015, 1, 1),
'updatedAt': datetime(2015, 1, 1)
},
],
'roleArn': 'string',
'events': [
{
'id': 'string',
'createdAt': datetime(2015, 1, 1),
'message': 'string'
},
],
'createdAt': datetime(2015, 1, 1),
'placementConstraints': [
{
'type': 'distinctInstance'|'memberOf',
'expression': 'string'
},
],
'placementStrategy': [
{
'type': 'random'|'spread'|'binpack',
'field': 'string'
},
]
}
}
:returns:
cluster (string) -- The short name or full Amazon Resource Name (ARN) of the cluster on which to run your service. If you do not specify a cluster, the default cluster is assumed.
serviceName (string) -- [REQUIRED]
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.
taskDefinition (string) -- [REQUIRED]
The family and revision (family:revision ) or full Amazon Resource Name (ARN) of the task definition to run in your service. If a revision is not specified, the latest ACTIVE revision is used.
loadBalancers (list) -- A load balancer object representing the load balancer to use with your service. Currently, you are limited to one load balancer or target group per service. After you create a service, the load balancer name or target group ARN, container name, and container port specified in the service definition are immutable.
For Elastic Load Balancing Classic load balancers, this object must contain the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance is registered with the load balancer specified here.
For Elastic Load Balancing Application load balancers, this object must contain the load balancer target group ARN, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance and port combination is registered as a target in the target group specified here.
(dict) --Details on a load balancer that is used with a service.
targetGroupArn (string) --The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group associated with a service.
loadBalancerName (string) --The name of a Classic load balancer.
containerName (string) --The name of the container (as it appears in a container definition) to associate with the load balancer.
containerPort (integer) --The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.
desiredCount (integer) -- [REQUIRED]
The number of instantiations of the specified task definition to place and keep running on your cluster.
clientToken (string) -- Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 32 ASCII characters are allowed.
role (string) -- The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is required if you are using a load balancer with your service. If you specify the role parameter, you must also specify a load balancer object with the loadBalancers parameter.
If your specified role has a path other than / , then you must either specify the full role ARN (this is recommended) or prefix the role name with the path. For example, if a role with the name bar has a path of /foo/ then you would specify /foo/bar as the role name. For more information, see Friendly Names and Paths in the IAM User Guide .
deploymentConfiguration (dict) -- Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.
maximumPercent (integer) --The upper limit (as a percentage of the service's desiredCount ) of the number of tasks that are allowed in the RUNNING or PENDING state in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by maximumPercent /100, rounded down to the nearest integer value.
minimumHealthyPercent (integer) --The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain in the RUNNING state in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by minimumHealthyPercent /100, rounded up to the nearest integer value.
placementConstraints (list) -- An array of placement constraint objects to use for tasks in your service. You can specify a maximum of 10 constraints per task (this limit includes constraints in the task definition and those specified at run time).
(dict) --An object representing a constraint on task placement. For more information, see Task Placement Constraints in the Amazon EC2 Container Service Developer Guide .
type (string) --The type of constraint. Use distinctInstance to ensure that each task in a particular group is running on a different container instance. Use memberOf to restrict selection to a group of valid candidates. Note that distinctInstance is not supported in task definitions.
expression (string) --A cluster query language expression to apply to the constraint. Note you cannot specify an expression if the constraint type is distinctInstance . For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide .
placementStrategy (list) -- The placement strategy objects to use for tasks in your service. You can specify a maximum of 5 strategy rules per service.
(dict) --The task placement strategy for a task or service. For more information, see Task Placement Strategies in the Amazon EC2 Container Service Developer Guide .
type (string) --The type of placement strategy. The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).
field (string) --The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host , which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone . For the binpack placement strategy, valid values are cpu and memory . For the random placement strategy, this field is not used.
"""
pass | Runs and maintains a desired number of tasks from a specified task definition. If the number of tasks running in a service drops below desiredCount , Amazon ECS spawns another copy of the task in the specified cluster. To update an existing service, see UpdateService .
In addition to maintaining the desired count of tasks in your service, you can optionally run your service behind a load balancer. The load balancer distributes traffic across the tasks that are associated with the service. For more information, see Service Load Balancing in the Amazon EC2 Container Service Developer Guide .
You can optionally specify a deployment configuration for your service. During a deployment (which is triggered by changing the task definition or the desired count of a service with an UpdateService operation), the service scheduler uses the minimumHealthyPercent and maximumPercent parameters to determine the deployment strategy.
The minimumHealthyPercent represents a lower limit on the number of your service's tasks that must remain in the RUNNING state during a deployment, as a percentage of the desiredCount (rounded up to the nearest integer). This parameter enables you to deploy without using additional cluster capacity. For example, if your service has a desiredCount of four tasks and a minimumHealthyPercent of 50%, the scheduler can stop two existing tasks to free up cluster capacity before starting two new tasks. Tasks for services that do not use a load balancer are considered healthy if they are in the RUNNING state. Tasks for services that do use a load balancer are considered healthy if they are in the RUNNING state and the container instance they are hosted on is reported as healthy by the load balancer. The default value for minimumHealthyPercent is 50% in the console and 100% for the AWS CLI, the AWS SDKs, and the APIs.
The maximumPercent parameter represents an upper limit on the number of your service's tasks that are allowed in the RUNNING or PENDING state during a deployment, as a percentage of the desiredCount (rounded down to the nearest integer). This parameter enables you to define the deployment batch size. For example, if your service has a desiredCount of four tasks and a maximumPercent value of 200%, the scheduler can start four new tasks before stopping the four older tasks (provided that the cluster resources required to do this are available). The default value for maximumPercent is 200%.
When the service scheduler launches new tasks, it determines task placement in your cluster using the following logic:
See also: AWS API Documentation
Examples
This example creates a service in your default region called ecs-simple-service. The service uses the hello_world task definition and it maintains 10 copies of that task.
Expected Output:
This example creates a service in your default region called ecs-simple-service-elb. The service uses the ecs-demo task definition and it maintains 10 copies of that task. You must reference an existing load balancer in the same region by its name.
Expected Output:
:example: response = client.create_service(
cluster='string',
serviceName='string',
taskDefinition='string',
loadBalancers=[
{
'targetGroupArn': 'string',
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
desiredCount=123,
clientToken='string',
role='string',
deploymentConfiguration={
'maximumPercent': 123,
'minimumHealthyPercent': 123
},
placementConstraints=[
{
'type': 'distinctInstance'|'memberOf',
'expression': 'string'
},
],
placementStrategy=[
{
'type': 'random'|'spread'|'binpack',
'field': 'string'
},
]
)
:type cluster: string
:param cluster: The short name or full Amazon Resource Name (ARN) of the cluster on which to run your service. If you do not specify a cluster, the default cluster is assumed.
:type serviceName: string
:param serviceName: [REQUIRED]
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.
:type taskDefinition: string
:param taskDefinition: [REQUIRED]
The family and revision (family:revision ) or full Amazon Resource Name (ARN) of the task definition to run in your service. If a revision is not specified, the latest ACTIVE revision is used.
:type loadBalancers: list
:param loadBalancers: A load balancer object representing the load balancer to use with your service. Currently, you are limited to one load balancer or target group per service. After you create a service, the load balancer name or target group ARN, container name, and container port specified in the service definition are immutable.
For Elastic Load Balancing Classic load balancers, this object must contain the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance is registered with the load balancer specified here.
For Elastic Load Balancing Application load balancers, this object must contain the load balancer target group ARN, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance and port combination is registered as a target in the target group specified here.
(dict) --Details on a load balancer that is used with a service.
targetGroupArn (string) --The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group associated with a service.
loadBalancerName (string) --The name of a Classic load balancer.
containerName (string) --The name of the container (as it appears in a container definition) to associate with the load balancer.
containerPort (integer) --The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.
:type desiredCount: integer
:param desiredCount: [REQUIRED]
The number of instantiations of the specified task definition to place and keep running on your cluster.
:type clientToken: string
:param clientToken: Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 32 ASCII characters are allowed.
:type role: string
:param role: The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is required if you are using a load balancer with your service. If you specify the role parameter, you must also specify a load balancer object with the loadBalancers parameter.
If your specified role has a path other than / , then you must either specify the full role ARN (this is recommended) or prefix the role name with the path. For example, if a role with the name bar has a path of /foo/ then you would specify /foo/bar as the role name. For more information, see Friendly Names and Paths in the IAM User Guide .
:type deploymentConfiguration: dict
:param deploymentConfiguration: Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.
maximumPercent (integer) --The upper limit (as a percentage of the service's desiredCount ) of the number of tasks that are allowed in the RUNNING or PENDING state in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by maximumPercent /100, rounded down to the nearest integer value.
minimumHealthyPercent (integer) --The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain in the RUNNING state in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by minimumHealthyPercent /100, rounded up to the nearest integer value.
:type placementConstraints: list
:param placementConstraints: An array of placement constraint objects to use for tasks in your service. You can specify a maximum of 10 constraints per task (this limit includes constraints in the task definition and those specified at run time).
(dict) --An object representing a constraint on task placement. For more information, see Task Placement Constraints in the Amazon EC2 Container Service Developer Guide .
type (string) --The type of constraint. Use distinctInstance to ensure that each task in a particular group is running on a different container instance. Use memberOf to restrict selection to a group of valid candidates. Note that distinctInstance is not supported in task definitions.
expression (string) --A cluster query language expression to apply to the constraint. Note you cannot specify an expression if the constraint type is distinctInstance . For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide .
:type placementStrategy: list
:param placementStrategy: The placement strategy objects to use for tasks in your service. You can specify a maximum of 5 strategy rules per service.
(dict) --The task placement strategy for a task or service. For more information, see Task Placement Strategies in the Amazon EC2 Container Service Developer Guide .
type (string) --The type of placement strategy. The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).
field (string) --The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host , which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone . For the binpack placement strategy, valid values are cpu and memory . For the random placement strategy, this field is not used.
:rtype: dict
:return: {
'service': {
'serviceArn': 'string',
'serviceName': 'string',
'clusterArn': 'string',
'loadBalancers': [
{
'targetGroupArn': 'string',
'loadBalancerName': 'string',
'containerName': 'string',
'containerPort': 123
},
],
'status': 'string',
'desiredCount': 123,
'runningCount': 123,
'pendingCount': 123,
'taskDefinition': 'string',
'deploymentConfiguration': {
'maximumPercent': 123,
'minimumHealthyPercent': 123
},
'deployments': [
{
'id': 'string',
'status': 'string',
'taskDefinition': 'string',
'desiredCount': 123,
'pendingCount': 123,
'runningCount': 123,
'createdAt': datetime(2015, 1, 1),
'updatedAt': datetime(2015, 1, 1)
},
],
'roleArn': 'string',
'events': [
{
'id': 'string',
'createdAt': datetime(2015, 1, 1),
'message': 'string'
},
],
'createdAt': datetime(2015, 1, 1),
'placementConstraints': [
{
'type': 'distinctInstance'|'memberOf',
'expression': 'string'
},
],
'placementStrategy': [
{
'type': 'random'|'spread'|'binpack',
'field': 'string'
},
]
}
}
:returns:
cluster (string) -- The short name or full Amazon Resource Name (ARN) of the cluster on which to run your service. If you do not specify a cluster, the default cluster is assumed.
serviceName (string) -- [REQUIRED]
The name of your service. Up to 255 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed. Service names must be unique within a cluster, but you can have similarly named services in multiple clusters within a region or across multiple regions.
taskDefinition (string) -- [REQUIRED]
The family and revision (family:revision ) or full Amazon Resource Name (ARN) of the task definition to run in your service. If a revision is not specified, the latest ACTIVE revision is used.
loadBalancers (list) -- A load balancer object representing the load balancer to use with your service. Currently, you are limited to one load balancer or target group per service. After you create a service, the load balancer name or target group ARN, container name, and container port specified in the service definition are immutable.
For Elastic Load Balancing Classic load balancers, this object must contain the load balancer name, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance is registered with the load balancer specified here.
For Elastic Load Balancing Application load balancers, this object must contain the load balancer target group ARN, the container name (as it appears in a container definition), and the container port to access from the load balancer. When a task from this service is placed on a container instance, the container instance and port combination is registered as a target in the target group specified here.
(dict) --Details on a load balancer that is used with a service.
targetGroupArn (string) --The full Amazon Resource Name (ARN) of the Elastic Load Balancing target group associated with a service.
loadBalancerName (string) --The name of a Classic load balancer.
containerName (string) --The name of the container (as it appears in a container definition) to associate with the load balancer.
containerPort (integer) --The port on the container to associate with the load balancer. This port must correspond to a containerPort in the service's task definition. Your container instances must allow ingress traffic on the hostPort of the port mapping.
desiredCount (integer) -- [REQUIRED]
The number of instantiations of the specified task definition to place and keep running on your cluster.
clientToken (string) -- Unique, case-sensitive identifier you provide to ensure the idempotency of the request. Up to 32 ASCII characters are allowed.
role (string) -- The name or full Amazon Resource Name (ARN) of the IAM role that allows Amazon ECS to make calls to your load balancer on your behalf. This parameter is required if you are using a load balancer with your service. If you specify the role parameter, you must also specify a load balancer object with the loadBalancers parameter.
If your specified role has a path other than / , then you must either specify the full role ARN (this is recommended) or prefix the role name with the path. For example, if a role with the name bar has a path of /foo/ then you would specify /foo/bar as the role name. For more information, see Friendly Names and Paths in the IAM User Guide .
deploymentConfiguration (dict) -- Optional deployment parameters that control how many tasks run during the deployment and the ordering of stopping and starting tasks.
maximumPercent (integer) --The upper limit (as a percentage of the service's desiredCount ) of the number of tasks that are allowed in the RUNNING or PENDING state in a service during a deployment. The maximum number of tasks during a deployment is the desiredCount multiplied by maximumPercent /100, rounded down to the nearest integer value.
minimumHealthyPercent (integer) --The lower limit (as a percentage of the service's desiredCount ) of the number of running tasks that must remain in the RUNNING state in a service during a deployment. The minimum healthy tasks during a deployment is the desiredCount multiplied by minimumHealthyPercent /100, rounded up to the nearest integer value.
placementConstraints (list) -- An array of placement constraint objects to use for tasks in your service. You can specify a maximum of 10 constraints per task (this limit includes constraints in the task definition and those specified at run time).
(dict) --An object representing a constraint on task placement. For more information, see Task Placement Constraints in the Amazon EC2 Container Service Developer Guide .
type (string) --The type of constraint. Use distinctInstance to ensure that each task in a particular group is running on a different container instance. Use memberOf to restrict selection to a group of valid candidates. Note that distinctInstance is not supported in task definitions.
expression (string) --A cluster query language expression to apply to the constraint. Note you cannot specify an expression if the constraint type is distinctInstance . For more information, see Cluster Query Language in the Amazon EC2 Container Service Developer Guide .
placementStrategy (list) -- The placement strategy objects to use for tasks in your service. You can specify a maximum of 5 strategy rules per service.
(dict) --The task placement strategy for a task or service. For more information, see Task Placement Strategies in the Amazon EC2 Container Service Developer Guide .
type (string) --The type of placement strategy. The random placement strategy randomly places tasks on available candidates. The spread placement strategy spreads placement across available candidates evenly based on the field parameter. The binpack strategy places tasks on available candidates that have the least available amount of the resource that is specified with the field parameter. For example, if you binpack on memory, a task is placed on the instance with the least amount of remaining memory (but still enough to run the task).
field (string) --The field to apply the placement strategy against. For the spread placement strategy, valid values are instanceId (or host , which has the same effect), or any platform or custom attribute that is applied to a container instance, such as attribute:ecs.availability-zone . For the binpack placement strategy, valid values are cpu and memory . For the random placement strategy, this field is not used. | entailment |
def register_domain(DomainName=None, IdnLangCode=None, DurationInYears=None, AutoRenew=None, AdminContact=None, RegistrantContact=None, TechContact=None, PrivacyProtectAdminContact=None, PrivacyProtectRegistrantContact=None, PrivacyProtectTechContact=None):
"""
This operation registers a domain. Domains are registered by the AWS registrar partner, Gandi. For some top-level domains (TLDs), this operation requires extra parameters.
When you register a domain, Amazon Route 53 does the following:
See also: AWS API Documentation
:example: response = client.register_domain(
DomainName='string',
IdnLangCode='string',
DurationInYears=123,
AutoRenew=True|False,
AdminContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
RegistrantContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
TechContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
PrivacyProtectAdminContact=True|False,
PrivacyProtectRegistrantContact=True|False,
PrivacyProtectTechContact=True|False
)
:type DomainName: string
:param DomainName: [REQUIRED]
The domain name that you want to register.
Constraints: The domain name can contain only the letters a through z, the numbers 0 through 9, and hyphen (-). Internationalized Domain Names are not supported.
:type IdnLangCode: string
:param IdnLangCode: Reserved for future use.
:type DurationInYears: integer
:param DurationInYears: [REQUIRED]
The number of years that you want to register the domain for. Domains are registered for a minimum of one year. The maximum period depends on the top-level domain. For the range of valid values for your domain, see Domains that You Can Register with Amazon Route 53 in the Amazon Route 53 Developer Guide .
Default: 1
:type AutoRenew: boolean
:param AutoRenew: Indicates whether the domain will be automatically renewed (true ) or not (false ). Autorenewal only takes effect after the account is charged.
Default: true
:type AdminContact: dict
:param AdminContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type RegistrantContact: dict
:param RegistrantContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type TechContact: dict
:param TechContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type PrivacyProtectAdminContact: boolean
:param PrivacyProtectAdminContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:type PrivacyProtectRegistrantContact: boolean
:param PrivacyProtectRegistrantContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:type PrivacyProtectTechContact: boolean
:param PrivacyProtectTechContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:rtype: dict
:return: {
'OperationId': 'string'
}
:returns:
DomainName (string) -- [REQUIRED]
The domain name that you want to register.
Constraints: The domain name can contain only the letters a through z, the numbers 0 through 9, and hyphen (-). Internationalized Domain Names are not supported.
IdnLangCode (string) -- Reserved for future use.
DurationInYears (integer) -- [REQUIRED]
The number of years that you want to register the domain for. Domains are registered for a minimum of one year. The maximum period depends on the top-level domain. For the range of valid values for your domain, see Domains that You Can Register with Amazon Route 53 in the Amazon Route 53 Developer Guide .
Default: 1
AutoRenew (boolean) -- Indicates whether the domain will be automatically renewed (true ) or not (false ). Autorenewal only takes effect after the account is charged.
Default: true
AdminContact (dict) -- [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
RegistrantContact (dict) -- [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
TechContact (dict) -- [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
PrivacyProtectAdminContact (boolean) -- Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
PrivacyProtectRegistrantContact (boolean) -- Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
PrivacyProtectTechContact (boolean) -- Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
"""
pass | This operation registers a domain. Domains are registered by the AWS registrar partner, Gandi. For some top-level domains (TLDs), this operation requires extra parameters.
When you register a domain, Amazon Route 53 does the following:
See also: AWS API Documentation
:example: response = client.register_domain(
DomainName='string',
IdnLangCode='string',
DurationInYears=123,
AutoRenew=True|False,
AdminContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
RegistrantContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
TechContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
PrivacyProtectAdminContact=True|False,
PrivacyProtectRegistrantContact=True|False,
PrivacyProtectTechContact=True|False
)
:type DomainName: string
:param DomainName: [REQUIRED]
The domain name that you want to register.
Constraints: The domain name can contain only the letters a through z, the numbers 0 through 9, and hyphen (-). Internationalized Domain Names are not supported.
:type IdnLangCode: string
:param IdnLangCode: Reserved for future use.
:type DurationInYears: integer
:param DurationInYears: [REQUIRED]
The number of years that you want to register the domain for. Domains are registered for a minimum of one year. The maximum period depends on the top-level domain. For the range of valid values for your domain, see Domains that You Can Register with Amazon Route 53 in the Amazon Route 53 Developer Guide .
Default: 1
:type AutoRenew: boolean
:param AutoRenew: Indicates whether the domain will be automatically renewed (true ) or not (false ). Autorenewal only takes effect after the account is charged.
Default: true
:type AdminContact: dict
:param AdminContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type RegistrantContact: dict
:param RegistrantContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type TechContact: dict
:param TechContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type PrivacyProtectAdminContact: boolean
:param PrivacyProtectAdminContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:type PrivacyProtectRegistrantContact: boolean
:param PrivacyProtectRegistrantContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:type PrivacyProtectTechContact: boolean
:param PrivacyProtectTechContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:rtype: dict
:return: {
'OperationId': 'string'
}
:returns:
DomainName (string) -- [REQUIRED]
The domain name that you want to register.
Constraints: The domain name can contain only the letters a through z, the numbers 0 through 9, and hyphen (-). Internationalized Domain Names are not supported.
IdnLangCode (string) -- Reserved for future use.
DurationInYears (integer) -- [REQUIRED]
The number of years that you want to register the domain for. Domains are registered for a minimum of one year. The maximum period depends on the top-level domain. For the range of valid values for your domain, see Domains that You Can Register with Amazon Route 53 in the Amazon Route 53 Developer Guide .
Default: 1
AutoRenew (boolean) -- Indicates whether the domain will be automatically renewed (true ) or not (false ). Autorenewal only takes effect after the account is charged.
Default: true
AdminContact (dict) -- [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
RegistrantContact (dict) -- [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
TechContact (dict) -- [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format "+[country dialing code].[number including any area code]". For example, a US phone number might appear as "+1.1234567890" .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
PrivacyProtectAdminContact (boolean) -- Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
PrivacyProtectRegistrantContact (boolean) -- Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
PrivacyProtectTechContact (boolean) -- Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ("who is") queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true | entailment |
def transfer_domain(DomainName=None, IdnLangCode=None, DurationInYears=None, Nameservers=None, AuthCode=None, AutoRenew=None, AdminContact=None, RegistrantContact=None, TechContact=None, PrivacyProtectAdminContact=None, PrivacyProtectRegistrantContact=None, PrivacyProtectTechContact=None):
"""
This operation transfers a domain from another registrar to Amazon Route 53. When the transfer is complete, the domain is registered with the AWS registrar partner, Gandi.
For transfer requirements, a detailed procedure, and information about viewing the status of a domain transfer, see Transferring Registration for a Domain to Amazon Route 53 in the Amazon Route 53 Developer Guide .
If the registrar for your domain is also the DNS service provider for the domain, we highly recommend that you consider transferring your DNS service to Amazon Route 53 or to another DNS service provider before you transfer your registration. Some registrars provide free DNS service when you purchase a domain registration. When you transfer the registration, the previous registrar will not renew your domain registration and could end your DNS service at any time.
If the transfer is successful, this method returns an operation ID that you can use to track the progress and completion of the action. If the transfer doesn't complete successfully, the domain registrant will be notified by email.
See also: AWS API Documentation
:example: response = client.transfer_domain(
DomainName='string',
IdnLangCode='string',
DurationInYears=123,
Nameservers=[
{
'Name': 'string',
'GlueIps': [
'string',
]
},
],
AuthCode='string',
AutoRenew=True|False,
AdminContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
RegistrantContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
TechContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
PrivacyProtectAdminContact=True|False,
PrivacyProtectRegistrantContact=True|False,
PrivacyProtectTechContact=True|False
)
:type DomainName: string
:param DomainName: [REQUIRED]
The name of the domain that you want to transfer to Amazon Route 53.
Constraints: The domain name can contain only the letters a through z, the numbers 0 through 9, and hyphen (-). Internationalized Domain Names are not supported.
:type IdnLangCode: string
:param IdnLangCode: Reserved for future use.
:type DurationInYears: integer
:param DurationInYears: [REQUIRED]
The number of years that you want to register the domain for. Domains are registered for a minimum of one year. The maximum period depends on the top-level domain.
Default: 1
:type Nameservers: list
:param Nameservers: Contains details for the host and glue IP addresses.
(dict) --Nameserver includes the following elements.
Name (string) -- [REQUIRED]The fully qualified host name of the name server.
Constraint: Maximum 255 characters
GlueIps (list) --Glue IP address of a name server entry. Glue IP addresses are required only when the name of the name server is a subdomain of the domain. For example, if your domain is example.com and the name server for the domain is ns.example.com, you need to specify the IP address for ns.example.com.
Constraints: The list can contain only one IPv4 and one IPv6 address.
(string) --
:type AuthCode: string
:param AuthCode: The authorization code for the domain. You get this value from the current registrar.
:type AutoRenew: boolean
:param AutoRenew: Indicates whether the domain will be automatically renewed (true) or not (false). Autorenewal only takes effect after the account is charged.
Default: true
:type AdminContact: dict
:param AdminContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type RegistrantContact: dict
:param RegistrantContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type TechContact: dict
:param TechContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type PrivacyProtectAdminContact: boolean
:param PrivacyProtectAdminContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:type PrivacyProtectRegistrantContact: boolean
:param PrivacyProtectRegistrantContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:type PrivacyProtectTechContact: boolean
:param PrivacyProtectTechContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:rtype: dict
:return: {
'OperationId': 'string'
}
"""
pass | This operation transfers a domain from another registrar to Amazon Route 53. When the transfer is complete, the domain is registered with the AWS registrar partner, Gandi.
For transfer requirements, a detailed procedure, and information about viewing the status of a domain transfer, see Transferring Registration for a Domain to Amazon Route 53 in the Amazon Route 53 Developer Guide .
If the registrar for your domain is also the DNS service provider for the domain, we highly recommend that you consider transferring your DNS service to Amazon Route 53 or to another DNS service provider before you transfer your registration. Some registrars provide free DNS service when you purchase a domain registration. When you transfer the registration, the previous registrar will not renew your domain registration and could end your DNS service at any time.
If the transfer is successful, this method returns an operation ID that you can use to track the progress and completion of the action. If the transfer doesn't complete successfully, the domain registrant will be notified by email.
See also: AWS API Documentation
:example: response = client.transfer_domain(
DomainName='string',
IdnLangCode='string',
DurationInYears=123,
Nameservers=[
{
'Name': 'string',
'GlueIps': [
'string',
]
},
],
AuthCode='string',
AutoRenew=True|False,
AdminContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
RegistrantContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
TechContact={
'FirstName': 'string',
'LastName': 'string',
'ContactType': 'PERSON'|'COMPANY'|'ASSOCIATION'|'PUBLIC_BODY'|'RESELLER',
'OrganizationName': 'string',
'AddressLine1': 'string',
'AddressLine2': 'string',
'City': 'string',
'State': 'string',
'CountryCode': 'AD'|'AE'|'AF'|'AG'|'AI'|'AL'|'AM'|'AN'|'AO'|'AQ'|'AR'|'AS'|'AT'|'AU'|'AW'|'AZ'|'BA'|'BB'|'BD'|'BE'|'BF'|'BG'|'BH'|'BI'|'BJ'|'BL'|'BM'|'BN'|'BO'|'BR'|'BS'|'BT'|'BW'|'BY'|'BZ'|'CA'|'CC'|'CD'|'CF'|'CG'|'CH'|'CI'|'CK'|'CL'|'CM'|'CN'|'CO'|'CR'|'CU'|'CV'|'CX'|'CY'|'CZ'|'DE'|'DJ'|'DK'|'DM'|'DO'|'DZ'|'EC'|'EE'|'EG'|'ER'|'ES'|'ET'|'FI'|'FJ'|'FK'|'FM'|'FO'|'FR'|'GA'|'GB'|'GD'|'GE'|'GH'|'GI'|'GL'|'GM'|'GN'|'GQ'|'GR'|'GT'|'GU'|'GW'|'GY'|'HK'|'HN'|'HR'|'HT'|'HU'|'ID'|'IE'|'IL'|'IM'|'IN'|'IQ'|'IR'|'IS'|'IT'|'JM'|'JO'|'JP'|'KE'|'KG'|'KH'|'KI'|'KM'|'KN'|'KP'|'KR'|'KW'|'KY'|'KZ'|'LA'|'LB'|'LC'|'LI'|'LK'|'LR'|'LS'|'LT'|'LU'|'LV'|'LY'|'MA'|'MC'|'MD'|'ME'|'MF'|'MG'|'MH'|'MK'|'ML'|'MM'|'MN'|'MO'|'MP'|'MR'|'MS'|'MT'|'MU'|'MV'|'MW'|'MX'|'MY'|'MZ'|'NA'|'NC'|'NE'|'NG'|'NI'|'NL'|'NO'|'NP'|'NR'|'NU'|'NZ'|'OM'|'PA'|'PE'|'PF'|'PG'|'PH'|'PK'|'PL'|'PM'|'PN'|'PR'|'PT'|'PW'|'PY'|'QA'|'RO'|'RS'|'RU'|'RW'|'SA'|'SB'|'SC'|'SD'|'SE'|'SG'|'SH'|'SI'|'SK'|'SL'|'SM'|'SN'|'SO'|'SR'|'ST'|'SV'|'SY'|'SZ'|'TC'|'TD'|'TG'|'TH'|'TJ'|'TK'|'TL'|'TM'|'TN'|'TO'|'TR'|'TT'|'TV'|'TW'|'TZ'|'UA'|'UG'|'US'|'UY'|'UZ'|'VA'|'VC'|'VE'|'VG'|'VI'|'VN'|'VU'|'WF'|'WS'|'YE'|'YT'|'ZA'|'ZM'|'ZW',
'ZipCode': 'string',
'PhoneNumber': 'string',
'Email': 'string',
'Fax': 'string',
'ExtraParams': [
{
'Name': 'DUNS_NUMBER'|'BRAND_NUMBER'|'BIRTH_DEPARTMENT'|'BIRTH_DATE_IN_YYYY_MM_DD'|'BIRTH_COUNTRY'|'BIRTH_CITY'|'DOCUMENT_NUMBER'|'AU_ID_NUMBER'|'AU_ID_TYPE'|'CA_LEGAL_TYPE'|'CA_BUSINESS_ENTITY_TYPE'|'ES_IDENTIFICATION'|'ES_IDENTIFICATION_TYPE'|'ES_LEGAL_FORM'|'FI_BUSINESS_NUMBER'|'FI_ID_NUMBER'|'IT_PIN'|'RU_PASSPORT_DATA'|'SE_ID_NUMBER'|'SG_ID_NUMBER'|'VAT_NUMBER',
'Value': 'string'
},
]
},
PrivacyProtectAdminContact=True|False,
PrivacyProtectRegistrantContact=True|False,
PrivacyProtectTechContact=True|False
)
:type DomainName: string
:param DomainName: [REQUIRED]
The name of the domain that you want to transfer to Amazon Route 53.
Constraints: The domain name can contain only the letters a through z, the numbers 0 through 9, and hyphen (-). Internationalized Domain Names are not supported.
:type IdnLangCode: string
:param IdnLangCode: Reserved for future use.
:type DurationInYears: integer
:param DurationInYears: [REQUIRED]
The number of years that you want to register the domain for. Domains are registered for a minimum of one year. The maximum period depends on the top-level domain.
Default: 1
:type Nameservers: list
:param Nameservers: Contains details for the host and glue IP addresses.
(dict) --Nameserver includes the following elements.
Name (string) -- [REQUIRED]The fully qualified host name of the name server.
Constraint: Maximum 255 characters
GlueIps (list) --Glue IP address of a name server entry. Glue IP addresses are required only when the name of the name server is a subdomain of the domain. For example, if your domain is example.com and the name server for the domain is ns.example.com, you need to specify the IP address for ns.example.com.
Constraints: The list can contain only one IPv4 and one IPv6 address.
(string) --
:type AuthCode: string
:param AuthCode: The authorization code for the domain. You get this value from the current registrar.
:type AutoRenew: boolean
:param AutoRenew: Indicates whether the domain will be automatically renewed (true) or not (false). Autorenewal only takes effect after the account is charged.
Default: true
:type AdminContact: dict
:param AdminContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type RegistrantContact: dict
:param RegistrantContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type TechContact: dict
:param TechContact: [REQUIRED]
Provides detailed contact information.
FirstName (string) --First name of contact.
LastName (string) --Last name of contact.
ContactType (string) --Indicates whether the contact is a person, company, association, or public organization. If you choose an option other than PERSON , you must enter an organization name, and you can't enable privacy protection for the contact.
OrganizationName (string) --Name of the organization for contact types other than PERSON .
AddressLine1 (string) --First line of the contact's address.
AddressLine2 (string) --Second line of contact's address, if any.
City (string) --The city of the contact's address.
State (string) --The state or province of the contact's city.
CountryCode (string) --Code for the country of the contact's address.
ZipCode (string) --The zip or postal code of the contact's address.
PhoneNumber (string) --The phone number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
Email (string) --Email address of the contact.
Fax (string) --Fax number of the contact.
Constraints: Phone number must be specified in the format '+[country dialing code].[number including any area code]'. For example, a US phone number might appear as '+1.1234567890' .
ExtraParams (list) --A list of name-value pairs for parameters required by certain top-level domains.
(dict) --ExtraParam includes the following elements.
Name (string) -- [REQUIRED]Name of the additional parameter required by the top-level domain.
Value (string) -- [REQUIRED]Values corresponding to the additional parameter names required by some top-level domains.
:type PrivacyProtectAdminContact: boolean
:param PrivacyProtectAdminContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:type PrivacyProtectRegistrantContact: boolean
:param PrivacyProtectRegistrantContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:type PrivacyProtectTechContact: boolean
:param PrivacyProtectTechContact: Whether you want to conceal contact information from WHOIS queries. If you specify true , WHOIS ('who is') queries will return contact information for our registrar partner, Gandi, instead of the contact information that you enter.
Default: true
:rtype: dict
:return: {
'OperationId': 'string'
} | entailment |
def simulate_custom_policy(PolicyInputList=None, ActionNames=None, ResourceArns=None, ResourcePolicy=None, ResourceOwner=None, CallerArn=None, ContextEntries=None, ResourceHandlingOption=None, MaxItems=None, Marker=None):
"""
Simulate how a set of IAM policies and optionally a resource-based policy works with a list of API actions and AWS resources to determine the policies' effective permissions. The policies are provided as strings.
The simulation does not perform the API actions; it only checks the authorization to determine if the simulated policies allow or deny the actions.
If you want to simulate existing policies attached to an IAM user, group, or role, use SimulatePrincipalPolicy instead.
Context keys are variables maintained by AWS and its services that provide details about the context of an API query request. You can use the Condition element of an IAM policy to evaluate context keys. To get the list of context keys that the policies require for correct simulation, use GetContextKeysForCustomPolicy .
If the output is long, you can use MaxItems and Marker parameters to paginate the results.
See also: AWS API Documentation
:example: response = client.simulate_custom_policy(
PolicyInputList=[
'string',
],
ActionNames=[
'string',
],
ResourceArns=[
'string',
],
ResourcePolicy='string',
ResourceOwner='string',
CallerArn='string',
ContextEntries=[
{
'ContextKeyName': 'string',
'ContextKeyValues': [
'string',
],
'ContextKeyType': 'string'|'stringList'|'numeric'|'numericList'|'boolean'|'booleanList'|'ip'|'ipList'|'binary'|'binaryList'|'date'|'dateList'
},
],
ResourceHandlingOption='string',
MaxItems=123,
Marker='string'
)
:type PolicyInputList: list
:param PolicyInputList: [REQUIRED]
A list of policy documents to include in the simulation. Each document is specified as a string containing the complete, valid JSON text of an IAM policy. Do not include any resource-based policies in this parameter. Any resource-based policy must be submitted with the ResourcePolicy parameter. The policies cannot be 'scope-down' policies, such as you could include in a call to GetFederationToken or one of the AssumeRole APIs to restrict what a user can do while using the temporary credentials.
The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through u00FF). It also includes the special characters tab (u0009), line feed (u000A), and carriage return (u000D).
(string) --
:type ActionNames: list
:param ActionNames: [REQUIRED]
A list of names of API actions to evaluate in the simulation. Each action is evaluated against each resource. Each action must include the service identifier, such as iam:CreateUser .
(string) --
:type ResourceArns: list
:param ResourceArns: A list of ARNs of AWS resources to include in the simulation. If this parameter is not provided then the value defaults to * (all resources). Each API in the ActionNames parameter is evaluated for each resource in this list. The simulation determines the access result (allowed or denied) of each combination and reports it in the response.
The simulation does not automatically retrieve policies for the specified resources. If you want to include a resource policy in the simulation, then you must include the policy as a string in the ResourcePolicy parameter.
If you include a ResourcePolicy , then it must be applicable to all of the resources included in the simulation or you receive an invalid input error.
For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference .
(string) --
:type ResourcePolicy: string
:param ResourcePolicy: A resource-based policy to include in the simulation provided as a string. Each resource in the simulation is treated as if it had this policy attached. You can include only one resource-based policy in a simulation.
The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through u00FF). It also includes the special characters tab (u0009), line feed (u000A), and carriage return (u000D).
:type ResourceOwner: string
:param ResourceOwner: An AWS account ID that specifies the owner of any simulated resource that does not identify its owner in the resource ARN, such as an S3 bucket or object. If ResourceOwner is specified, it is also used as the account owner of any ResourcePolicy included in the simulation. If the ResourceOwner parameter is not specified, then the owner of the resources and the resource policy defaults to the account of the identity provided in CallerArn . This parameter is required only if you specify a resource-based policy and account that owns the resource is different from the account that owns the simulated calling user CallerArn .
:type CallerArn: string
:param CallerArn: The ARN of the IAM user that you want to use as the simulated caller of the APIs. CallerArn is required if you include a ResourcePolicy so that the policy's Principal element has a value to use in evaluating the policy.
You can specify only the ARN of an IAM user. You cannot specify the ARN of an assumed role, federated user, or a service principal.
:type ContextEntries: list
:param ContextEntries: A list of context keys and corresponding values for the simulation to use. Whenever a context key is evaluated in one of the simulated IAM permission policies, the corresponding value is supplied.
(dict) --Contains information about a condition context key. It includes the name of the key and specifies the value (or values, if the context key supports multiple values) to use in the simulation. This information is used when evaluating the Condition elements of the input policies.
This data type is used as an input parameter to `` SimulateCustomPolicy `` and `` SimulateCustomPolicy `` .
ContextKeyName (string) --The full name of a condition context key, including the service prefix. For example, aws:SourceIp or s3:VersionId .
ContextKeyValues (list) --The value (or values, if the condition context key supports multiple values) to provide to the simulation for use when the key is referenced by a Condition element in an input policy.
(string) --
ContextKeyType (string) --The data type of the value (or values) specified in the ContextKeyValues parameter.
:type ResourceHandlingOption: string
:param ResourceHandlingOption: Specifies the type of simulation to run. Different APIs that support resource-based policies require different combinations of resources. By specifying the type of simulation to run, you enable the policy simulator to enforce the presence of the required resources to ensure reliable simulation results. If your simulation does not match one of the following scenarios, then you can omit this parameter. The following list shows each of the supported scenario values and the resources that you must define to run the simulation.
Each of the EC2 scenarios requires that you specify instance, image, and security-group resources. If your scenario includes an EBS volume, then you must specify that volume as a resource. If the EC2 scenario includes VPC, then you must supply the network-interface resource. If it includes an IP subnet, then you must specify the subnet resource. For more information on the EC2 scenario options, see Supported Platforms in the AWS EC2 User Guide .
EC2-Classic-InstanceStore instance, image, security-group
EC2-Classic-EBS instance, image, security-group, volume
EC2-VPC-InstanceStore instance, image, security-group, network-interface
EC2-VPC-InstanceStore-Subnet instance, image, security-group, network-interface, subnet
EC2-VPC-EBS instance, image, security-group, network-interface, volume
EC2-VPC-EBS-Subnet instance, image, security-group, network-interface, subnet, volume
:type MaxItems: integer
:param MaxItems: (Optional) Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true .
If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.
:type Marker: string
:param Marker: Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.
:rtype: dict
:return: {
'EvaluationResults': [
{
'EvalActionName': 'string',
'EvalResourceName': 'string',
'EvalDecision': 'allowed'|'explicitDeny'|'implicitDeny',
'MatchedStatements': [
{
'SourcePolicyId': 'string',
'SourcePolicyType': 'user'|'group'|'role'|'aws-managed'|'user-managed'|'resource'|'none',
'StartPosition': {
'Line': 123,
'Column': 123
},
'EndPosition': {
'Line': 123,
'Column': 123
}
},
],
'MissingContextValues': [
'string',
],
'OrganizationsDecisionDetail': {
'AllowedByOrganizations': True|False
},
'EvalDecisionDetails': {
'string': 'allowed'|'explicitDeny'|'implicitDeny'
},
'ResourceSpecificResults': [
{
'EvalResourceName': 'string',
'EvalResourceDecision': 'allowed'|'explicitDeny'|'implicitDeny',
'MatchedStatements': [
{
'SourcePolicyId': 'string',
'SourcePolicyType': 'user'|'group'|'role'|'aws-managed'|'user-managed'|'resource'|'none',
'StartPosition': {
'Line': 123,
'Column': 123
},
'EndPosition': {
'Line': 123,
'Column': 123
}
},
],
'MissingContextValues': [
'string',
],
'EvalDecisionDetails': {
'string': 'allowed'|'explicitDeny'|'implicitDeny'
}
},
]
},
],
'IsTruncated': True|False,
'Marker': 'string'
}
:returns:
(string) --
"""
pass | Simulate how a set of IAM policies and optionally a resource-based policy works with a list of API actions and AWS resources to determine the policies' effective permissions. The policies are provided as strings.
The simulation does not perform the API actions; it only checks the authorization to determine if the simulated policies allow or deny the actions.
If you want to simulate existing policies attached to an IAM user, group, or role, use SimulatePrincipalPolicy instead.
Context keys are variables maintained by AWS and its services that provide details about the context of an API query request. You can use the Condition element of an IAM policy to evaluate context keys. To get the list of context keys that the policies require for correct simulation, use GetContextKeysForCustomPolicy .
If the output is long, you can use MaxItems and Marker parameters to paginate the results.
See also: AWS API Documentation
:example: response = client.simulate_custom_policy(
PolicyInputList=[
'string',
],
ActionNames=[
'string',
],
ResourceArns=[
'string',
],
ResourcePolicy='string',
ResourceOwner='string',
CallerArn='string',
ContextEntries=[
{
'ContextKeyName': 'string',
'ContextKeyValues': [
'string',
],
'ContextKeyType': 'string'|'stringList'|'numeric'|'numericList'|'boolean'|'booleanList'|'ip'|'ipList'|'binary'|'binaryList'|'date'|'dateList'
},
],
ResourceHandlingOption='string',
MaxItems=123,
Marker='string'
)
:type PolicyInputList: list
:param PolicyInputList: [REQUIRED]
A list of policy documents to include in the simulation. Each document is specified as a string containing the complete, valid JSON text of an IAM policy. Do not include any resource-based policies in this parameter. Any resource-based policy must be submitted with the ResourcePolicy parameter. The policies cannot be 'scope-down' policies, such as you could include in a call to GetFederationToken or one of the AssumeRole APIs to restrict what a user can do while using the temporary credentials.
The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through u00FF). It also includes the special characters tab (u0009), line feed (u000A), and carriage return (u000D).
(string) --
:type ActionNames: list
:param ActionNames: [REQUIRED]
A list of names of API actions to evaluate in the simulation. Each action is evaluated against each resource. Each action must include the service identifier, such as iam:CreateUser .
(string) --
:type ResourceArns: list
:param ResourceArns: A list of ARNs of AWS resources to include in the simulation. If this parameter is not provided then the value defaults to * (all resources). Each API in the ActionNames parameter is evaluated for each resource in this list. The simulation determines the access result (allowed or denied) of each combination and reports it in the response.
The simulation does not automatically retrieve policies for the specified resources. If you want to include a resource policy in the simulation, then you must include the policy as a string in the ResourcePolicy parameter.
If you include a ResourcePolicy , then it must be applicable to all of the resources included in the simulation or you receive an invalid input error.
For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference .
(string) --
:type ResourcePolicy: string
:param ResourcePolicy: A resource-based policy to include in the simulation provided as a string. Each resource in the simulation is treated as if it had this policy attached. You can include only one resource-based policy in a simulation.
The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through u00FF). It also includes the special characters tab (u0009), line feed (u000A), and carriage return (u000D).
:type ResourceOwner: string
:param ResourceOwner: An AWS account ID that specifies the owner of any simulated resource that does not identify its owner in the resource ARN, such as an S3 bucket or object. If ResourceOwner is specified, it is also used as the account owner of any ResourcePolicy included in the simulation. If the ResourceOwner parameter is not specified, then the owner of the resources and the resource policy defaults to the account of the identity provided in CallerArn . This parameter is required only if you specify a resource-based policy and account that owns the resource is different from the account that owns the simulated calling user CallerArn .
:type CallerArn: string
:param CallerArn: The ARN of the IAM user that you want to use as the simulated caller of the APIs. CallerArn is required if you include a ResourcePolicy so that the policy's Principal element has a value to use in evaluating the policy.
You can specify only the ARN of an IAM user. You cannot specify the ARN of an assumed role, federated user, or a service principal.
:type ContextEntries: list
:param ContextEntries: A list of context keys and corresponding values for the simulation to use. Whenever a context key is evaluated in one of the simulated IAM permission policies, the corresponding value is supplied.
(dict) --Contains information about a condition context key. It includes the name of the key and specifies the value (or values, if the context key supports multiple values) to use in the simulation. This information is used when evaluating the Condition elements of the input policies.
This data type is used as an input parameter to `` SimulateCustomPolicy `` and `` SimulateCustomPolicy `` .
ContextKeyName (string) --The full name of a condition context key, including the service prefix. For example, aws:SourceIp or s3:VersionId .
ContextKeyValues (list) --The value (or values, if the condition context key supports multiple values) to provide to the simulation for use when the key is referenced by a Condition element in an input policy.
(string) --
ContextKeyType (string) --The data type of the value (or values) specified in the ContextKeyValues parameter.
:type ResourceHandlingOption: string
:param ResourceHandlingOption: Specifies the type of simulation to run. Different APIs that support resource-based policies require different combinations of resources. By specifying the type of simulation to run, you enable the policy simulator to enforce the presence of the required resources to ensure reliable simulation results. If your simulation does not match one of the following scenarios, then you can omit this parameter. The following list shows each of the supported scenario values and the resources that you must define to run the simulation.
Each of the EC2 scenarios requires that you specify instance, image, and security-group resources. If your scenario includes an EBS volume, then you must specify that volume as a resource. If the EC2 scenario includes VPC, then you must supply the network-interface resource. If it includes an IP subnet, then you must specify the subnet resource. For more information on the EC2 scenario options, see Supported Platforms in the AWS EC2 User Guide .
EC2-Classic-InstanceStore instance, image, security-group
EC2-Classic-EBS instance, image, security-group, volume
EC2-VPC-InstanceStore instance, image, security-group, network-interface
EC2-VPC-InstanceStore-Subnet instance, image, security-group, network-interface, subnet
EC2-VPC-EBS instance, image, security-group, network-interface, volume
EC2-VPC-EBS-Subnet instance, image, security-group, network-interface, subnet, volume
:type MaxItems: integer
:param MaxItems: (Optional) Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true .
If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.
:type Marker: string
:param Marker: Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.
:rtype: dict
:return: {
'EvaluationResults': [
{
'EvalActionName': 'string',
'EvalResourceName': 'string',
'EvalDecision': 'allowed'|'explicitDeny'|'implicitDeny',
'MatchedStatements': [
{
'SourcePolicyId': 'string',
'SourcePolicyType': 'user'|'group'|'role'|'aws-managed'|'user-managed'|'resource'|'none',
'StartPosition': {
'Line': 123,
'Column': 123
},
'EndPosition': {
'Line': 123,
'Column': 123
}
},
],
'MissingContextValues': [
'string',
],
'OrganizationsDecisionDetail': {
'AllowedByOrganizations': True|False
},
'EvalDecisionDetails': {
'string': 'allowed'|'explicitDeny'|'implicitDeny'
},
'ResourceSpecificResults': [
{
'EvalResourceName': 'string',
'EvalResourceDecision': 'allowed'|'explicitDeny'|'implicitDeny',
'MatchedStatements': [
{
'SourcePolicyId': 'string',
'SourcePolicyType': 'user'|'group'|'role'|'aws-managed'|'user-managed'|'resource'|'none',
'StartPosition': {
'Line': 123,
'Column': 123
},
'EndPosition': {
'Line': 123,
'Column': 123
}
},
],
'MissingContextValues': [
'string',
],
'EvalDecisionDetails': {
'string': 'allowed'|'explicitDeny'|'implicitDeny'
}
},
]
},
],
'IsTruncated': True|False,
'Marker': 'string'
}
:returns:
(string) -- | entailment |
def simulate_principal_policy(PolicySourceArn=None, PolicyInputList=None, ActionNames=None, ResourceArns=None, ResourcePolicy=None, ResourceOwner=None, CallerArn=None, ContextEntries=None, ResourceHandlingOption=None, MaxItems=None, Marker=None):
"""
Simulate how a set of IAM policies attached to an IAM entity works with a list of API actions and AWS resources to determine the policies' effective permissions. The entity can be an IAM user, group, or role. If you specify a user, then the simulation also includes all of the policies that are attached to groups that the user belongs to .
You can optionally include a list of one or more additional policies specified as strings to include in the simulation. If you want to simulate only policies specified as strings, use SimulateCustomPolicy instead.
You can also optionally include one resource-based policy to be evaluated with each of the resources included in the simulation.
The simulation does not perform the API actions, it only checks the authorization to determine if the simulated policies allow or deny the actions.
Context keys are variables maintained by AWS and its services that provide details about the context of an API query request. You can use the Condition element of an IAM policy to evaluate context keys. To get the list of context keys that the policies require for correct simulation, use GetContextKeysForPrincipalPolicy .
If the output is long, you can use the MaxItems and Marker parameters to paginate the results.
See also: AWS API Documentation
:example: response = client.simulate_principal_policy(
PolicySourceArn='string',
PolicyInputList=[
'string',
],
ActionNames=[
'string',
],
ResourceArns=[
'string',
],
ResourcePolicy='string',
ResourceOwner='string',
CallerArn='string',
ContextEntries=[
{
'ContextKeyName': 'string',
'ContextKeyValues': [
'string',
],
'ContextKeyType': 'string'|'stringList'|'numeric'|'numericList'|'boolean'|'booleanList'|'ip'|'ipList'|'binary'|'binaryList'|'date'|'dateList'
},
],
ResourceHandlingOption='string',
MaxItems=123,
Marker='string'
)
:type PolicySourceArn: string
:param PolicySourceArn: [REQUIRED]
The Amazon Resource Name (ARN) of a user, group, or role whose policies you want to include in the simulation. If you specify a user, group, or role, the simulation includes all policies that are associated with that entity. If you specify a user, the simulation also includes all policies that are attached to any groups the user belongs to.
For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference .
:type PolicyInputList: list
:param PolicyInputList: An optional list of additional policy documents to include in the simulation. Each document is specified as a string containing the complete, valid JSON text of an IAM policy.
The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through u00FF). It also includes the special characters tab (u0009), line feed (u000A), and carriage return (u000D).
(string) --
:type ActionNames: list
:param ActionNames: [REQUIRED]
A list of names of API actions to evaluate in the simulation. Each action is evaluated for each resource. Each action must include the service identifier, such as iam:CreateUser .
(string) --
:type ResourceArns: list
:param ResourceArns: A list of ARNs of AWS resources to include in the simulation. If this parameter is not provided then the value defaults to * (all resources). Each API in the ActionNames parameter is evaluated for each resource in this list. The simulation determines the access result (allowed or denied) of each combination and reports it in the response.
The simulation does not automatically retrieve policies for the specified resources. If you want to include a resource policy in the simulation, then you must include the policy as a string in the ResourcePolicy parameter.
For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference .
(string) --
:type ResourcePolicy: string
:param ResourcePolicy: A resource-based policy to include in the simulation provided as a string. Each resource in the simulation is treated as if it had this policy attached. You can include only one resource-based policy in a simulation.
The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through u00FF). It also includes the special characters tab (u0009), line feed (u000A), and carriage return (u000D).
:type ResourceOwner: string
:param ResourceOwner: An AWS account ID that specifies the owner of any simulated resource that does not identify its owner in the resource ARN, such as an S3 bucket or object. If ResourceOwner is specified, it is also used as the account owner of any ResourcePolicy included in the simulation. If the ResourceOwner parameter is not specified, then the owner of the resources and the resource policy defaults to the account of the identity provided in CallerArn . This parameter is required only if you specify a resource-based policy and account that owns the resource is different from the account that owns the simulated calling user CallerArn .
:type CallerArn: string
:param CallerArn: The ARN of the IAM user that you want to specify as the simulated caller of the APIs. If you do not specify a CallerArn , it defaults to the ARN of the user that you specify in PolicySourceArn , if you specified a user. If you include both a PolicySourceArn (for example, arn:aws:iam::123456789012:user/David ) and a CallerArn (for example, arn:aws:iam::123456789012:user/Bob ), the result is that you simulate calling the APIs as Bob, as if Bob had David's policies.
You can specify only the ARN of an IAM user. You cannot specify the ARN of an assumed role, federated user, or a service principal.
CallerArn is required if you include a ResourcePolicy and the PolicySourceArn is not the ARN for an IAM user. This is required so that the resource-based policy's Principal element has a value to use in evaluating the policy.
For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference .
:type ContextEntries: list
:param ContextEntries: A list of context keys and corresponding values for the simulation to use. Whenever a context key is evaluated in one of the simulated IAM permission policies, the corresponding value is supplied.
(dict) --Contains information about a condition context key. It includes the name of the key and specifies the value (or values, if the context key supports multiple values) to use in the simulation. This information is used when evaluating the Condition elements of the input policies.
This data type is used as an input parameter to `` SimulateCustomPolicy `` and `` SimulateCustomPolicy `` .
ContextKeyName (string) --The full name of a condition context key, including the service prefix. For example, aws:SourceIp or s3:VersionId .
ContextKeyValues (list) --The value (or values, if the condition context key supports multiple values) to provide to the simulation for use when the key is referenced by a Condition element in an input policy.
(string) --
ContextKeyType (string) --The data type of the value (or values) specified in the ContextKeyValues parameter.
:type ResourceHandlingOption: string
:param ResourceHandlingOption: Specifies the type of simulation to run. Different APIs that support resource-based policies require different combinations of resources. By specifying the type of simulation to run, you enable the policy simulator to enforce the presence of the required resources to ensure reliable simulation results. If your simulation does not match one of the following scenarios, then you can omit this parameter. The following list shows each of the supported scenario values and the resources that you must define to run the simulation.
Each of the EC2 scenarios requires that you specify instance, image, and security-group resources. If your scenario includes an EBS volume, then you must specify that volume as a resource. If the EC2 scenario includes VPC, then you must supply the network-interface resource. If it includes an IP subnet, then you must specify the subnet resource. For more information on the EC2 scenario options, see Supported Platforms in the AWS EC2 User Guide .
EC2-Classic-InstanceStore instance, image, security-group
EC2-Classic-EBS instance, image, security-group, volume
EC2-VPC-InstanceStore instance, image, security-group, network-interface
EC2-VPC-InstanceStore-Subnet instance, image, security-group, network-interface, subnet
EC2-VPC-EBS instance, image, security-group, network-interface, volume
EC2-VPC-EBS-Subnet instance, image, security-group, network-interface, subnet, volume
:type MaxItems: integer
:param MaxItems: (Optional) Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true .
If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.
:type Marker: string
:param Marker: Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.
:rtype: dict
:return: {
'EvaluationResults': [
{
'EvalActionName': 'string',
'EvalResourceName': 'string',
'EvalDecision': 'allowed'|'explicitDeny'|'implicitDeny',
'MatchedStatements': [
{
'SourcePolicyId': 'string',
'SourcePolicyType': 'user'|'group'|'role'|'aws-managed'|'user-managed'|'resource'|'none',
'StartPosition': {
'Line': 123,
'Column': 123
},
'EndPosition': {
'Line': 123,
'Column': 123
}
},
],
'MissingContextValues': [
'string',
],
'OrganizationsDecisionDetail': {
'AllowedByOrganizations': True|False
},
'EvalDecisionDetails': {
'string': 'allowed'|'explicitDeny'|'implicitDeny'
},
'ResourceSpecificResults': [
{
'EvalResourceName': 'string',
'EvalResourceDecision': 'allowed'|'explicitDeny'|'implicitDeny',
'MatchedStatements': [
{
'SourcePolicyId': 'string',
'SourcePolicyType': 'user'|'group'|'role'|'aws-managed'|'user-managed'|'resource'|'none',
'StartPosition': {
'Line': 123,
'Column': 123
},
'EndPosition': {
'Line': 123,
'Column': 123
}
},
],
'MissingContextValues': [
'string',
],
'EvalDecisionDetails': {
'string': 'allowed'|'explicitDeny'|'implicitDeny'
}
},
]
},
],
'IsTruncated': True|False,
'Marker': 'string'
}
:returns:
(string) --
"""
pass | Simulate how a set of IAM policies attached to an IAM entity works with a list of API actions and AWS resources to determine the policies' effective permissions. The entity can be an IAM user, group, or role. If you specify a user, then the simulation also includes all of the policies that are attached to groups that the user belongs to .
You can optionally include a list of one or more additional policies specified as strings to include in the simulation. If you want to simulate only policies specified as strings, use SimulateCustomPolicy instead.
You can also optionally include one resource-based policy to be evaluated with each of the resources included in the simulation.
The simulation does not perform the API actions, it only checks the authorization to determine if the simulated policies allow or deny the actions.
Context keys are variables maintained by AWS and its services that provide details about the context of an API query request. You can use the Condition element of an IAM policy to evaluate context keys. To get the list of context keys that the policies require for correct simulation, use GetContextKeysForPrincipalPolicy .
If the output is long, you can use the MaxItems and Marker parameters to paginate the results.
See also: AWS API Documentation
:example: response = client.simulate_principal_policy(
PolicySourceArn='string',
PolicyInputList=[
'string',
],
ActionNames=[
'string',
],
ResourceArns=[
'string',
],
ResourcePolicy='string',
ResourceOwner='string',
CallerArn='string',
ContextEntries=[
{
'ContextKeyName': 'string',
'ContextKeyValues': [
'string',
],
'ContextKeyType': 'string'|'stringList'|'numeric'|'numericList'|'boolean'|'booleanList'|'ip'|'ipList'|'binary'|'binaryList'|'date'|'dateList'
},
],
ResourceHandlingOption='string',
MaxItems=123,
Marker='string'
)
:type PolicySourceArn: string
:param PolicySourceArn: [REQUIRED]
The Amazon Resource Name (ARN) of a user, group, or role whose policies you want to include in the simulation. If you specify a user, group, or role, the simulation includes all policies that are associated with that entity. If you specify a user, the simulation also includes all policies that are attached to any groups the user belongs to.
For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference .
:type PolicyInputList: list
:param PolicyInputList: An optional list of additional policy documents to include in the simulation. Each document is specified as a string containing the complete, valid JSON text of an IAM policy.
The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through u00FF). It also includes the special characters tab (u0009), line feed (u000A), and carriage return (u000D).
(string) --
:type ActionNames: list
:param ActionNames: [REQUIRED]
A list of names of API actions to evaluate in the simulation. Each action is evaluated for each resource. Each action must include the service identifier, such as iam:CreateUser .
(string) --
:type ResourceArns: list
:param ResourceArns: A list of ARNs of AWS resources to include in the simulation. If this parameter is not provided then the value defaults to * (all resources). Each API in the ActionNames parameter is evaluated for each resource in this list. The simulation determines the access result (allowed or denied) of each combination and reports it in the response.
The simulation does not automatically retrieve policies for the specified resources. If you want to include a resource policy in the simulation, then you must include the policy as a string in the ResourcePolicy parameter.
For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference .
(string) --
:type ResourcePolicy: string
:param ResourcePolicy: A resource-based policy to include in the simulation provided as a string. Each resource in the simulation is treated as if it had this policy attached. You can include only one resource-based policy in a simulation.
The regex pattern used to validate this parameter is a string of characters consisting of any printable ASCII character ranging from the space character (u0020) through end of the ASCII character range as well as the printable characters in the Basic Latin and Latin-1 Supplement character set (through u00FF). It also includes the special characters tab (u0009), line feed (u000A), and carriage return (u000D).
:type ResourceOwner: string
:param ResourceOwner: An AWS account ID that specifies the owner of any simulated resource that does not identify its owner in the resource ARN, such as an S3 bucket or object. If ResourceOwner is specified, it is also used as the account owner of any ResourcePolicy included in the simulation. If the ResourceOwner parameter is not specified, then the owner of the resources and the resource policy defaults to the account of the identity provided in CallerArn . This parameter is required only if you specify a resource-based policy and account that owns the resource is different from the account that owns the simulated calling user CallerArn .
:type CallerArn: string
:param CallerArn: The ARN of the IAM user that you want to specify as the simulated caller of the APIs. If you do not specify a CallerArn , it defaults to the ARN of the user that you specify in PolicySourceArn , if you specified a user. If you include both a PolicySourceArn (for example, arn:aws:iam::123456789012:user/David ) and a CallerArn (for example, arn:aws:iam::123456789012:user/Bob ), the result is that you simulate calling the APIs as Bob, as if Bob had David's policies.
You can specify only the ARN of an IAM user. You cannot specify the ARN of an assumed role, federated user, or a service principal.
CallerArn is required if you include a ResourcePolicy and the PolicySourceArn is not the ARN for an IAM user. This is required so that the resource-based policy's Principal element has a value to use in evaluating the policy.
For more information about ARNs, see Amazon Resource Names (ARNs) and AWS Service Namespaces in the AWS General Reference .
:type ContextEntries: list
:param ContextEntries: A list of context keys and corresponding values for the simulation to use. Whenever a context key is evaluated in one of the simulated IAM permission policies, the corresponding value is supplied.
(dict) --Contains information about a condition context key. It includes the name of the key and specifies the value (or values, if the context key supports multiple values) to use in the simulation. This information is used when evaluating the Condition elements of the input policies.
This data type is used as an input parameter to `` SimulateCustomPolicy `` and `` SimulateCustomPolicy `` .
ContextKeyName (string) --The full name of a condition context key, including the service prefix. For example, aws:SourceIp or s3:VersionId .
ContextKeyValues (list) --The value (or values, if the condition context key supports multiple values) to provide to the simulation for use when the key is referenced by a Condition element in an input policy.
(string) --
ContextKeyType (string) --The data type of the value (or values) specified in the ContextKeyValues parameter.
:type ResourceHandlingOption: string
:param ResourceHandlingOption: Specifies the type of simulation to run. Different APIs that support resource-based policies require different combinations of resources. By specifying the type of simulation to run, you enable the policy simulator to enforce the presence of the required resources to ensure reliable simulation results. If your simulation does not match one of the following scenarios, then you can omit this parameter. The following list shows each of the supported scenario values and the resources that you must define to run the simulation.
Each of the EC2 scenarios requires that you specify instance, image, and security-group resources. If your scenario includes an EBS volume, then you must specify that volume as a resource. If the EC2 scenario includes VPC, then you must supply the network-interface resource. If it includes an IP subnet, then you must specify the subnet resource. For more information on the EC2 scenario options, see Supported Platforms in the AWS EC2 User Guide .
EC2-Classic-InstanceStore instance, image, security-group
EC2-Classic-EBS instance, image, security-group, volume
EC2-VPC-InstanceStore instance, image, security-group, network-interface
EC2-VPC-InstanceStore-Subnet instance, image, security-group, network-interface, subnet
EC2-VPC-EBS instance, image, security-group, network-interface, volume
EC2-VPC-EBS-Subnet instance, image, security-group, network-interface, subnet, volume
:type MaxItems: integer
:param MaxItems: (Optional) Use this only when paginating results to indicate the maximum number of items you want in the response. If additional items exist beyond the maximum you specify, the IsTruncated response element is true .
If you do not include this parameter, it defaults to 100. Note that IAM might return fewer results, even when there are more results available. In that case, the IsTruncated response element returns true and Marker contains a value to include in the subsequent call that tells the service where to continue from.
:type Marker: string
:param Marker: Use this parameter only when paginating results and only after you receive a response indicating that the results are truncated. Set it to the value of the Marker element in the response that you received to indicate where the next call should start.
:rtype: dict
:return: {
'EvaluationResults': [
{
'EvalActionName': 'string',
'EvalResourceName': 'string',
'EvalDecision': 'allowed'|'explicitDeny'|'implicitDeny',
'MatchedStatements': [
{
'SourcePolicyId': 'string',
'SourcePolicyType': 'user'|'group'|'role'|'aws-managed'|'user-managed'|'resource'|'none',
'StartPosition': {
'Line': 123,
'Column': 123
},
'EndPosition': {
'Line': 123,
'Column': 123
}
},
],
'MissingContextValues': [
'string',
],
'OrganizationsDecisionDetail': {
'AllowedByOrganizations': True|False
},
'EvalDecisionDetails': {
'string': 'allowed'|'explicitDeny'|'implicitDeny'
},
'ResourceSpecificResults': [
{
'EvalResourceName': 'string',
'EvalResourceDecision': 'allowed'|'explicitDeny'|'implicitDeny',
'MatchedStatements': [
{
'SourcePolicyId': 'string',
'SourcePolicyType': 'user'|'group'|'role'|'aws-managed'|'user-managed'|'resource'|'none',
'StartPosition': {
'Line': 123,
'Column': 123
},
'EndPosition': {
'Line': 123,
'Column': 123
}
},
],
'MissingContextValues': [
'string',
],
'EvalDecisionDetails': {
'string': 'allowed'|'explicitDeny'|'implicitDeny'
}
},
]
},
],
'IsTruncated': True|False,
'Marker': 'string'
}
:returns:
(string) -- | entailment |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.