-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathboiler_plate.py
More file actions
44 lines (30 loc) · 989 Bytes
/
boiler_plate.py
File metadata and controls
44 lines (30 loc) · 989 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
print("Setting Up Environment")
print("Setting Up Environment")
import logging
import boto3
from botocore.exceptions import ClientError
def create_vault(vault_name):
"""Create an Amazon Glacier vault.
:param vault_name: string
:return: glacier.Vault object if vault was created, otherwise None
"""
glacier = boto3.resource('glacier')
try:
vault = glacier.create_vault(vaultName=vault_name)
except ClientError as e:
logging.error(e)
return None
return vault
def main():
""" Exercise create_vault()"""
# Assign this value before running the program
test_vault_name = 'VAULT_NAME'
# Set up logging
logging.basicConfig(level=logging.DEBUG,
format='%(levelname)s: %(asctime)s: %(message)s')
# Create the Glacier vault
vault = create_vault(test_vault_name)
if vault is not None:
logging.info(f'Created vault {vault.name}')
if __name__ == '__main__':
main()