Création d'un compartiment S3
Les ARN d'Amazon (Amazon Resource Names) pour les compartiments suivent un format précis. Exerçons-nous à générer des ARN pour différents compartiments S3.
Le client S3 a été créé et est stocké dans la variable s3.
Cette activité fait partie du cours
Données en continu avec AWS Kinesis et Lambda
Instructions de l’exercice
- Créez le nouveau compartiment
"sd-vehicle-data". - Dressez la liste des compartiments disponibles dans S3.
- Générez l'ARN pour chaque compartiment et affichez-le. Rappelez-vous que les ARN S3 suivent le format
"arn:aws:s3:::BUCKET_NAME".
Exercice interactif pratique
Essayez cet exercice en complétant ce code d’exemple.
# Create the new sd-vehicle-data bucket
s3.____(Bucket='sd-vehicle-data')
# List the buckets in S3
for bucket_info in s3.____()['Buckets']:
# Get the bucket_name
bucket_name = bucket_info['Name']
# Generate bucket ARN.
arn = "____:____:____:::{}".format(bucket_name)
# Print the ARN
print(arn)