-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add referencing existing security groups for inbound traffic Add referencing existing security groups for inbound traffic Add inboud security groups Add inboud security group Add annotation Add annotations Add annotationsss
- Loading branch information
1 parent
9e2cbe7
commit 4803ea9
Showing
7 changed files
with
301 additions
and
84 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import boto3 | ||
|
||
class S3Manager: | ||
def __init__(self, region_name='ap-northeast-2'): | ||
self.session = boto3.Session(region_name=region_name) | ||
self.s3 = self.session.resource('s3') | ||
|
||
def upload_to_s3(self, bucket_name, file_path, s3_key): | ||
try: | ||
self.s3.Bucket(bucket_name).upload_file(file_path, s3_key) | ||
print(f"파일 업로드 완료: {file_path} -> s3://{bucket_name}/{s3_key}") | ||
except Exception as e: | ||
print(f"파일 업로드 실패: {str(e)}") | ||
|
||
def main(): | ||
s3_manager = S3Manager() | ||
|
||
bucket_name = 'robin' | ||
file_path = '/path/to/file.txt' | ||
s3_key = 'uploaded-file.txt' | ||
|
||
s3_manager.upload_to_s3(bucket_name, file_path, s3_key) | ||
|
||
if __name__ == "__main__": | ||
main() |
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
Oops, something went wrong.