generated from ministryofjustice/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upload files to s3 and reduce the memory and increase timeout
- Loading branch information
1 parent
55e9ebc
commit f1ff91b
Showing
7 changed files
with
58 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
import boto3 | ||
|
||
# Specify the AWS profile you want to use | ||
aws_profile = 'laa-development-lz' | ||
snapshot_id = 'snap-0331f5921109f4666' | ||
image_name = 'eric-db-srv-RHEL-7.7-280923' | ||
|
||
|
||
|
||
# Initialize the Boto3 EC2 client with the specified profile | ||
session = boto3.Session(profile_name=aws_profile) | ||
ec2_client = session.client('ec2') | ||
|
||
# Create an image from the snapshot | ||
response = ec2_client.register_image( | ||
BlockDeviceMappings=[ | ||
{ | ||
'DeviceName': '/dev/sda1', # Modify as needed | ||
'Ebs': { | ||
'SnapshotId': snapshot_id, | ||
'VolumeSize': 80, # Modify as needed | ||
'VolumeType': 'gp2', # Modify as needed | ||
}, | ||
}, | ||
], | ||
RootDeviceName='/dev/sda1', | ||
VirtualizationType='hvm', | ||
Name=image_name, | ||
Description='Image created from snapshot in shutdown state', | ||
Architecture= 'x86_64' | ||
|
||
) | ||
|
||
# Print the newly created image ID | ||
print(f"Image ID: {response['ImageId']}") |
Binary file not shown.
Binary file not shown.
Binary file not shown.