{"id":20676538,"url":"https://github.com/ryosukedtomita/ocn_daily_login_aws_lambda","last_synced_at":"2026-05-20T14:38:37.793Z","repository":{"id":186250757,"uuid":"674583467","full_name":"RyosukeDTomita/ocn_daily_login_aws_lambda","owner":"RyosukeDTomita","description":"OCNの訪問ログインをseleniumで自動化する。(AWS版)","archived":false,"fork":false,"pushed_at":"2025-01-24T01:00:56.000Z","size":658,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T18:53:47.962Z","etag":null,"topics":["aws-lambda","chromium-headless","cloudformation","iac","python3","selenium"],"latest_commit_sha":null,"homepage":"https://www.ocn.ne.jp/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RyosukeDTomita.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-08-04T09:43:54.000Z","updated_at":"2025-01-24T01:00:56.000Z","dependencies_parsed_at":null,"dependency_job_id":"80ea4523-872a-415e-a4ae-a44ce962a884","html_url":"https://github.com/RyosukeDTomita/ocn_daily_login_aws_lambda","commit_stats":null,"previous_names":["ryosukedtomita/ocn_daily_login_aws_lambda"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/RyosukeDTomita/ocn_daily_login_aws_lambda","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Focn_daily_login_aws_lambda","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Focn_daily_login_aws_lambda/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Focn_daily_login_aws_lambda/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Focn_daily_login_aws_lambda/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RyosukeDTomita","download_url":"https://codeload.github.com/RyosukeDTomita/ocn_daily_login_aws_lambda/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RyosukeDTomita%2Focn_daily_login_aws_lambda/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263868246,"owners_count":23522317,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-lambda","chromium-headless","cloudformation","iac","python3","selenium"],"created_at":"2024-11-16T21:12:57.846Z","updated_at":"2026-05-20T14:38:37.764Z","avatar_url":"https://github.com/RyosukeDTomita.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# INDEX\n- [ABOUT](#ABOUT)\n- [ENVIRONMENT](#ENVIRONMENT)\n- [PREPARING](#PREPARING)\n- [HOW TO USE](#HOW-TO-USE)\n- [REFERENCE](#REFERENCE)\n******\n\n\n# ABOUT\n![template](./docs/fig/template1-designer.png)\n\n- Using selenium, push [ocn top page](https://www.ocn.ne.jp/) \"OCN訪問ポイント\" button automatically to get Dpoint.\n- OCN site has two factor authentication, but AWS Lambda cannot get SMS Auhentication PIN when running.\n- That's why, this Lambda use prepared `cookies.pkl` to login.\n- cookies.pkl must have been created by [create_cookies.py](./create_cookies.py) locally and uploaded to S3 beforehand. \n\n![ocn訪問ポイント](./docs/fig/ocn訪問ポイント.png)\n\n******\n\n\n# ENVIRONMENT\n- python 3.7 (chromium-headless supported version)\n- [headless-chromium-amazonlinux-2017-03](https://github.com/adieuadieu/serverless-chrome/releases/download/v1.0.0-55/stable-headless-chromium-amazonlinux-2017-03.zip)\n- [chromedriver_linux64](https://chromedriver.storage.googleapis.com/2.43/chromedriver_linux64.zip)\nsee [requirements.txt](./requirements.txt)\n******\n\n\n# PREPARING\n## Common\n### AWS CLI\n- Create AWS IAM Users for AWS CLI and attached `AdministratorAcess`.\n- [install aws cli](https://docs.aws.amazon.com/ja_jp/cli/latest/userguide/getting-started-install.html)\n- create ~/.aws/config and paste AccessKey, SecretAccessKey.\n\n```\n# ~/.aws/config\n[profile default]\nregion = ap-northeast-1\naws_access_key_id = \u003c\u003cIAM AccessKey\u003e\u003e\naws_secret_access_key = \u003c\u003cIAM SecretAccessKey\u003e\u003e\n```\n\n- check connection\n\n```shell\naws sts get-caller-identity\n```\n\n### python(venv)\n\n```shell\n# install python3.7\nsudo apt install software-properties-common\nsudo add-apt-repository ppa:deadsnakes/ppa\nsudo apt install python3.7\n \n# install python3.7 venv\nsudo apt install python3.7-venv\n \n# create python3.7 venv\npython3.7 -m venv ~/ocn_daily_login\nsource ~/ocn_daily_login/bin/activate # activate venv\n```\n\n### clone this repository and set up\n\n```shell\n# download repository\ngit clone https://github.com:RyosukeDTomita/ocn_dialy_login_aws_lambda.git\n\n# set up\ncd ocn_dialy_login_aws_lambda\npip -r requirements.txt\n```\n\n### Download headless-chromeium and driver\n\n```shell\ncd ./create_selenium_driver_layers\nsource mk_driver_lib_layer.sh\nls create_selenium_driver_layers/headless\nchromedriver*  headless-chromium*  locales/\n```\n\n## Use CloudFormation\n### AWS SAM settings\n\n\u003e [how to install](https://docs.aws.amazon.com/ja_jp/serverless-application-model/latest/developerguide/install-sam-cli.html)\n1. download zip\n2. unzip\n3. install\n4. check\n\n```shell\n# install command\nsudo ./sam-installation/install\nsam --version\n```\n\n\n### build and deploy\n\n```shell\nsam build\nsam deploy --guided --capabilities CAPABILITY_NAMED_IAM\n```\n\n```shell\nsam delete # delete stack\n```\nIf you want to use GUI, see [README_gui.md](./docs/README_gui.md)\n\n**For developer**, you can only deploy IAM Role and S3 for the first deploy.\n\n```shell\n# only initial deploy\nsam build -t ./template_s3iam.yaml\nsam deploy --guided --capabilities CAPABILITY_NAMED_IAM\n```\n\n```shell\n# skip deploy S3 and IAM Role\nsam build -t template_dev.yaml\nsam deploy --guided\n```\n\u003e **Note**\n\u003e Do not use `-t` in `sam deploy`\n\u003e If you use, python library(boto3 and seleniumA) do not deploy with lambda and `No module name` Error occured.\n******\n\n\n# HOW TO USE\n- create cookies.pkl and upload to S3.\n\n```shell\npython3 create_cookies.py --userid \u003cdocomo userid\u003e --password \u003cpassword\u003e --bucket \u003cbucket-name\u003e --profile \u003caws cli profile\u003e\n```\n- Then, every 01:00 AM, EventBridge call lambda function and push OCN daily login button.\n\n:warning: If you want to just reupload `cookies.pkl`, you can use aws cli.\n\n```shell\naws s3 cp cookies.pkl s3://cookie-for-iceman2 --acl private --profile=default\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryosukedtomita%2Focn_daily_login_aws_lambda","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fryosukedtomita%2Focn_daily_login_aws_lambda","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fryosukedtomita%2Focn_daily_login_aws_lambda/lists"}